pub struct HandleTable {
slots: Vec<Slot>,
free: Vec<u32>,
len: usize,
reserved: usize,
}Expand description
The process handle table.
Index 0 is permanently reserved and never handed out: this makes handle
value 0 (structure (index=0, gen=0)/2) impossible without needing a
non-zero starting generation. A new slot starts at generation 1 and every
reuse increments the generation before the entry becomes visible.
Fields§
§slots: Vec<Slot>§free: Vec<u32>§len: usize§reserved: usizeSlots promised to an in-progress receive (§4.5 step 3). Counted against
HandleTable::free_slots but not yet occupied; HandleTable::insert
consumes one unit per successful insert.
Implementations§
Source§impl HandleTable
impl HandleTable
Sourcepub fn reserved(&self) -> usize
pub fn reserved(&self) -> usize
Number of slots currently promised by HandleTable::reserve.
Sourcepub fn free_slots(&self) -> usize
pub fn free_slots(&self) -> usize
Slots that may still be handed out, honouring outstanding reservations.
Sourcepub fn reserve(&mut self, n: usize) -> Result<(), SyscallError>
pub fn reserve(&mut self, n: usize) -> Result<(), SyscallError>
Reserve n slots for an in-progress receive (§4.5 step 3).
Invariant: after a successful reserve(n) the next n successful
HandleTable::insert calls cannot fail for capacity reasons; each one
consumes one reserved unit. The caller must release any unused units
with HandleTable::release_reservation.
Sourcepub fn release_reservation(&mut self, n: usize)
pub fn release_reservation(&mut self, n: usize)
Return n unused reserved slots (saturating).
Sourcepub fn insert(&mut self, rights: u32, obj: ObjRef, badge: u64) -> Option<Handle>
pub fn insert(&mut self, rights: u32, obj: ObjRef, badge: u64) -> Option<Handle>
Insert an entry, reusing a free slot if possible.
Returns None when the table already holds MAX_HANDLES entries and
no reservation covers this insert. A successful insert consumes one
unit of an outstanding reservation, guaranteeing it cannot fail.
Sourcepub fn resolve(&self, h: Handle, required: u32) -> Result<Entry, SyscallError>
pub fn resolve(&self, h: Handle, required: u32) -> Result<Entry, SyscallError>
Resolve a handle and check that required rights are present.
Sourcepub fn remove(&mut self, h: Handle) -> Result<Entry, SyscallError>
pub fn remove(&mut self, h: Handle) -> Result<Entry, SyscallError>
Take an entry out of the table and apply its object side effects (endpoint reference release, Reply-handle cancellation).
Sourcepub fn remove_raw(&mut self, h: Handle) -> Result<Entry, SyscallError>
pub fn remove_raw(&mut self, h: Handle) -> Result<Entry, SyscallError>
Take an entry out of the table without object side effects.
For consumption paths that take over the object’s obligations, e.g.
sys_ep_reply, which delivers the reply immediately afterwards and must
not cancel the call it is completing.
Sourcepub fn remove_all(&mut self)
pub fn remove_all(&mut self)
Drain every entry, applying the object-side effects of dropping each
handle (in particular closing the last EP_RECV endpoint reference).
Sourcepub fn duplicate(
&mut self,
h: Handle,
requested_rights: u32,
) -> Result<Handle, SyscallError>
pub fn duplicate( &mut self, h: Handle, requested_rights: u32, ) -> Result<Handle, SyscallError>
Duplicate a handle with an equal or smaller rights mask.
Sourcepub fn fork_clone(&self) -> Self
pub fn fork_clone(&self) -> Self
Clone this table for fork: same objects, rights and generations.
Every copied EP_RECV endpoint entry takes an extra reference.
Sourcepub const fn generic_rights() -> u32
pub const fn generic_rights() -> u32
Mask of rights that may be requested through ipc_mint/duplicate.
fn validate(&self, h: Handle) -> Result<Entry, SyscallError>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for HandleTable
impl !UnwindSafe for HandleTable
impl Forget for HandleTable
impl Freeze for HandleTable
impl Move for HandleTable
impl Send for HandleTable
impl Sync for HandleTable
impl Unpin for HandleTable
impl UnsafeUnpin for HandleTable
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more