← All compilation units

Flyology.Subprocesses.Bootstrap

Description

Launches a child image with two private AF_UNIX stream channels at stable descriptors. The control channel carries framed upgrade commands. The capability channel is dedicated exclusively to typed SCM_RIGHTS handoff.

Adopt_Inherited

procedure Adopt_Inherited
  (Control      : in out Sockets.Socket_Type;
   Capabilities : in out Socket_Handoffs.Handoff_Channel;
   Trust        : Socket_Handoffs.Peer_Trust := Socket_Handoffs.Trusted_Peer)

Adopt and validate the inherited child endpoints. Call this once near image startup, before creating application tasks. fd 3 becomes Control; fd 4 becomes the dedicated capability channel. Failure closes every endpoint that this call managed to acquire.

Parameters
Control

Closed destination for inherited fd 3

Capabilities

Closed destination for inherited fd 4

Trust

Peer trust used for capability-channel validation

Raised exceptions
Bootstrap_Error

The inherited descriptors are missing, malformed, unsupported for Trust, or cannot be adopted

Program_Error

An output already owns a resource

Bootstrap_Error

Bootstrap_Error : exception;

Bootstrap channels could not be created, validated, or adopted.

Child_Capability_Descriptor

Child_Capability_Descriptor : constant Flyology.IO.Descriptor := 4;

Stable child descriptor for the capability-handoff stream.

Child_Control_Descriptor

Child_Control_Descriptor    : constant Flyology.IO.Descriptor := 3;

Stable child descriptor for the framed control stream.

Spawn

procedure Spawn
  (Item         : Command;
   Child        : in out Process;
   Control      : in out Sockets.Socket_Type;
   Capabilities : in out Socket_Handoffs.Handoff_Channel)

Spawn Item and return the coordinator endpoints. The child sees the matching endpoints as fd 3 and fd 4. All four original socket-pair descriptors are closed in the child during posix_spawn file actions. The child inherits the coordinator's standard output and error; its standard input immediately observes end-of-file.

Parameters
Item

Child executable, arguments, environment, and launch context

Child

Closed destination process handle

Control

Closed destination for the coordinator control endpoint

Capabilities

Closed destination for the capability endpoint

Raised exceptions
Spawn_Error

Channel creation, posix_spawn, or reaper setup fails

Bootstrap_Error

A spawned channel cannot be validated or adopted; the child is terminated and reaped before this is raised

Program_Error

An output already owns a resource

Storage_Error

Launch-description allocation fails