code wiki / (root) / nx_sigpipe_gate.nx

nx_sigpipe_gate.nx

buildroot/runtime/nx_sigpipe_gate.nx

6159 B127 linesdepth 4pulls 5 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_sigpipe_gate.nx -- proves the SIGPIPE root fix, and proves the tooth can SEE the disease it cures (debt seq1261/seq1126 family). THE FLAW: a process that writes to a peer which has closed its end takes SIGPIPE's default action -- TERMINATE. For a daemon that is an outage with no diagnosis: it dies holding a healthy listening socket, the supervisor reports a crash-loop, and the request that triggered it looks failed even when the work completed. Every long-running server in the tree ran this way (a tree-wide grep for SIGPIPE handling returned NOTHING before this gate). THE PAIR (why this gate is not vacuous): T1 forks a child that does NOT install the ignore and confirms the kernel KILLS it with signal 13 -- if this ever goes green-by-accident the tooth has stopped measuring anything. T2 forks a child that DOES install it and confirms the same write instead returns -EPIPE and the child exits 0. One tooth shows the disease, the other shows the cure, and neither can pass for the other's reason.

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_http_server.nx nx_sigpipe_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_http_server.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 gv_head gv_puts sys_write sg_probe sys_mmap ↻ sys_pipe2 sys_fork sys_close sys_ignore_sigpipe sys_mmap ↻ sys_write ↻ sys_exit sys_wait4 wait_term_signal gv_check gv_puts ↻ wait_exit_code sys_ignore_sigpipe ↻ sys_write ↻ sys_mmap ↻ sys_pipe2 ↻ sys_fork ↻ nx_http_server_addr_loopba nx_http_server_make_sockad nx_http_server_listen sys_ignore_sigpipe ↻ sys_socket sys_mmap ↻ sys_setsockopt sys_bind sys_close ↻ sys_listen sys_close ↻ sys_exit ↻ sys_wait4 ↻ gv_verdict gv_puts ↻

structs

none

consts

21const SG_EPIPE: i64 = 0 - 32 // -errno the kernel returns once SIGPIPE is ignored
22const SG_SIGPIPE: i64 = 13 // signal number (also the rt_sigaction syscall nr)
23const SG_CHILD_OK: i64 = 0 // child exit when it saw EPIPE and survived
24const SG_CHILD_WRONGRC: i64 = 7 // child survived but the write rc was not -EPIPE

functions

28func sg_probe(ignore: i64) -> i64
52func main() -> i64