kernelbinder

package
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2026 License: CC0-1.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDriverClosed = errors.New("binder: driver is closed")

ErrDriverClosed is returned when an operation is attempted on a closed Driver.

Functions

This section is empty.

Types

type Driver

type Driver struct {
	// contains filtered or unexported fields
}

Driver implements binder.Transport using /dev/binder.

func Open

func Open(
	ctx context.Context,
	opts ...binder.Option,
) (_driver *Driver, _err error)

Open opens /dev/binder and initializes the driver.

func (*Driver) AcquireHandle

func (d *Driver) AcquireHandle(
	ctx context.Context,
	handle uint32,
) (_err error)

AcquireHandle increments the strong reference count for a binder handle.

func (*Driver) ClearDeathNotification

func (d *Driver) ClearDeathNotification(
	ctx context.Context,
	handle uint32,
	recipient binder.DeathRecipient,
) (_err error)

ClearDeathNotification clears a death notification for a binder handle.

func (*Driver) Close

func (d *Driver) Close(
	ctx context.Context,
) (_err error)

Close releases all death notifications, acquired binder handles, the mmap, and the file descriptor.

func (*Driver) RegisterReceiver

func (d *Driver) RegisterReceiver(
	ctx context.Context,
	receiver binder.TransactionReceiver,
) uintptr

RegisterReceiver associates a TransactionReceiver with a unique cookie and starts the read loop if it has not been started yet. Returns the cookie that identifies this receiver in incoming BR_TRANSACTION events.

The cookie is the heap address of a receiverEntry allocated for this registration. The kernel binder driver uses the flat_binder_object.binder and .cookie fields to create/lookup binder nodes and to dispatch incoming transactions. Both fields must be non-zero process-space addresses -- synthetic counter values (1, 2, 3 ...) are rejected by the kernel. Storing the *receiverEntry in the receivers map keeps the object reachable, so its address remains valid until UnregisterReceiver is called.

func (*Driver) ReleaseHandle

func (d *Driver) ReleaseHandle(
	ctx context.Context,
	handle uint32,
) (_err error)

ReleaseHandle decrements the strong reference count for a binder handle.

func (*Driver) Reply

func (d *Driver) Reply(
	ctx context.Context,
	reply *parcel.Parcel,
) (_err error)

Reply sends BC_REPLY with the given parcel data back to the transaction originator.

func (*Driver) RequestDeathNotification

func (d *Driver) RequestDeathNotification(
	ctx context.Context,
	handle uint32,
	recipient binder.DeathRecipient,
) (_err error)

RequestDeathNotification registers a death notification for a binder handle. Returns an error if the handle already has a registered death recipient; call ClearDeathNotification first to replace it.

func (*Driver) Transact

func (d *Driver) Transact(
	ctx context.Context,
	handle uint32,
	code binder.TransactionCode,
	flags binder.TransactionFlags,
	data *parcel.Parcel,
) (_reply *parcel.Parcel, _err error)

Transact performs a synchronous binder transaction.

func (*Driver) UnregisterReceiver

func (d *Driver) UnregisterReceiver(
	ctx context.Context,
	cookie uintptr,
)

UnregisterReceiver removes a TransactionReceiver by its cookie.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL