code wiki / _hdl_build / nx_mgmt_snapshot_run.nx
nx_mgmt_snapshot_run.nx
buildroot/runtime/_hdl_build/nx_mgmt_snapshot_run.nx
about
nx_mgmt_snapshot_run.nx -- the COMPLETE, self-contained health-snapshot PRODUCER binary (R1b, live path).
Scans /proc ITSELF (sys_getdents64) -> reads each pid's stat+cmdline -> classifies procs against a data-driven
service table -> counts crash-loop restarts from the supervisor.log -> composes the two ALREADY-GATED tiers
(nx_snapfeed sf_* parse + nx_mgmt_snapshot ss_synth) -> writes the canonical SUP/SVC snapshot the mgmt API
reads (mgmt_snap.json). This needs NO nx_hostctl edit: it is one binary you run (or later supervise/pulse).
Because it reads REAL /proc, it is validated end-to-end on real kernel data (WSL /proc locally; NAS /proc live).
Correctness lessons carried through: services are matched by their FULL /proc/<pid>/cmdline (never the 15-char
comm -- the gallery-disaster anti-truncation lesson); supervisor lineage = session-leaders (pid==sid) via
ss_synth, so the reader-keeper child is not a false 2nd supervisor.
argv: [1]=services.conf [2]=supervisor.log [3]=out snapfile
services.conf rows: <canon> <port> <cmdline-match> ('#' = comment) e.g. sites 8443 nx_sites_daemon
license_tier: ORIGINAL
dependencies 3 imports · 1 importers
imports: nx_mgmt_snapshot.nxnx_snapfeed.nxnx_syscalls.nx
imported by: nx_mgmt_snapshot_run_gate.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 18 | const MSR_MAGIC_262144: i64 = 262144 |
| 19 | const MSR_MAGIC_1024: i64 = 1024 |
| 20 | const MSR_MAGIC_4096: i64 = 4096 |
| 21 | const MSR_MAGIC_65536: i64 = 65536 |
| 22 | const MSR_MAGIC_4095: i64 = 4095 |
| 24 | const MSR_MAXSVC: i64 = 64 |
| 25 | const MSR_MAXP: i64 = 4096 |
functions
| 27 | func msr_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 28 | func msr_wn(v0: i64) -> i64 |
| 44 | func msr_is_pid(name: *u8) -> i64 called by 1: main |
| 57 | func msr_copyz(dst: *u8, src: *u8, off: i64, len: i64) -> i64 called by 1: main |
| 65 | func msr_read_small(path: *u8, buf: *u8, cap: i64) -> i64 |
| 79 | func msr_build_path(dst: *u8, name: *u8, suffix: *u8) -> i64 |
| 89 | func msr_is_sup(cmd: *u8, n: i64) -> i64 |
| 100 | func msr_is_instance(idx: i64, mp_pid: *i64, mp_ppid: *i64, mp_canon: *i64, nmp: i64) -> i64 |
| 111 | func main(argc: i64, argv: *i64) -> i64 |