Skip to main content

Module subprocess

Module subprocess 

Source
Expand description

Environment-marker contract between the supervisor and the detached agent and MCP children it spawns.

The supervisor stamps these markers at spawn time; shutdown and reconciliation read them back from /proc/<pid>/environ to confirm a registry PID still names this installation’s child before signalling it. PIDs are recycled, and group-signalling a stale PID (kill(-pid)) could reach an unrelated session leader — so a row is only ever signalled once both the subprocess marker and the exact name_key=service_name pairing are found.

Constants§

AGENT_NAME_ENV
MCP_SERVICE_ID_ENV
SUBPROCESS_MARKER_ENV

Functions§

environ_identifies_child
is_zombie
Reports whether pid is a zombie — terminated but not yet reaped.
live_pid_is_subprocess
Confirm a live PID still names this installation’s child by reading its /proc/<pid>/environ and matching the spawn markers.
signalable_pid
Convert an OS process id into the signed form kill(2) expects, rejecting any value that would target more than that single process.