[−][src]Enum sunrise_kernel::process::Handle
A handle to a userspace-accessible resource.
Description
When the userspace manipulates a kernel construct, it does so by operating on Handles, which are analogious to File Descriptor in a Unix System. A Handle represents all kinds of kernel structures, from IPC objects to Threads and IRQ events.
A Handle may be shared across multiple processes, usually by passing it via IPC. This can be used, for instance, to share a handle to a memory region, allowing for the mapping of Shared Memory.
Most handles can be waited on via crate::syscalls::wait_synchronization, which will have relevant behavior for all the different kind of handles.
Variants
InterruptEvent(IRQEvent)
A special ReadableEvent that is triggered automatically when an IRQ is triggered.
ReadableEvent(ReadableEvent)
An event on which we can wait, triggered by a WritableEvent.
WritableEvent(WritableEvent)
Trigger for an associated ReadableEvent.
ServerPort(ServerPort)
The server side of an IPC port. See crate::ipc::port for more information.
ClientPort(ClientPort)
The client side of an IPC port. See crate::ipc::port for more information.
ServerSession(ServerSession)
The server side of an IPC session. See crate::ipc::session for more information.
ClientSession(ClientSession)
The client side of an IPC session. See crate::ipc::session for more information.
Thread(Weak<ThreadStruct>)
A thread.
Process(Arc<ProcessStruct>)
A process.
A shared memory region. The handle holds on to the underlying physical memory, which means the memory will only get freed once all handles to it are dropped.
Implementations
impl Handle
[src]
pub fn as_waitable(&self) -> Result<&dyn Waitable, UserspaceError>
[src]
Gets the handle as a Waitable, or return a UserspaceError
if the handle cannot be waited on.
pub fn as_client_port(&self) -> Result<ClientPort, UserspaceError>
[src]
Casts the handle as a ClientPort, or returns a UserspaceError
.
pub fn as_server_session(&self) -> Result<ServerSession, UserspaceError>
[src]
Casts the handle as a ServerSession, or returns a UserspaceError
.
pub fn as_client_session(&self) -> Result<ClientSession, UserspaceError>
[src]
Casts the handle as a ClientSession, or returns a UserspaceError
.
pub fn as_thread_handle(&self) -> Result<Weak<ThreadStruct>, UserspaceError>
[src]
Casts the handle as a Weak<ThreadStruct>, or returns a UserspaceError
.
pub fn as_process(&self) -> Result<Arc<ProcessStruct>, UserspaceError>
[src]
Casts the handle as an Arc<ProcessStruct>, or returns a UserspaceError
.
pub fn as_writable_event(&self) -> Result<WritableEvent, UserspaceError>
[src]
Casts the handle as an Arc<WritableEvent> if the handle is a
WritableEvent, or returns a UserspaceError
.
pub fn as_readable_event(&self) -> Result<ReadableEvent, UserspaceError>
[src]
Casts the handle as an Arc<ReadableEvent>, or returns a UserspaceError
.
pub fn as_shared_memory(
&self
) -> Result<Arc<SpinRwLock<Vec<PhysicalMemRegion>>>, UserspaceError>
[src]
&self
) -> Result<Arc<SpinRwLock<Vec<PhysicalMemRegion>>>, UserspaceError>
Casts the handle as an Arc<SpinRwLock<Vec<PhysicalMemRegion>>>, or returns a
UserspaceError
.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Handle
impl Send for Handle
impl Sync for Handle
impl Unpin for Handle
impl !UnwindSafe for Handle
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,