code wiki / (root) / nx_incclosure_lib.nx

nx_incclosure_lib.nx

buildroot/runtime/nx_incclosure_lib.nx

6412 B129 linesdepth 2pulls 2 transitivereach 3 importersview sourcekind library
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_incclosure_lib.nx nx_closurehash.nx nx_inc_compile.nx nx_osattest.nx

imports: nx_syscalls.nx

imported by: nx_closurehash.nxnx_inc_compile.nxnx_osattest.nx

structs

none

consts

23const ICL_MAXF: i64 = 1024
24const ICL_NAMEW: i64 = 192
25const ICL_SHA_HEX: i64 = 64
26const ICL_PATHW: i64 = 1024
27const ICL_DIRBUF: i64 = 262144 // getdents64 window; the sweep LOOPS, so this is a window not a cap
28const ICL_SWEEPW: i64 = 512 // "<root>/runtime" scratch
29const ICL_DOT: i64 = 46
30const ICL_DT_DIR: i64 = 4
31const ICL_DENT_RECLEN_OFF: i64 = 16
32const ICL_DENT_NAME_OFF: i64 = 19
33const ICL_DENT_TYPE_OFF: i64 = 18

functions

35func icl_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
36func 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 }
37func icl_seq(a: *u8, b: *u8) -> i64
49func icl_exists(p: *u8) -> i64 { let fd: i64 = sys_openat_rd(p); if fd < 0 { return 0 } sys_close(fd); return 1 }
52func icl_hex(dig: *u8, out: *u8) -> i64
77func icl_resolve(root: *u8, name: *u8, out: *u8) -> i64