| // Copyright 2023 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| library fuchsia.memory.heapdump.process; |
| |
| using zx; |
| |
| /// Rights to map a VMO in read-only mode and read its "content size" property. |
| const VMO_MAP_READONLY_RIGHTS zx.Rights |
| = zx.RIGHTS_BASIC | zx.Rights.READ | zx.Rights.GET_PROPERTY | zx.Rights.MAP; |
| |
| /// Instrumented processes send application-initiated snapshots over this channel. |
| /// |
| /// This channel is also used by the server to detect when an instrumented process exits. |
| closed protocol SnapshotSinkV1 { |
| /// Asks the server to store a snapshot with the given name and the given allocations VMO. |
| /// |
| /// All the resources referenced by the given allocations VMO will be resolved using the |
| /// resources VMO that was shared by the process at registration time. |
| strict StoreNamedSnapshot(resource struct { |
| snapshot_name string:zx.MAX_NAME_LEN; |
| allocations_vmo_snapshot zx.Handle:<VMO, VMO_MAP_READONLY_RIGHTS>; |
| }); |
| }; |
| |
| /// The Registry keeps track of all the instrumented processes that are running in the system. |
| @discoverable |
| closed protocol Registry { |
| /// Binds the given process to the registry and share the relevant resources. |
| strict RegisterV1(resource struct { |
| process zx.Handle:<PROCESS, zx.RIGHTS_BASIC | zx.RIGHTS_IO | zx.Rights.GET_PROPERTY>; |
| allocations_vmo zx.Handle:<VMO, VMO_MAP_READONLY_RIGHTS>; |
| resources_vmo zx.Handle:<VMO, VMO_MAP_READONLY_RIGHTS>; |
| snapshot_sink server_end:SnapshotSinkV1; |
| }); |
| }; |