code wiki / _hdl_build / nx_dsup_lib.nx
nx_dsup_lib.nx
buildroot/runtime/_hdl_build/nx_dsup_lib.nx
about
nx_dsup_lib.nx -- the fleet supervisor's PURE helpers, extracted 2026-09-02 so a gate can drive them IN-PROCESS
(nx_daemon_supervisor_gate). Nothing here touches a file, a socket or a clock: decimal emission, bounded append,
the conf-key parser, the /proc/<pid>/stat parser the status child uses for its PARENT PROBE, and the progress
trailer the supervisor publishes after every row.
WHY THIS FILE EXISTS: the conf-key parser that lived inside nx_daemon_supervisor exited its inner loop by writing
99 into the cursor (`k = 99`), which then read key[99] -- 87 bytes PAST the 12-byte "life_cycles=" literal -- and
looped forever wherever that rodata byte was non-zero. Every supervisor generation on the NAS spun at 100% CPU
before its first probe (parent state=R wchan=0, measured by the status child's own /proc read) while the same
binary ticked every 15 s on a laptop that had NO conf. nx_srclint's CURSOR-SENTINEL idiom, inside the organ that
supervises the fleet, invisible for as long as the predicate had no gate. Now it has one.
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 0 imports · 2 importers
imports: none
imported by: nx_daemon_supervisor.nxnx_daemon_supervisor_gate.nx
structs
| none |
consts
| 103 | const DSL_TRAILER_MAX: i64 = 256 |
functions
| 16 | func ds_decw(v: i64, out: *u8) -> i64 |
| 29 | func ds_sappend(dst: *u8, w: i64, s: *u8) -> i64 |
| 36 | func ds_clamp0(v: i64) -> i64 { if v < 0 { return 0 } return v } |
| 39 | func ds_atoi_at(buf: *u8, n: i64, q0: i64) -> i64 |
| 48 | func ds_key_at(b: *u8, n: i64, i: i64, key: *u8) -> i64 |
| 58 | func ds_klen(key: *u8) -> i64 { var k: i64 = 0; while key[k] != (0 as u8) { k = k + 1 } return k } called by 1: ds_conf_int |
| 62 | func ds_conf_int(b: *u8, n: i64, key: *u8) -> i64 |
| 77 | func ds_stat_state_at(buf: *u8, n: i64) -> i64 |
| 88 | func ds_stat_ppid(buf: *u8, n: i64) -> i64 |
| 104 | func ds_trailer(tb: *u8, tick: i64, row: i64, nm: *u8, a: i64, b: i64, c: i64, partial: i64, cms: i64) -> i64 |