| // Copyright 2022 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.starnix.binder; |
| |
| using zx; |
| using fuchsia.posix; |
| |
| const MAX_PATH_LENGTH uint64 = 4095; |
| |
| /// Give access to the binder nodes. |
| @discoverable |
| protocol DevBinder { |
| /// Open the binder device node. |
| Open(resource table { |
| /// The path to the binder device in the starnix process. |
| /// Mandatory |
| 1: path vector<uint8>:MAX_PATH_LENGTH; |
| |
| /// The handle to the process that will use the binder driver. It is |
| /// used by the driver to read the data sent to the driver. |
| /// Mandatory |
| /// TODO(fxb/112325): Find a better way to give access to the proces memory. |
| 2: process zx.handle:PROCESS; |
| |
| // TODO(qsr): Add a client to a protocol allowing access to the fd |
| // table of the client. |
| 3: reserved; |
| |
| /// The request to the Binder protocol implementation. |
| /// Mandatory |
| 4: binder server_end:Binder; |
| }); |
| }; |
| |
| /// An opened connection to a binder driver. |
| protocol Binder { |
| /// Set the VMO to used as a share resource between the driver and the |
| /// client. `mapped_address` is the address where the vmo is mapped in the |
| /// client address space. |
| SetVmo(resource struct { |
| vmo zx.handle:VMO; |
| mapped_address uint64; |
| }); |
| Ioctl(struct { |
| tid zx.koid; |
| request uint32; |
| parameter uint64; |
| }) -> () error fuchsia.posix.Errno; |
| }; |