code wiki / (root) / nx_daemon_reap_gate.nx

nx_daemon_reap_gate.nx

buildroot/runtime/nx_daemon_reap_gate.nx

8637 B149 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind gate/prooftopic daemon
docsdependenciesstructsconstsfunctions

about

nx_daemon_reap_gate.nx -- referee for nx_daemon_reap_lib, the ONE child reaper every forking daemon in the estate should compose. It gates the SAME functions a daemon would run, not a reimplementation, and it reaps REAL children it forks itself -- a reaper proven only on synthetic inputs has never met wait4. THE TEETH THAT MATTER: T1 is the empty-set case, and it is not decoration: a drain called with no children must RETURN, not block. Getting WNOHANG wrong turns every idle accept loop in the estate into a hang. T3 proves reaping actually happens against children this gate created, so a pass cannot come from a function that quietly does nothing -- the exact vacuity that let sixteen daemons leak for weeks. T6/T7 are the counter-underflow guard. A live-child counter that goes NEGATIVE turns a concurrency cap into a permanent grant, and that failure direction is silent: the daemon keeps serving, keeps forking, and nothing looks wrong until the box is the thing that reports it. T5 neg-control: below the cap the throttle must NOT wait. A throttle that always blocks would pass every "did it reap?" tooth while serialising the whole server. T8 bite: the drain FIRES on an exited child and stays SILENT when there is none, in one cell. license_tier: ORIGINAL expect_exit: 0

dependencies 2 imports · 0 importers

nx_gate_verdict.nx nx_daemon_reap_lib.nx nx_daemon_reap_gate.nx

imports: nx_gate_verdict.nxnx_daemon_reap_lib.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main gv_ctr sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ gv_head gv_puts sys_write ↻ dr_reap_nonblocking sys_wait4 gv_check gv_puts ↻ gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻ sys_munmap dr_reap_one sys_wait4 ↻ dr_throttle dr_reap_one ↻ dr_drain dr_reap_nonblocking ↻ gv_bite gv_puts ↻ gv_verdict gv_note_bare_rate gv_bare_rate

structs

none

consts

26const DRG_SPIN_MAX: i64 = 1000000
27const DRG_KIDS: i64 = 3
31const DRG_ALIVE_MS: i64 = 300

functions

33func main(argc: i64, argv: *i64) -> i64