code wiki / _hdl_build / nx_system_triage.nx
nx_system_triage.nx
buildroot/runtime/_hdl_build/nx_system_triage.nx
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
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
structs
| none |
consts
| 16 | const ST_MAGIC_1073741824: i64 = 1073741824 |
| 17 | const ST_MAGIC_65536: i64 = 65536 |
| 18 | const ST_MAGIC_65520: i64 = 65520 |
| 19 | const ST_MAGIC_16384: i64 = 16384 |
| 20 | const ST_MAGIC_1048592: i64 = 1048592 |
| 21 | const ST_MAGIC_1048576: i64 = 1048576 |
| 22 | const ST_CAP: i64 = 1024 // bounded TRIAGE record (>= the full field set + verdict) |
functions
| 23 | func _p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 24 | func _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 } |
| 25 | func _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 |
| 26 | func _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 } |
| 27 | func st_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 28 | func 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 } |
| 30 | func st_exists(path: *u8) -> i64 |
| 37 | func st_read_all(path: *u8, buf: *u8, cap: i64) -> i64 |
| 47 | func st_contains(hay: *u8, n: i64, pat: *u8) -> i64 |
| 61 | func st_count_pat(hay: *u8, n: i64, pat: *u8) -> i64 |
| 76 | func st_is_pid(name: *u8) -> i64 called by 1: main |
| 89 | func tr_organ_present(name: *u8) -> i64 |
| 102 | func tr_source_present(name: *u8) -> i64 |
| 116 | func tr_free_gb(path: *u8) -> i64 |
| 123 | func tr_run2(elf: *u8, a1: *u8, a2: *u8) -> i64 |
| 146 | func tr_check_pid(nm: *u8, cmdl: *u8, ppath: *u8, dnames: *i64, dfound: *i64, nd: i64) -> i64 |
| 162 | func st_last_num_after(hay: *u8, n: i64, pat: *u8) -> i64 |
| 191 | func main(argc: i64, argv: *i64) -> i64 |