code wiki / _hdl_build / nx_mgmt_snapshot_run.nx

nx_mgmt_snapshot_run.nx

buildroot/runtime/_hdl_build/nx_mgmt_snapshot_run.nx

11642 B274 linesdepth 3pulls 4 transitivereach 1 importersview sourcekind tooltopic mgmt
docsdependenciesstructsconstsfunctions

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

nx_mgmt_snapshot.nx nx_snapfeed.nx nx_syscalls.nx nx_mgmt_snapshot_run.nx nx_mgmt_snapshot_run_gate.nx

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

main msr_w sys_write sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close ss_eol ss_split msr_copyz ss_atoi ss_cat ss_catn sys_mmap ↻ sys_openat_rd ↻ sys_getdents64 dirent_reclen dirent_name msr_is_pid msr_build_path ss_cat ↻ msr_read_small sys_openat_rd ↻ sys_read ↻ sys_close ↻ sf_parse_stat sf_digit sf_atoi sf_digit ↻ msr_is_sup sf_contains sf_contains_seg sf_contains ↻ sys_close ↻ msr_is_instance sf_count_restarts sf_contains_seg ↻

structs

none

consts

18const MSR_MAGIC_262144: i64 = 262144
19const MSR_MAGIC_1024: i64 = 1024
20const MSR_MAGIC_4096: i64 = 4096
21const MSR_MAGIC_65536: i64 = 65536
22const MSR_MAGIC_4095: i64 = 4095
24const MSR_MAXSVC: i64 = 64
25const MSR_MAXP: i64 = 4096

functions

27func 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 }
called by 2: msr_wnmain calls 1: sys_write
28func msr_wn(v0: i64) -> i64
called by 1: main calls 2: msr_wsys_mmap
44func msr_is_pid(name: *u8) -> i64
called by 1: main
57func msr_copyz(dst: *u8, src: *u8, off: i64, len: i64) -> i64
called by 1: main
65func msr_read_small(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
79func msr_build_path(dst: *u8, name: *u8, suffix: *u8) -> i64
called by 1: main calls 1: ss_cat
89func msr_is_sup(cmd: *u8, n: i64) -> i64
called by 1: main calls 1: sf_contains
100func msr_is_instance(idx: i64, mp_pid: *i64, mp_ppid: *i64, mp_canon: *i64, nmp: i64) -> i64
called by 2: mainmain
111func main(argc: i64, argv: *i64) -> i64