Module init

Module init 

Source
Expand description

PID 1 init mode for pipette.

When pipette runs as PID 1 (e.g., via rdinit=/pipette in the kernel cmdline), it performs minimal init duties (mount filesystems), then forks. The child runs the normal pipette agent. PID 1 stays in a simple wait() loop, reaping all children (including orphans adopted by PID 1). When the pipette child exits, PID 1 calls reboot(2).

This fork-based design avoids conflicts between PID 1’s reaping duties and the pipette execute handler’s Child::wait() calls — PID 1 never runs pipette logic, so there’s no race between waitpid(-1) and waitpid(specific_pid).

Statics§

FORKED_FROM_PID1 🔒

Functions§

init_as_pid1
Perform minimal init duties and fork.
is_pid1
Returns true if this process is running as PID 1.
mount 🔒
mount_or_warn 🔒
pid1_reap_loop 🔒
PID 1 reap loop: wait for children forever.
was_forked_from_pid1
Returns true if this process was forked from PID 1 and should use reboot(2) directly for shutdown.