code wiki / _hdl_build / nx_janitor.nx

nx_janitor.nx

buildroot/runtime/_hdl_build/nx_janitor.nx

4827 B85 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic janitor
docsdependenciesstructsconstsfunctions

about

nx_janitor.nx -- the CARETAKER/JANITOR's FRESHNESS evaluator (operator 2026-06-12: freshness + sprawl evaluator, janitorial quality to S-class). Is the system ALIVE and are its derived surfaces FRESH? Reads the latest beat + key derived-surface epochs, compares to now -- STALE = the daemon stopped or a surface stopped regenerating (the silent-death signal a janitor catches). Freshness half here; sprawl half (dup/dead-organ/scratch-accumulation) = X-JAN-002 (getdents walk). Durable: JANITOR row -> knowledge/status/janitor.log. Exit 0 = fresh. argv override: none (live surfaces). license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_janitor.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 _p sys_write sys_now_realtime_sec sys_mmap sys_clock_gettime_real sys_openat_append sys_exit sys_mmap ↻ jn_surface sys_mmap ↻ jn_read sys_openat_rd sys_read sys_close jn_last_epoch _fp sys_write ↻ _fn sys_mmap ↻ sys_write ↻ _fp ↻ _fn ↻ sys_close ↻

structs

none

consts

10const K_MAGIC_1048576: i64 = 1048576
11const K_MAGIC_1048560: i64 = 1048560
12const K_MAGIC_4000: i64 = 4000
13const K_MAGIC_8000: i64 = 8000

functions

14func _p(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
15func _fp(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 }
called by 2: jn_surfacemain calls 1: sys_write
16func _fn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m; sys_write(fd,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(fd,bb,k); return 0 }
called by 2: jn_surfacemain calls 2: sys_mmapsys_write
17func jn_read(path: *u8, buf: *u8, cap: i64) -> i64
27func jn_last_epoch(buf: *u8, n: i64, key: *u8) -> i64
called by 1: jn_surface
48func jn_surface(lfd: i64, name: *u8, path: *u8, key: *u8, now: i64, limit: i64, stale: *i64) -> i64
63func main() -> i64