nx_zombie_audit.nx
buildroot/runtime/nx_zombie_audit.nx
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
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
structs
| none |
consts
| 10 | const ZA_MAGIC_4096: i64 = 4096 |
| 11 | const ZA_MAGIC_1024: i64 = 1024 |
| 13 | const ZA_BUF: i64 = 65536 |
| 14 | const ZA_LEAK_THRESHOLD: i64 = 5 // > this many unreaped children under one parent = a reap-leak, not normal churn |
functions
| 16 | func 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 } |
| 17 | func 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 } |
| 18 | func za_pidnum(name: *u8) -> i64 called by 1: za_scan |
| 25 | func za_n_into(dst: *u8, off: i64, v: i64) -> i64 |
| 30 | func za_readfile(pid: i64, leaf: *u8, buf: *u8, cap: i64) -> i64 |
| 42 | func za_stat(pid: i64, out_ppid: *i64) -> i64 |
| 62 | func za_scan(out_ppid: *i64, out_cnt: *i64, cap: i64, total_out: *i64) -> i64 called by 2: mainmain calls 8: sys_openat_rdsys_mmapsys_getdents64dirent_reclendirent_nameza_pidnum+2 |
| 95 | func main() -> i64 |