code wiki / _hdl_build / nx_evict.nx

nx_evict.nx

buildroot/runtime/_hdl_build/nx_evict.nx

8449 B164 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_evict.nx -- THE SOVEREIGN JANITOR MOVER (debt seq221 second half; retires the "sanctioned janitor ssh mv" residual class). REVERSIBLE eviction: atomic sys_renameat of a nishihost-relative file into retired/ with the path FLATTENED (each '/' -> '__'), bytes preserved (additive-only law rule 13 -- nothing is ever deleted, history is sacred). restore = the exact inverse, refusing to clobber an existing destination (fail-safe). DENY BY CONSTRUCTION (not config): absolute paths, '..' traversal, secret material (secret/key/ token/passw/.pem/opaque needles), live binaries (.elf -- promote/rollback owns those), the retired/ namespace itself, and the protected registries (tool_allowlist.conf, daemons.reg, clock_jobs.tsv, proxy_routes.conf, sites.conf). Over-deny is the safe failure mode; needles are lowercase-literal (declared envelope). nx_evict evict <relpath> -> retired/<flattened> (atomic, reversible) nx_evict restore <name> <destpath> -> retired/<name> -> <destpath> (refuses if dest exists) nx_evict selftest -> probe evict/restore round-trip + refusal teeth, exit 0/5 license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_evict.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main ev_werr sys_write ev_slen sys_exit ev_deny ev_has ev_slen ↻ ev_eq sys_openat_wr sys_write ↻ sys_close sys_renameat ev_exists sys_openat_rd sys_close ↻ sys_mmap ev_flat ev_cat ev_has ↻ ev_cat ↻

structs

none

consts

17const EV_STDERR: i64 = 2
18const EV_PATHCAP: i64 = 512
19const EV_SLASH: i64 = 47
20const EV_UND: i64 = 95
21const EV_MODE: i64 = 0x1a4
22const EV_EXIT_USAGE: i64 = 2
23const EV_EXIT_REFUSED: i64 = 3
24const EV_EXIT_IO: i64 = 4
25const EV_EXIT_SELF: i64 = 5
26const EV_V_E: i64 = 101
27const EV_V_R: i64 = 114
28const EV_V_S: i64 = 115
29const EV_ARGC_EVICT: i64 = 3
30const EV_ARGC_RESTORE: i64 = 4

functions

32func ev_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 2: ev_werrev_has
33func ev_werr(s: *u8) -> i64 { sys_write(EV_STDERR, s, ev_slen(s)); return 0 }
called by 1: main calls 2: sys_writeev_slen
34func ev_cat(d: *u8, off: i64, s: *u8) -> i64
called by 2: ev_flatmain
40func ev_eq(a: *u8, b: *u8) -> i64
called by 1: ev_deny
46func ev_has(s: *u8, sub: *u8) -> i64
called by 2: ev_denymain calls 1: ev_slen
61func ev_deny(p: *u8) -> i64
called by 1: main calls 2: ev_hasev_eq
80func ev_flat(src: *u8, dst: *u8) -> i64
called by 1: main calls 1: ev_cat
92func ev_exists(p: *u8) -> i64
called by 1: main calls 2: sys_openat_rdsys_close
99func main(argc: i64, argv: *i64) -> i64