Skip to main content

Endpoint

Struct Endpoint 

Source
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: u32

Configured queue depth (mirrors state.depth).

§flags: u16

EP_FLAG_* creation flags.

§owner_silo: u32

Owning silo id (0 when unattributed).

§recv_refs: AtomicU32

Live handles carrying EP_RECV.

§send_waitq: WaitQueue

Senders blocked on a full queue.

§recv_waitq: WaitQueue

Receivers blocked on an empty queue.

§_charge: Option<IpcCharge>

Creator-silo endpoint count (§12), released with the object.

Implementations§

Source§

impl Endpoint

Source

pub fn create( depth: u32, flags: u16, owner_silo: u32, charge: Option<IpcCharge>, ) -> Result<Arc<Endpoint>, SyscallError>

Create an endpoint.

Source

pub fn id(&self) -> u64

Internal object id.

Source

pub fn is_alive(&self) -> bool

Whether the endpoint is still open.

Source

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.

Source

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::NeedSlots reports 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).

Source

pub fn head_requirements(&self) -> Option<(u32, u16)>

(data_len, ncaps) of the queued head, without dequeuing it.

Source

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.

Source

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.

Source

pub fn bind_notif( self: &Arc<Self>, notif: Arc<Notification>, ) -> Result<(), SyscallError>

Bind a notification to this endpoint.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.