code wiki / _hdl_build / nx_heavyio_gate.nx
nx_heavyio_gate.nx
buildroot/runtime/_hdl_build/nx_heavyio_gate.nx
about
nx_heavyio_gate.nx -- proves nx_heavyio_lib, THE HEAVY-I/O CONCURRENCY BOUND, and RATCHETS ITS ADOPTION.
THE DEFECT (measured 2026-09-02): the storm ruler is instantaneous and per-caller, so independent launch
surfaces each pass it and collectively storm the box; the fix is a bound over what is RUNNING across all
surfaces, composed from nx_poolgov (width) + nx_ioadmit_lib (storm witness). This gate proves the conf
reader, the PURE decision (every conjunct and every unobservable input), the live-box wrappers (width in
range, the counter that counts nothing when nothing matches and fires on a process that IS running --
this gate itself), the ratchet arithmetic (a floor that only rises), and -- the maintenance mechanism --
an ADOPTION RATCHET over the real conf: how many declared producers import the lib, floor persisted in
knowledge/status/heavyio_adopt.ratchet, every unadopted producer NAMED (a count without a worklist is
not actionable). Fixtures live in /tmp/nx_heavyio_gate/ (fixture-ratchet law), created at setup.
nx_heavyio_gate (no args)
license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_gate_verdict.nxnx_gatekit_lib.nxnx_heavyio_lib.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
| 19 | const HG_FX: *u8 = "/tmp/nx_heavyio_gate" |
| 20 | const HG_FX_CONF: *u8 = "/tmp/nx_heavyio_gate/heavyio.conf" |
| 21 | const HG_FX_HALF: *u8 = "/tmp/nx_heavyio_gate/half.conf" |
| 22 | const HG_FX_SELF: *u8 = "/tmp/nx_heavyio_gate/self.conf" |
| 23 | const HG_FX_ABSENT: *u8 = "/tmp/nx_heavyio_gate/does-not-exist.conf" |
| 24 | const HG_REAL_A: *u8 = "knowledge/heavyio.conf" |
| 25 | const HG_REAL_B: *u8 = "../knowledge/heavyio.conf" |
| 26 | const HG_RATCHET_A: *u8 = "knowledge/status/heavyio_adopt.ratchet" |
| 27 | const HG_RATCHET_B: *u8 = "../knowledge/status/heavyio_adopt.ratchet" |
| 28 | const HG_IMPORT_LINE: *u8 = "import \"nx_heavyio_lib.nx\"" |
| 29 | const HG_PATHCAP: i64 = 512 |
| 30 | const HG_RBUF: i64 = 64 |
| 32 | const HG_FX_SLOTS: i64 = 1 |
| 33 | const HG_FX_FLOOR: i64 = 2 |
| 34 | const HG_FX_MAXC: i64 = 800 |
| 35 | const HG_FX_WMIN: i64 = 1 |
| 36 | const HG_FX_WMAX: i64 = 4 |
| 38 | const HG_D_RUN_LOW: i64 = 1 |
| 39 | const HG_D_RUN_AT: i64 = 2 |
| 40 | const HG_D_RUN_OVER: i64 = 3 |
| 41 | const HG_D_WIDTH: i64 = 2 |
| 42 | const HG_D_STORM_OK: i64 = 3 |
| 43 | const HG_D_STORM_LINE: i64 = 0 |
| 44 | const HG_D_UNOBS: i64 = 0 - 1 |
| 51 | const HG_FX_RUN_PFX: *u8 = "/tmp/nx_heavyio_gate/run-" |
| 52 | const HG_FX_LEASE_LEAF: *u8 = "lease/" |
| 53 | const HG_FX_SLOT0_LEAF: *u8 = "heavyio-slot-0.lock" |
| 54 | const HG_FX_STAMP_LEAF: *u8 = "/stamp" |
| 55 | const HG_FX_ROOTA: *u8 = "/tmp/nx_heavyio_gate/rootA" |
| 56 | const HG_FX_ROOTA_K: *u8 = "/tmp/nx_heavyio_gate/rootA/knowledge" |
| 57 | const HG_FX_ROOTA_C: *u8 = "/tmp/nx_heavyio_gate/rootA/knowledge/heavyio.conf" |
| 58 | const HG_FX_ROOTB: *u8 = "/tmp/nx_heavyio_gate/rootB" |
| 59 | const HG_FX_ROOTB_K: *u8 = "/tmp/nx_heavyio_gate/rootB/knowledge" |
| 60 | const HG_FX_ROOTB_C: *u8 = "/tmp/nx_heavyio_gate/rootB/knowledge/heavyio.conf" |
| 61 | const HG_FX_ROOTB_SUB: *u8 = "/tmp/nx_heavyio_gate/rootB/sub" |
| 62 | const HG_FX_ROOTN: *u8 = "/tmp/nx_heavyio_gate/rootN" |
| 63 | const HG_FX_ANN: *u8 = "/tmp/nx_heavyio_gate/announce.txt" |
| 64 | const HG_FX_LROOT_BAD: *u8 = "/proc/nx-no-such-dir/lease/" |
| 65 | const HG_P_WIDTH: i64 = 2 |
| 66 | const HG_P_ONE: i64 = 1 |
| 67 | const HG_P_TTL: i64 = 60 |
| 68 | const HG_P_SLOT_A: i64 = 0 |
| 69 | const HG_P_SLOT_B: i64 = 1 |
| 70 | const HG_P_NONE: i64 = 0 - 1 |
| 71 | const HG_P_STORM_OK: i64 = 1 |
| 72 | const HG_P_ANN_SLOT: i64 = 5 |
| 73 | const HG_GHOST_PID: i64 = 4000000000 |
| 74 | const HG_TAB: i64 = 9 |
| 75 | const HG_NL: i64 = 10 |
| 76 | const HG_STAMPCAP: i64 = 256 |
| 77 | const HG_SLOT0_NAME: *u8 = "heavyio-slot-0" |
| 78 | const HG_ROOT_KIND_A: i64 = 1 |
| 79 | const HG_ROOT_KIND_B: i64 = 2 |
| 80 | const HG_ROOT_KIND_NONE: i64 = 0 |
functions
| 82 | func hg_atoi(b: *u8, n: i64) -> i64 { var v: i64 = 0; var i: i64 = 0; var seen: i64 = 0; while i < n { let c: i64 = b[i] as i64; if c >= 48 { if c <= 57 { v = v * 10 + (c - 48); seen = 1; i = i + 1 } else { i = n } } else { i = n } } if seen == 0 { return 0 - 1 } return v } called by 1: main |
| 83 | func hg_streq(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while a[i] != (0 as u8) { if a[i] != b[i] { return 0 } i = i + 1 } if b[i] != (0 as u8) { return 0 } return 1 } called by 1: main |
| 85 | func hg_adopted(name: *u8, pbuf: *u8) -> i64 |
| 103 | func hg_fx_paths() -> i64 |
| 123 | func hg_plant_slot0(pid: i64) -> i64 |
| 141 | func main(argc: i64, argv: *i64) -> i64 |