nx_nxwreap.nx
buildroot/runtime/nx_nxwreap.nx
about
nx_nxwreap.nx -- CLI for the leaked-write-guard-scratch reaper. All judgement lives in
nx_nxwreap_lib; this file parses argv, prints the census and appends one audit line. It holds no
second copy of the decision, the threshold or the name contract.
usage: nx_nxwreap <dir> [max_age_s|-] [apply]
<dir> ONE directory, NOT a tree. Deliberate: buildroot/runtime holds 12,548 entries and
subtrees (knowledge/, _attic/, _hdl_build/) that a naive recursive walk would take
minutes to cross, and AN UNBOUNDED SCAN THAT NEVER RETURNS READS EXACTLY LIKE A
CRASH. Enumerate the directories that hold scratch with a glob whose envelope you
can read, then point this at each of them and sum the partitions.
max_age_s `-` or omitted -> conf, then the derived default. The chosen value AND ITS SOURCE
are printed, because a default silently standing in for a missing conf is a number
whose provenance nobody can recover.
apply THE ONLY WAY ANYTHING IS UNLINKED. Absent -> DRY RUN, which reports and writes
nothing. Any third argument that is not exactly `apply` is REFUSED BY NAME rather
than being treated as truthy, so a typo can never delete a file.
EXIT CODES ARE NOT ALL ZERO, AND THAT IS DELIBERATE. Its sibling nx_lock_reap always exits 0 so a
cron row can never go red on it; that is right for a one-path reaper and wrong here, because this
one can be handed a directory it cannot open, and \"I could not look\" must never be spelled the
same way as \"there was nothing to do\".
0 scanned | 2 usage/refusal | 3 UNSCANNABLE (the directory could not be opened)
license_tier: ORIGINAL expect_exit: 0
dependencies 2 imports · 0 importers
imports: nx_syscalls.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
| 27 | const NR_LINE: i64 = 1024 |
| 28 | const NR_LOG: *u8 = "knowledge/status/nxwreap.log" as *u8 |
| 29 | const NR_MODE: i64 = 420 |
| 30 | const NR_RC_OK: i64 = 0 |
| 31 | const NR_RC_USAGE: i64 = 2 |
| 32 | const NR_RC_NOSCAN: i64 = 3 |
functions
| 34 | func nr_streq(a: *u8, b: *u8) -> i64 called by 1: main |
| 44 | func main(argc: i64, argv: *i64) -> i64 |