code wiki / (root) / nx_zombie_audit.nx

nx_zombie_audit.nx

buildroot/runtime/nx_zombie_audit.nx

6336 B113 linesdepth 2pulls 2 transitivereach 1 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_zombie_audit.nx -- SOVEREIGN DEFUNCT_ZOMBIE_DETECTION (the capability nx_daemon_health_audit lists as MISSING). Scans /proc (getdents, no ps/shell), parses /proc/<pid>/stat for state 'Z' (defunct/zombie), maps each to its PARENT pid+comm, and reports per-parent zombie counts -- so the doctor (and the operator) can SEE a fork-per-connection daemon leaking unreaped children (the nx_mp_serve 516-leak class). A parent over ZA_LEAK_THRESHOLD zombies is flagged LEAK. Run: nx_zombie_audit. license_tier: ORIGINAL module: nishi-core.perception.zombie_audit capability: PERCEPTION (daemon health)

dependencies 1 imports · 1 importers

nx_syscalls.nx nx_zombie_audit.nx nx_zombie_audit_gate.nx

imports: nx_syscalls.nx

imported by: nx_zombie_audit_gate.nx

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

main sys_mmap za_scan sys_openat_rd sys_mmap ↻ sys_getdents64 dirent_reclen dirent_name za_pidnum za_stat sys_mmap ↻ za_readfile sys_mmap ↻ za_n_into sys_mmap ↻ sys_openat_rd ↻ sys_read sys_close sys_close ↻ za_p sys_write za_n sys_mmap ↻ sys_write ↻ za_readfile ↻ sys_exit

structs

none

consts

10const ZA_MAGIC_4096: i64 = 4096
11const ZA_MAGIC_1024: i64 = 1024
13const ZA_BUF: i64 = 65536
14const ZA_LEAK_THRESHOLD: i64 = 5 // > this many unreaped children under one parent = a reap-leak, not normal churn

functions

16func za_p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main calls 1: sys_write
17func za_n(v: i64) -> i64 { let t: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m} var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} let b: *u8=sys_mmap(28); var i: i64=0; while i<k{b[i]=t[k-1-i];i=i+1} sys_write(1,b,k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
18func za_pidnum(name: *u8) -> i64
called by 1: za_scan
25func za_n_into(dst: *u8, off: i64, v: i64) -> i64
called by 1: za_readfile calls 1: sys_mmap
30func za_readfile(pid: i64, leaf: *u8, buf: *u8, cap: i64) -> i64
42func za_stat(pid: i64, out_ppid: *i64) -> i64
called by 1: za_scan calls 2: sys_mmapza_readfile
62func za_scan(out_ppid: *i64, out_cnt: *i64, cap: i64, total_out: *i64) -> i64
95func main() -> i64