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: u32The 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
impl ProcessLaunch
Sourcepub unsafe fn run(
self,
state: NonNull<HostState>,
entry: unsafe extern "C" fn(*const XilaStartup) -> i32,
heap: NonNull<Heap>,
) -> i32
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.