code wiki / _hdl_build / nx_offc_install.nx

nx_offc_install.nx

buildroot/runtime/_hdl_build/nx_offc_install.nx

8802 B150 linesdepth 2pulls 2 transitivereach 3 importersview sourcekind tooltopic offc
docsdependenciesstructsconstsfunctions

about

nx_offc_install.nx -- ENGINEER GUARDRAIL against LM-026 (the stale-_offc landmine that cost a full session on the MMU instruction-fetch rung): `nx_sov_build_run <name>` builds the FRESH binary to /tmp/<name>.sov.elf and runs THAT as its smoke, but does NOT reliably install it to _offc/<name>.elf. Gates/organs fork _offc/*.elf, so they silently test a STALE binary -- source edits never take effect and diagnostics never fire. This organ is the structural prevention: it DETECTS the staleness (byte mismatch between the installed _offc artifact and the fresh /tmp build) and ATOMICALLY installs the fresh build (write temp + renameat = rule 16 immutable/atomic deploy), then VERIFIES byte-equal. It is the AUTO remedy seeded as known-issue LM-026 (nx_known_issue_seed): when any Engineer/Doctor diagnostic contains the signature "STALE-OFFC-ARTIFACT", ki_recall routes here (nx_offc_install:oi_install) so the team auto-heals instead of chasing phantom logic bugs. oi_stale(name) -> 1 if _offc/<name>.elf differs from /tmp/<name>.sov.elf (or _offc absent while a fresh /tmp build exists); 0 if byte-identical (fresh) or no /tmp build to judge. oi_install(name) -> atomically copy /tmp/<name>.sov.elf -> _offc/<name>.elf + verify; 1 on success. main <name> -> detect; install-if-stale; emit the STALE-OFFC-ARTIFACT recall signature + verdict. Sovereign, no gcc/.sh. license_tier: ORIGINAL

dependencies 1 imports · 3 importers

nx_syscalls.nx nx_offc_install.nx _freshness_gate.nx _offc_install_gate.nx _sbr_install_gate.nx

imports: nx_syscalls.nx

imported by: _freshness_gate.nx_offc_install_gate.nx_sbr_install_gate.nx

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

main oi_p sys_write oi_len oi_stale sys_mmap oi_offc_path oi_cat oi_tmp_path oi_cat ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close oi_differ oi_install sys_mmap ↻ oi_tmp_path ↻ oi_offc_path ↻ oi_tmpinstall_path oi_cat ↻ sys_read_file ↻ sys_openat_wr sys_write ↻ sys_close ↻ sys_renameat oi_differ ↻ sys_openat_append oi_wn sys_mmap ↻ sys_write ↻ oi_fp sys_write ↻ oi_len ↻ sys_close ↻

structs

none

consts

19const OI_MAGIC_1024: i64 = 1024
20const OI_MAGIC_1000000000: i64 = 1000000000
22const OI_SIG: *u8 = "STALE-OFFC-ARTIFACT"
23const OI_LOG: *u8 = "knowledge/status/offc_install.log"
24const OI_ATFDCWD: i64 = 0 - 100

functions

26func oi_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 2: oi_poi_fp
27func oi_p(s: *u8) -> i64 { sys_write(1, s, oi_len(s)); return 0 }
called by 1: main calls 2: sys_writeoi_len
28func oi_fp(fd: i64, s: *u8) -> i64 { sys_write(fd, s, oi_len(s)); return 0 }
called by 1: main calls 2: sys_writeoi_len
31func oi_cat(out: *u8, a: *u8, b: *u8, c: *u8) -> i64
42func oi_offc_path(name: *u8, out: *u8) -> i64 { return oi_cat(out, "_offc/" as *u8, name, ".elf" as *u8) }
called by 2: oi_staleoi_install calls 1: oi_cat
43func oi_tmp_path(name: *u8, out: *u8) -> i64 { return oi_cat(out, "/tmp/" as *u8, name, ".sov.elf" as *u8) }
called by 2: oi_staleoi_install calls 1: oi_cat
44func oi_tmpinstall_path(name: *u8, out: *u8) -> i64 { return oi_cat(out, "_offc/" as *u8, name, ".elf.oitmp" as *u8) }
called by 1: oi_install calls 1: oi_cat
47func oi_differ(a: *u8, alen: i64, b: *u8, blen: i64) -> i64
called by 2: oi_staleoi_install
55func oi_stale(name: *u8) -> i64
68func oi_install(name: *u8) -> i64
94func oi_fresh(path: *u8) -> i64
called by 3: mainmainmain calls 2: sys_mmapsys_read_file
104func oi_mtime_ns(path: *u8) -> i64
118func oi_src_stale(artifact: *u8, source: *u8) -> i64
called by 1: main calls 1: oi_mtime_ns
127func oi_wn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;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 4: mainmainmainmain calls 2: sys_mmapsys_write
129func main(argc: i64, argv: *i64) -> i64