code wiki / _hdl_build / nx_offc_install.nx
nx_offc_install.nx
buildroot/runtime/_hdl_build/nx_offc_install.nx
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
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
structs
| none |
consts
| 19 | const OI_MAGIC_1024: i64 = 1024 |
| 20 | const OI_MAGIC_1000000000: i64 = 1000000000 |
| 22 | const OI_SIG: *u8 = "STALE-OFFC-ARTIFACT" |
| 23 | const OI_LOG: *u8 = "knowledge/status/offc_install.log" |
| 24 | const OI_ATFDCWD: i64 = 0 - 100 |
functions
| 26 | func oi_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 27 | func oi_p(s: *u8) -> i64 { sys_write(1, s, oi_len(s)); return 0 } |
| 28 | func oi_fp(fd: i64, s: *u8) -> i64 { sys_write(fd, s, oi_len(s)); return 0 } |
| 31 | func oi_cat(out: *u8, a: *u8, b: *u8, c: *u8) -> i64 |
| 42 | func oi_offc_path(name: *u8, out: *u8) -> i64 { return oi_cat(out, "_offc/" as *u8, name, ".elf" as *u8) } |
| 43 | func oi_tmp_path(name: *u8, out: *u8) -> i64 { return oi_cat(out, "/tmp/" as *u8, name, ".sov.elf" as *u8) } |
| 44 | func oi_tmpinstall_path(name: *u8, out: *u8) -> i64 { return oi_cat(out, "_offc/" as *u8, name, ".elf.oitmp" as *u8) } |
| 47 | func oi_differ(a: *u8, alen: i64, b: *u8, blen: i64) -> i64 |
| 55 | func oi_stale(name: *u8) -> i64 |
| 68 | func oi_install(name: *u8) -> i64 called by 2: mainmain calls 10: sys_mmapoi_tmp_pathoi_offc_pathoi_tmpinstall_pathsys_read_filesys_openat_wr+4 |
| 94 | func oi_fresh(path: *u8) -> i64 |
| 104 | func oi_mtime_ns(path: *u8) -> i64 |
| 118 | func oi_src_stale(artifact: *u8, source: *u8) -> i64 |
| 127 | func 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 } |
| 129 | func main(argc: i64, argv: *i64) -> i64 |