pub trait KernelObject: DowncastSync + Debug {
Show 13 methods fn id(&self) -> KoID; fn type_name(&self) -> &str; fn name(&self) -> String; fn set_name(&self, name: &str); fn signal(&self) -> Signal; fn signal_set(&self, signal: Signal); fn signal_clear(&self, signal: Signal); fn signal_change(&self, clear: Signal, set: Signal); fn add_signal_callback(&self, callback: SignalHandler); fn get_child(&self, _id: KoID) -> ZxResult<Arc<dyn KernelObject>> { ... } fn peer(&self) -> ZxResult<Arc<dyn KernelObject>> { ... } fn related_koid(&self) -> KoID { ... } fn allowed_signals(&self) -> Signal { ... }
}
Expand description

Common interface of a kernel object.

Implemented by impl_kobject macro.

Required Methods

Get object’s KoID.

Get the name of the type of the kernel object.

Get object’s name.

Set object’s name.

Get the signal status.

Assert signal.

Deassert signal.

Change signal status: first clear then set indicated bits.

All signal callbacks will be called.

Add callback for signal status changes.

The callback is a function of Fn(Signal) -> bool. It returns a bool indicating whether the handle process is over. If true, the function will never be called again.

Provided Methods

Attempt to find a child of the object with given KoID.

If the object is a Process, the Threads it contains may be obtained.

If the object is a Job, its (immediate) child Jobs and the Processes it contains may be obtained.

If the object is a Resource, its (immediate) child Resources may be obtained.

Attempt to get the object’s peer.

An object peer is the opposite endpoint of a Channel, Socket, Fifo, or EventPair.

If the object is related to another (such as the other end of a channel, or the parent of a job), returns the KoID of that object, otherwise returns zero.

Get object’s allowed signals.

Implementations

Returns true if the trait object wraps an object of type __T.

Returns a boxed object from a boxed trait object if the underlying object is of type __T. Returns the original boxed trait if it isn’t.

Returns an Rc-ed object from an Rc-ed trait object if the underlying object is of type __T. Returns the original Rc-ed trait if it isn’t.

Returns a reference to the object within the trait object if it is of type __T, or None if it isn’t.

Returns a mutable reference to the object within the trait object if it is of type __T, or None if it isn’t.

Returns an Arc-ed object from an Arc-ed trait object if the underlying object is of type __T. Returns the original Arc-ed trait if it isn’t.

Asynchronous wait for one of signal.

Once one of the signal asserted, push a packet with key into the port,

It’s used to implement sys_object_wait_async.

Implementors