code wiki / _hdl_build / nx_heavyio_gate.nx

nx_heavyio_gate.nx

buildroot/runtime/_hdl_build/nx_heavyio_gate.nx

20367 B306 linesdepth 8pulls 16 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_gate_verdict.nx nx_gatekit_lib.nx nx_heavyio_lib.nx nx_heavyio_gate.nx

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

main gv_head gv_puts sys_write gv_ctr sys_mmap nxa_die sys_write ↻ sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ gk_mkdir sys_mkdir hg_fx_paths sys_mmap ↻ hio_cat hio_catn sys_mmap ↻ ls_pid gk_write sys_openat_wr gk_len gk_write_all sys_write ↻ sys_close gk_rm sys_unlinkat gv_check gv_puts ↻ gk_exists sys_openat_rd

structs

none

consts

19const HG_FX: *u8 = "/tmp/nx_heavyio_gate"
20const HG_FX_CONF: *u8 = "/tmp/nx_heavyio_gate/heavyio.conf"
21const HG_FX_HALF: *u8 = "/tmp/nx_heavyio_gate/half.conf"
22const HG_FX_SELF: *u8 = "/tmp/nx_heavyio_gate/self.conf"
23const HG_FX_ABSENT: *u8 = "/tmp/nx_heavyio_gate/does-not-exist.conf"
24const HG_REAL_A: *u8 = "knowledge/heavyio.conf"
25const HG_REAL_B: *u8 = "../knowledge/heavyio.conf"
26const HG_RATCHET_A: *u8 = "knowledge/status/heavyio_adopt.ratchet"
27const HG_RATCHET_B: *u8 = "../knowledge/status/heavyio_adopt.ratchet"
28const HG_IMPORT_LINE: *u8 = "import \"nx_heavyio_lib.nx\""
29const HG_PATHCAP: i64 = 512
30const HG_RBUF: i64 = 64
32const HG_FX_SLOTS: i64 = 1
33const HG_FX_FLOOR: i64 = 2
34const HG_FX_MAXC: i64 = 800
35const HG_FX_WMIN: i64 = 1
36const HG_FX_WMAX: i64 = 4
38const HG_D_RUN_LOW: i64 = 1
39const HG_D_RUN_AT: i64 = 2
40const HG_D_RUN_OVER: i64 = 3
41const HG_D_WIDTH: i64 = 2
42const HG_D_STORM_OK: i64 = 3
43const HG_D_STORM_LINE: i64 = 0
44const HG_D_UNOBS: i64 = 0 - 1
51const HG_FX_RUN_PFX: *u8 = "/tmp/nx_heavyio_gate/run-"
52const HG_FX_LEASE_LEAF: *u8 = "lease/"
53const HG_FX_SLOT0_LEAF: *u8 = "heavyio-slot-0.lock"
54const HG_FX_STAMP_LEAF: *u8 = "/stamp"
55const HG_FX_ROOTA: *u8 = "/tmp/nx_heavyio_gate/rootA"
56const HG_FX_ROOTA_K: *u8 = "/tmp/nx_heavyio_gate/rootA/knowledge"
57const HG_FX_ROOTA_C: *u8 = "/tmp/nx_heavyio_gate/rootA/knowledge/heavyio.conf"
58const HG_FX_ROOTB: *u8 = "/tmp/nx_heavyio_gate/rootB"
59const HG_FX_ROOTB_K: *u8 = "/tmp/nx_heavyio_gate/rootB/knowledge"
60const HG_FX_ROOTB_C: *u8 = "/tmp/nx_heavyio_gate/rootB/knowledge/heavyio.conf"
61const HG_FX_ROOTB_SUB: *u8 = "/tmp/nx_heavyio_gate/rootB/sub"
62const HG_FX_ROOTN: *u8 = "/tmp/nx_heavyio_gate/rootN"
63const HG_FX_ANN: *u8 = "/tmp/nx_heavyio_gate/announce.txt"
64const HG_FX_LROOT_BAD: *u8 = "/proc/nx-no-such-dir/lease/"
65const HG_P_WIDTH: i64 = 2
66const HG_P_ONE: i64 = 1
67const HG_P_TTL: i64 = 60
68const HG_P_SLOT_A: i64 = 0
69const HG_P_SLOT_B: i64 = 1
70const HG_P_NONE: i64 = 0 - 1
71const HG_P_STORM_OK: i64 = 1
72const HG_P_ANN_SLOT: i64 = 5
73const HG_GHOST_PID: i64 = 4000000000
74const HG_TAB: i64 = 9
75const HG_NL: i64 = 10
76const HG_STAMPCAP: i64 = 256
77const HG_SLOT0_NAME: *u8 = "heavyio-slot-0"
78const HG_ROOT_KIND_A: i64 = 1
79const HG_ROOT_KIND_B: i64 = 2
80const HG_ROOT_KIND_NONE: i64 = 0

functions

82func 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
83func 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
85func hg_adopted(name: *u8, pbuf: *u8) -> i64
called by 1: main calls 3: gk_catgk_existsgk_contains
103func hg_fx_paths() -> i64
called by 1: main calls 4: sys_mmaphio_cathio_catnls_pid
123func hg_plant_slot0(pid: i64) -> i64
141func main(argc: i64, argv: *i64) -> i64