nx_incclosure_lib.nx
buildroot/runtime/nx_incclosure_lib.nx
about
nx_incclosure_lib.nx -- ONE OWNER for import-closure NAME->PATH resolution (2026-08-25, rung LN10).
WHY THIS IS A LIB AND NOT A SECOND COPY.
nx_inc_compile (the per-module incremental build cache) must answer, for each module named in a
recorded closure, "is the file the compiler would read still the same bytes?" -- and it can only ask
that of a PATH. nx_closurehash already owns that resolution and the order is load-bearing:
runtime/_hdl_build/<name> FIRST (buildrun compiles that twin when both exist)
runtime/<name> SECOND
runtime/<subdir>/<name> a getdents64 sweep, looped until the kernel says stop
A SECOND RESOLVER THAT DISAGREES BY ONE PATH HASHES THE WRONG FILE, REPORTS A CACHE HIT, AND SERVES A
STALE ARTIFACT. That is a silent miscompile -- the worst class this estate tracks, and the one a cache
exists to risk. So the resolver is EXTRACTED here and BOTH organs call it: disagreement is impossible
by construction rather than by discipline, which is the estate's own standing answer whenever two
organs must agree. nx_closurehash keeps its function names and DELEGATES, so its callers are untouched
and its neutrality is provable by nx_behaveprobe (live vs staged) rather than asserted.
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 1 imports · 3 importers
imports: nx_syscalls.nx
imported by: nx_closurehash.nxnx_inc_compile.nxnx_osattest.nx
structs
| none |
consts
| 23 | const ICL_MAXF: i64 = 1024 |
| 24 | const ICL_NAMEW: i64 = 192 |
| 25 | const ICL_SHA_HEX: i64 = 64 |
| 26 | const ICL_PATHW: i64 = 1024 |
| 27 | const ICL_DIRBUF: i64 = 262144 // getdents64 window; the sweep LOOPS, so this is a window not a cap |
| 28 | const ICL_SWEEPW: i64 = 512 // "<root>/runtime" scratch |
| 29 | const ICL_DOT: i64 = 46 |
| 30 | const ICL_DT_DIR: i64 = 4 |
| 31 | const ICL_DENT_RECLEN_OFF: i64 = 16 |
| 32 | const ICL_DENT_NAME_OFF: i64 = 19 |
| 33 | const ICL_DENT_TYPE_OFF: i64 = 18 |
functions
| 35 | func icl_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 36 | func icl_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 } |
| 37 | func icl_seq(a: *u8, b: *u8) -> i64 |
| 49 | func icl_exists(p: *u8) -> i64 { let fd: i64 = sys_openat_rd(p); if fd < 0 { return 0 } sys_close(fd); return 1 } |
| 52 | func icl_hex(dig: *u8, out: *u8) -> i64 |
| 77 | func icl_resolve(root: *u8, name: *u8, out: *u8) -> i64 called by 3: chresolveic_observemain calls 6: icl_caticl_existssys_mmapsys_openat_rdsys_getdents64sys_close |