nx_research_cleanup.nx source
↩ module page · 31 lines · 2189 B
1// nx_research_cleanup.nx -- SOVEREIGN deletion of the 7 copy-paste nx_*_research_fetch organs, now SUPERSEDED by
2// thin topic organs composing nx_research_engine (rule-15 DRY correction). Uses unlinkat(263) -- the ecosystem's
3// own delete (the nx_cad_nas_probe precedent), NOT a shell rm. Idempotent: confirms each file is gone after unlink.
4// expect_exit: 0 license_tier: ORIGINAL
5import "nx_syscalls.nx"
6import "nx_itoa_lib.nx" // shared MSB-first emitter (zero-alloc)
7
8func g_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
9// MIGRATED to the shared emitter (debt 1785563586). The old body mmapped a scratch buffer
10// per call and never freed it. At PAGE granularity that is 4096B leaked PER CALL -- the
11// defect that took 28.5GB of a 36GB host in nx_ts_lumadiff (2MB input, ~3.66M calls).
12// nxi_* is MSB-first, allocates NOTHING, and emits identical bytes including the sign.
13func g_pn(v: i64) -> i64 { nxi_out(v); return 0 }
14func p_unlink(path: *u8) -> i64 { __syscall(263, AT_FDCWD, path, 0, 0, 0, 0); return 0 }
15func have(path: *u8) -> i64 { let fd: i64=sys_openat_rd(path); if fd<0 { return 0 } sys_close(fd); return 1 }
16func del(path: *u8) -> i64 { p_unlink(path); g_puts(" "); g_puts(path); if have(path)==0 { g_puts(" -> gone\n" as *u8); return 1 } g_puts(" -> STILL PRESENT\n" as *u8); return 0 }
17
18func main() -> i64 {
19 g_puts("nx_research_cleanup (delete the 7 copy-paste fetchers; superseded by thin organs on nx_research_engine)\n" as *u8)
20 var gone: i64=0
21 gone=gone+del("runtime/nx_os_compete_research_fetch.nx" as *u8)
22 gone=gone+del("runtime/nx_exefmt_research_fetch.nx" as *u8)
23 gone=gone+del("runtime/nx_gfx_research_fetch.nx" as *u8)
24 gone=gone+del("runtime/nx_gpu_driver_research_fetch.nx" as *u8)
25 gone=gone+del("runtime/nx_bench_tools_research_fetch.nx" as *u8)
26 gone=gone+del("runtime/nx_smalltrain_research_fetch.nx" as *u8)
27 gone=gone+del("runtime/nx_cheaptrain_research_fetch.nx" as *u8)
28 g_puts("CLEANUP: "); g_pn(gone); g_puts(" / 7 copy-paste fetchers deleted (replaced by thin organs composing nx_research_engine)\n" as *u8)
29 if gone==7 { return 0 }
30 return 1
31}