pub struct Endpoint {
id: u64,
pub state: SpinLock<EpState>,
pub depth: u32,
pub flags: u16,
pub owner_silo: u32,
pub recv_refs: AtomicU32,
pub send_waitq: WaitQueue,
pub recv_waitq: WaitQueue,
_charge: Option<IpcCharge>,
}Expand description
An IPC endpoint.
Fields§
§id: u64§state: SpinLock<EpState>Mutable endpoint state.
depth: u32Configured queue depth (mirrors state.depth).
flags: u16EP_FLAG_* creation flags.
owner_silo: u32Owning silo id (0 when unattributed).
recv_refs: AtomicU32Live handles carrying EP_RECV.
send_waitq: WaitQueueSenders blocked on a full queue.
recv_waitq: WaitQueueReceivers blocked on an empty queue.
_charge: Option<IpcCharge>Creator-silo endpoint count (§12), released with the object.
Implementations§
Source§impl Endpoint
impl Endpoint
Sourcepub fn create(
depth: u32,
flags: u16,
owner_silo: u32,
charge: Option<IpcCharge>,
) -> Result<Arc<Endpoint>, SyscallError>
pub fn create( depth: u32, flags: u16, owner_silo: u32, charge: Option<IpcCharge>, ) -> Result<Arc<Endpoint>, SyscallError>
Create an endpoint.
Sourcepub fn push(
&self,
msg: InFlight,
nonblock: bool,
deadline_ns: Option<u64>,
) -> Result<(), SyscallError>
pub fn push( &self, msg: InFlight, nonblock: bool, deadline_ns: Option<u64>, ) -> Result<(), SyscallError>
Push a message, blocking while the queue is full unless nonblock.
deadline_ns (absolute, crate::sync::scheduler_clock_ns) bounds the
wait; on expiry nothing is committed and ETIMEDOUT is returned.
Sourcepub fn pop(
&self,
data_cap: u32,
caps_cap: u32,
nonblock: bool,
reserved: usize,
deadline_ns: Option<u64>,
) -> Result<PopOutcome, SyscallError>
pub fn pop( &self, data_cap: u32, caps_cap: u32, nonblock: bool, reserved: usize, deadline_ns: Option<u64>, ) -> Result<PopOutcome, SyscallError>
Pop a message or a pending bound-notification signal.
reserved is the number of handle-table slots the receiver has
already reserved. The handle count of the head (ncaps plus one
for a Reply) is compared with it under the endpoint lock, in the same
critical section as the dequeue:
- if it fits, the message is dequeued: every install that follows is covered by the reservation, so delivery is all-or-nothing (§4.5);
- if not, nothing is dequeued and
PopOutcome::NeedSlotsreports the exact count; the caller grows its reservation (outside this lock) and retries.
This replaces a peek-then-pop sizing that a second receiver thread, or a message arriving while the receiver was blocked on an empty queue, could invalidate. No lock is nested: the handle-table lock is never taken under the endpoint lock (handle removal takes them in the opposite order).
Sourcepub fn head_requirements(&self) -> Option<(u32, u16)>
pub fn head_requirements(&self) -> Option<(u32, u16)>
(data_len, ncaps) of the queued head, without dequeuing it.
Sourcepub fn peek_plan(&self) -> Option<PeekPlan>
pub fn peek_plan(&self) -> Option<PeekPlan>
Shape of what the next Endpoint::pop would return, without
dequeuing or consuming pending notification bits.
Returns None when a blocking receive would have to wait. A pending
notification is reported as an empty message with no capabilities.
Sourcepub fn close(&self)
pub fn close(&self)
Close the endpoint (idempotent). Queued messages are dropped, every live call attached to this endpoint is cancelled, and all waiters wake.
Sourcepub fn bind_notif(
self: &Arc<Self>,
notif: Arc<Notification>,
) -> Result<(), SyscallError>
pub fn bind_notif( self: &Arc<Self>, notif: Arc<Notification>, ) -> Result<(), SyscallError>
Bind a notification to this endpoint.
Auto Trait Implementations§
impl !Freeze for Endpoint
impl !RefUnwindSafe for Endpoint
impl !UnwindSafe for Endpoint
impl Forget for Endpoint
impl Move for Endpoint
impl Send for Endpoint
impl Sync for Endpoint
impl Unpin for Endpoint
impl UnsafeUnpin for Endpoint
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