code wiki / (root) / nx_stalesweep.nx

nx_stalesweep.nx

buildroot/runtime/nx_stalesweep.nx

11233 B218 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_stalesweep.nx -- SOVEREIGN replacement for nx_stale_sweep.cron.sh (2026-08-07). WHAT IT MEASURES: an organ whose LIVE elf is older than its buildroot SOURCE is a stale mirror -- the class that was previously found by injury (Jul-19 clock elf; argecho 81h) rather than measured. THE PROPERTY THAT MUST SURVIVE THE PORT, and it is the reason this file exists rather than a swap: the script files ONE ROLLUP debt with CONSTANT text, never one row per stale organ. Its own comment names the debt that taught it: 1785525470, `a beat that files one row per instance converts a metric into a backlog`. (STAR)A RECURRING BEAT THAT FILES ONE ROW PER INSTANCE CONVERTS A METRIC INTO A BACKLOG -- FILE ONE ROLLUP ROW WITH CONSTANT TEXT AND KEEP THE INSTANCE LIST IN A REGENERATED FILE. The ledger row is the POINTER; knowledge/status/stale_mirror.worklist is the TRUTH. TWO MORE PROPERTIES A CARELESS PORT WOULD DESTROY: - SOURCE RESOLUTION ORDER. Prefer buildroot/runtime/_hdl_build/<b>.nx, and only then buildroot/runtime/<b>.nx. buildrun compiles the _hdl_build twin when BOTH exist, so checking the runtime twin would verify the WRONG elf and report a stale mirror that is not stale. - THE DOCTRINE SENTENCE. source-newer is AMBIGUOUS (pending upgrade vs uncommitted WIP), so the debt says TRIAGE and explicitly forbids blanket-rebuild. Drop that line and this beat stops being a triage signal and becomes a rebuild trigger that ships half-work. nx_stalesweep [stale-hours] (no args on the clock; conf then 72) license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_stalesweep.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 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 ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close ss_atoi ss_opendir ss_o sys_write ↻ sys_exit ↻ sys_getdents64 ss_ends_elf ss_len ss_slot sys_close ↻ ss_len ↻ ss_cat ss_mtime sys_mmap ↻ sys_fstatat ss_num sys_mmap ↻

structs

none

consts

25const SS_MAGIC_3600: i64 = 3600
26const SS_MAGIC_1024: i64 = 1024
28const SS_CONF: *u8 = "knowledge/status/stalesweep.conf"
29const SS_WORKTMP: *u8 = "knowledge/status/.stale_mirror.worklist.tmp"
30const SS_WORKLIST: *u8 = "knowledge/status/stale_mirror.worklist"
31const SS_HDL: *u8 = "buildroot/runtime/_hdl_build/"
32const SS_RT: *u8 = "buildroot/runtime/"
33const SS_DEBT: *u8 = "/volume1/homes/elderwesto/nishihost/nx_debt.elf"
34const SS_DIRBUF: i64 = 262144
35const SS_NAMEW: i64 = 256
36const SS_MAXELF: i64 = 4096
37const SS_MODE: i64 = 0x1a4
38const SS_DEF_TH: i64 = 72
39const SS_STATBUF: i64 = 256
40const SS_MTIME_OFF: i64 = 88
41const SS_OUTCAP: i64 = 1048576

functions

43func ss_o(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main calls 1: sys_write
44func ss_cat(d: *u8, o: i64, s: *u8) -> i64 { var x: i64=o; var i: i64=0; while s[i]!=(0 as u8){d[x]=s[i];x=x+1;i=i+1} return x }
called by 1: main
45func ss_num(d: *u8, o: i64, v: i64) -> i64 { var x: i64=o; var mm: i64=v; if mm<0{d[x]=45 as u8;x=x+1;mm=0-mm} if mm==0{d[x]=48 as u8;return x+1} let t:*u8=sys_mmap(24); var k:i64=0; while mm>0{t[k]=(48+(mm%10)) as u8;mm=mm/10;k=k+1} var j:i64=0; while j<k{d[x]=t[k-1-j];x=x+1;j=j+1} return x }
called by 1: main calls 1: sys_mmap
46func ss_len(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 2: ss_ends_elfmain
47func ss_slot(b: *u8, i: i64) -> *u8 { return ((b as i64) + i*SS_NAMEW) as *u8 }
called by 1: main
48func ss_atoi(s: *u8) -> i64 { var v: i64=0; var i: i64=0; while s[i]!=(0 as u8){ if s[i]<(48 as u8){return v} if s[i]>(57 as u8){return v} v=v*10+((s[i]-(48 as u8)) as i64); i=i+1 } return v }
called by 1: main
49func ss_opendir(p: *u8) -> i64 { return __syscall(257, 0-100, p as i64, 0x10000, 0, 0, 0) }
called by 1: main
55func ss_mtime(path: *u8) -> i64
called by 1: main calls 2: sys_mmapsys_fstatat
62func ss_ends_elf(nm: *u8) -> i64
called by 1: main calls 1: ss_len
72func main(argc: i64, argv: *i64) -> i64