code wiki / _hdl_build / nx_system_triage.nx

nx_system_triage.nx

buildroot/runtime/_hdl_build/nx_system_triage.nx

25397 B517 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_system_triage.nx -- post-event situational awareness: WHAT IS RUNNING, WHAT IS CRASHED, WHAT IS RECOVERABLE, reported live + durable. Built for the reboot/crash case: /tmp organs die, daemons die, and until now nothing in the team could SAY so -- the operator had to ask Claude. (1) RUNNING -- /proc sweep: every live process whose cmdline is team-ish (nx_/.sov.elf), pid+cmdline (2) DAEMONS -- conf-listed expected daemons (D rows) matched against the same sweep -> RUNNING/DOWN (3) ORGANS -- conf-listed expected elfs (E rows): /tmp/<n>.sov.elf|.elf present? missing + source present = RECOVERABLE (rebuild lane named: S=sov_build_run W=wheeler) missing + source missing = UNRECOVERABLE (loud) (4) CRASH-SIGNALS-- RUNTIME-CRASH count in knowledge/status/issues_durable.log (filed history) Verdict: GREEN (all present, daemons up) / RECOVER (only rebuildable losses) / ATTENTION (unrecoverable or expected daemon down). Durable TRIAGE line -> knowledge/status/system_triage.log; exit 0/2/1. Expected set is DATA-DRIVEN: knowledge/status/triage_expected.conf (add a row = widen coverage). Sovereign (syscalls only, no .sh). license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_framed_append.nx nx_system_triage.nx

imports: nx_syscalls.nxnx_framed_append.nx

imported by: nobody (leaf or entry point)

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

main _p sys_write sys_mmap st_read_all sys_openat_rd sys_read sys_close sys_exit sys_openat_rd ↻ sys_getdents64 dirent_reclen dirent_name st_is_pid tr_check_pid st_cat st_read_all ↻ st_contains st_len _p ↻ sys_write ↻ sys_close ↻ tr_organ_present sys_mmap ↻ st_cat ↻ st_exists sys_openat_rd ↻ sys_close ↻ tr_source_present sys_mmap ↻ st_cat ↻ st_exists ↻ tr_run2 sys_fork sys_mmap ↻ sys_openat_wr sys_dup3 sys_execve sys_exit ↻ sys_wait4

structs

none

consts

16const ST_MAGIC_1073741824: i64 = 1073741824
17const ST_MAGIC_65536: i64 = 65536
18const ST_MAGIC_65520: i64 = 65520
19const ST_MAGIC_16384: i64 = 16384
20const ST_MAGIC_1048592: i64 = 1048592
21const ST_MAGIC_1048576: i64 = 1048576
22const ST_CAP: i64 = 1024 // bounded TRIAGE record (>= the full field set + verdict)

functions

23func _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 2: tr_check_pidmain calls 1: sys_write
24func _pn(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;k=1}; while m>0{t[k]=48+(m%10);m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(1,bb,k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
25func _fp(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 }
calls 1: sys_write
26func _fn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;k=1}; while m>0{t[k]=48+(m%10);m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(fd,bb,k); return 0 }
27func st_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
28func st_cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { dst[off+i] = s[i]; i = i + 1 } return off + i }
30func st_exists(path: *u8) -> i64
37func st_read_all(path: *u8, buf: *u8, cap: i64) -> i64
47func st_contains(hay: *u8, n: i64, pat: *u8) -> i64
called by 1: tr_check_pid calls 1: st_len
61func st_count_pat(hay: *u8, n: i64, pat: *u8) -> i64
called by 1: main calls 1: st_len
76func st_is_pid(name: *u8) -> i64
called by 1: main
89func tr_organ_present(name: *u8) -> i64
called by 1: main calls 3: sys_mmapst_catst_exists
102func tr_source_present(name: *u8) -> i64
called by 1: main calls 3: sys_mmapst_catst_exists
116func tr_free_gb(path: *u8) -> i64
called by 1: main calls 1: sys_mmap
123func tr_run2(elf: *u8, a1: *u8, a2: *u8) -> i64
146func tr_check_pid(nm: *u8, cmdl: *u8, ppath: *u8, dnames: *i64, dfound: *i64, nd: i64) -> i64
162func st_last_num_after(hay: *u8, n: i64, pat: *u8) -> i64
called by 1: main calls 1: st_len
191func main(argc: i64, argv: *i64) -> i64