code wiki / (root) / nx_nxwreap_gate.nx

nx_nxwreap_gate.nx

buildroot/runtime/nx_nxwreap_gate.nx

21821 B407 linesdepth 6pulls 7 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_nxwreap_gate.nx -- BITE-PROOF for the leaked-write-guard-scratch reaper. THE LOAD-BEARING PROPERTY IS FAIL-SAFE, AND ONE TOOTH CARRIES IT: a scratch file whose pid is still LIVE is NEVER reaped, however old. Everything else this gate asserts could be satisfied by a reaper that unlinks every file it sees -- A GUARD THAT REFUSES NOTHING PASSES EVERY POSITIVE TEST EVER WRITTEN FOR IT, which is the exact mirror of the deny-guard defect this estate has already paid for. So the live- owner fixture is the POSITIVE CONTROL: a file that MUST survive, and whose survival no count-based check can fake. THE SECOND ANTI-VACUITY TOOTH IS THE DRY RUN. Every counter this organ prints would be identical whether apply=0 wrote nothing or deleted everything, so the dry-run teeth assert THE STATE OF THE DISK, not the report. A LEAKING CALL ANSWERS IDENTICAL BYTES. FIXTURES LIVE IN /tmp/nx_nxwreap_gate AND NOWHERE ELSE. A gate that shares a fixture with a production tree measures the tree instead of the code -- and this one UNLINKS FILES, so pointing it at knowledge/ or buildroot/ would destroy real work. The directory is created at SETUP, because a teardown does not run when a run crashes, and it is PURGED at setup so the gate is idempotent: the live fixture's name contains the running pid and therefore differs on every run, so a gate that only recreated its own names would accumulate a stranger every time and lie about the count from the second run onward. THE THRESHOLD USED FOR THE FIXTURE SCANS IS PINNED HERE (NG_MAXAGE), NOT READ FROM THE CONF. A gate whose subject's behaviour moves when someone edits production config is measuring the config. The conf/default/derivation arithmetic is proved SEPARATELY, as pure teeth. license_tier: ORIGINAL expect_exit: 0

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_nxwreap_lib.nx nx_nxwreap_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_nxwreap_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_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 ↻ gv_head gv_puts sys_write ↻ sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real lr_selfpid sys_mmap ↻ ccz_read sys_openat_rd sys_read sys_close ccz_num_at sys_mmap ↻ sys_mkdir gt_purge sys_openat_rd ↻ sys_mmap ↻ sys_getdents64 dirent_reclen dirent_type gt_pth ccz_cat_str

structs

none

consts

32const NG_DIR: *u8 = "/tmp/nx_nxwreap_gate" as *u8
33const NG_ABSENTDIR: *u8 = "/tmp/nx_nxwreap_gate_no_such_directory" as *u8
34const NG_SEP: *u8 = "/" as *u8
35const NG_BODY: *u8 = "scratch fixture body\n" as *u8
40const NG_DEAD_PID: i64 = 4194303
41const NG_MAXAGE: i64 = 120
42const NG_OLD_AGE: i64 = 600
43const NG_YOUNG_AGE: i64 = 5
44const NG_ANCIENT: i64 = 999999
45const NG_PATH: i64 = 1024
46const NG_TS_BYTES: i64 = 32
47const NG_TS_ATV: i64 = 0
48const NG_TS_ATN: i64 = 1
49const NG_TS_MTV: i64 = 2
50const NG_TS_MTN: i64 = 3
51const NG_PIDBUF: i64 = 64
55const NG_DOTS: i64 = 2
56const NG_EXPECT_ENTRIES: i64 = 10
57const NG_EXPECT_REAP: i64 = 2
58const NG_EXPECT_AFTER: i64 = 8
59const NG_LONGDIGITS: *u8 = "x.nx.nxw12345678901" as *u8

functions

61func gt_eq(a: i64, b: i64) -> i64 { if a == b { return 1 } return 0 }
called by 1: main
62func gt_gt(a: i64, b: i64) -> i64 { if a > b { return 1 } return 0 }
called by 1: main
63func gt_ge(a: i64, b: i64) -> i64 { if a >= b { return 1 } return 0 }
called by 1: main
64func gt_and(a: i64, b: i64) -> i64 { if a == 1 { if b == 1 { return 1 } } return 0 }
called by 1: main
66func gt_pid(s: *u8) -> i64 { return nw_pid_of(s, ccz_slen(s)) }
called by 1: main calls 2: nw_pid_ofccz_slen
71func gt_nm(buf: *u8, stem: *u8, pid: i64) -> i64
called by 1: main calls 1: ccz_cat_str
79func gt_pth(buf: *u8, name: *u8) -> i64
called by 2: gt_purgemain calls 1: ccz_cat_str
88func gt_write(path: *u8) -> i64
96func gt_touch(path: *u8, e: i64) -> i64
107func gt_make(path: *u8, e: i64) -> i64
called by 1: main calls 2: gt_writegt_touch
115func gt_purge(dir: *u8) -> i64
145func main(argc: i64, argv: *i64) -> i64