Skip to main content

ProcessLaunch

Struct ProcessLaunch 

Source
pub struct ProcessLaunch {
    pub host: &'static dyn ProcessHost,
    pub environment: Option<Vec<EnvironmentVariable>>,
    pub home: Option<HomeGrant>,
    pub network: u32,
}
Expand description

What a child’s coroutine needs to become a process, carried from the spawn request to the loader that starts its entry.

Fields§

§host: &'static dyn ProcessHost§environment: Option<Vec<EnvironmentVariable>>

Replaces the environment the task copied from its parent.

§home: Option<HomeGrant>

Becomes the child’s home directory capability, bound to the child’s task.

§network: u32

The network rights the process gets (XILA_NETWORK_CONNECT, _LISTEN, _RESOLVE). Zero, the default for every launch, grants no network: nothing is inherited, and a parent can only pass a subset of its own rights to a child.

Implementations§

Source§

impl ProcessLaunch

Source

pub unsafe fn run( self, state: NonNull<HostState>, entry: unsafe extern "C" fn(*const XilaStartup) -> i32, heap: NonNull<Heap>, ) -> i32

Run a native entry as a process, on the calling coroutine, with the startup data in state. The coroutine runs inside the process’s task, which is how the process learns its identity.

Returns the entry’s exit status, or -1 if the process could not be set up: the coroutine is not on a registered task or the task is gone.

Every resource the process owns is held by state, which belongs to the host side of the task, not to this coroutine’s stack: the call keeps only pointers to it. The home grant moves into the state before the first suspension, and the environment is owned by that suspended future, which a cancellation drops in place. Returning from the entry, a failed setup and xila_process_exit each release the state’s resources once, before the process ends; a cancellation leaves them for the host to release with HostState::release. A worker that exits the process discards the main coroutine’s frames, which own nothing for the same reason.

§Safety

Same contract as crate::run_main, and state and heap stay at their addresses and live until native execution has permanently ended. The caller must keep no other owned object live above this call.

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
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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.