code wiki / (root) / nx_nxwreap.nx

nx_nxwreap.nx

buildroot/runtime/nx_nxwreap.nx

6246 B135 linesdepth 6pulls 6 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_nxwreap_lib.nx nx_nxwreap.nx

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

main nw_puts sys_write 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 ↻ nw_maxage sys_mmap ↻ ccz_read sys_openat_rd sys_read sys_close sys_munmap ccz_num_at nw_maxage_src_name nr_streq ccz_num_at ↻ ccz_slen sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real nw_num nw_ship_bound_s nw_ctr sys_mmap ↻ nw_scan sys_openat_rd ↻ sys_mmap ↻

structs

none

consts

27const NR_LINE: i64 = 1024
28const NR_LOG: *u8 = "knowledge/status/nxwreap.log" as *u8
29const NR_MODE: i64 = 420
30const NR_RC_OK: i64 = 0
31const NR_RC_USAGE: i64 = 2
32const NR_RC_NOSCAN: i64 = 3

functions

34func nr_streq(a: *u8, b: *u8) -> i64
called by 1: main
44func main(argc: i64, argv: *i64) -> i64