Skip to main content

Module process

Module process 

Source
Expand description

Process liveness probe shared by the atomic-write orphan sweep and the engine’s process management (ipc::process re-exports it).

signal_target and group_target are the only gates between a PID and a signal syscall in LeanCTX. On Unix kill(2) gives PIDs outside 1..=i32::MAX a meaning nobody wants from a PID file: 0 is the caller’s own process group and a u32 above i32::MAX wraps to a negative pid_t, i.e. a process group, or with u32::MAX (-1) every process the user may signal. Twice (2026-11-05, 2026-11-07) every process of a user on pounce received SIGTERM; LeanCTX must never be able to do that.

Enums§

PidFileError
Why the text of a PID file does not name a process.
PidRefusal
Why a PID may not be handed to a signal syscall.

Constants§

MAX_PID
The highest PID pid_t can hold; no supported OS hands out a larger one.

Functions§

group_target
The process-group id as a positive value for killpg(pgid, …) or kill(-pgid, …), or why it may not be signalled: everything signal_target refuses, plus the group this process belongs to.
is_alive
Check whether a process with the given PID is still running.
parse_pid_file
Parse the text of a PID file (its first line, trimmed). Only a decimal PID in 2..=i32::MAX is accepted; empty text, garbage, signs, zero, PID 1 and overflowing values are refused, so a corrupt file can never become a signal target.
signal_target
The PID as a positive pid_t that addresses exactly one process, or why it may not be signalled: 0, 1, above i32::MAX, or this process.