nx_nxwreap_gate.nx
buildroot/runtime/nx_nxwreap_gate.nx
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
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
structs
| none |
consts
| 32 | const NG_DIR: *u8 = "/tmp/nx_nxwreap_gate" as *u8 |
| 33 | const NG_ABSENTDIR: *u8 = "/tmp/nx_nxwreap_gate_no_such_directory" as *u8 |
| 34 | const NG_SEP: *u8 = "/" as *u8 |
| 35 | const NG_BODY: *u8 = "scratch fixture body\n" as *u8 |
| 40 | const NG_DEAD_PID: i64 = 4194303 |
| 41 | const NG_MAXAGE: i64 = 120 |
| 42 | const NG_OLD_AGE: i64 = 600 |
| 43 | const NG_YOUNG_AGE: i64 = 5 |
| 44 | const NG_ANCIENT: i64 = 999999 |
| 45 | const NG_PATH: i64 = 1024 |
| 46 | const NG_TS_BYTES: i64 = 32 |
| 47 | const NG_TS_ATV: i64 = 0 |
| 48 | const NG_TS_ATN: i64 = 1 |
| 49 | const NG_TS_MTV: i64 = 2 |
| 50 | const NG_TS_MTN: i64 = 3 |
| 51 | const NG_PIDBUF: i64 = 64 |
| 55 | const NG_DOTS: i64 = 2 |
| 56 | const NG_EXPECT_ENTRIES: i64 = 10 |
| 57 | const NG_EXPECT_REAP: i64 = 2 |
| 58 | const NG_EXPECT_AFTER: i64 = 8 |
| 59 | const NG_LONGDIGITS: *u8 = "x.nx.nxw12345678901" as *u8 |
functions
| 61 | func gt_eq(a: i64, b: i64) -> i64 { if a == b { return 1 } return 0 } called by 1: main |
| 62 | func gt_gt(a: i64, b: i64) -> i64 { if a > b { return 1 } return 0 } called by 1: main |
| 63 | func gt_ge(a: i64, b: i64) -> i64 { if a >= b { return 1 } return 0 } called by 1: main |
| 64 | func gt_and(a: i64, b: i64) -> i64 { if a == 1 { if b == 1 { return 1 } } return 0 } called by 1: main |
| 66 | func gt_pid(s: *u8) -> i64 { return nw_pid_of(s, ccz_slen(s)) } |
| 71 | func gt_nm(buf: *u8, stem: *u8, pid: i64) -> i64 |
| 79 | func gt_pth(buf: *u8, name: *u8) -> i64 |
| 88 | func gt_write(path: *u8) -> i64 |
| 96 | func gt_touch(path: *u8, e: i64) -> i64 |
| 107 | func gt_make(path: *u8, e: i64) -> i64 |
| 115 | func gt_purge(dir: *u8) -> i64 |
| 145 | func main(argc: i64, argv: *i64) -> i64 |