code wiki / (root) / nx_ctrlbyte_gate.nx

nx_ctrlbyte_gate.nx

buildroot/runtime/nx_ctrlbyte_gate.nx

10041 B259 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_ctrlbyte_gate.nx -- CONTROL-BYTE CORRUPTION TOOTH (debt 1785520719 / 1785521381, 2026-07-31). THE WOUND: 210 .nx sources had ONE LINE INSIDE putn overwritten by a run of 0x0E (Shift-Out) bytes. Every organ so hit printed EMPTY status=, bytes= and counts -- a fleet of blind instruments. It survived because BOTH existing rulers called it healthy: nx_srcguard rules on SYMBOLS (a line replaced inside a function changes no top-level symbol, so it can never fire) and nx_fs read RENDERS A 0x0E RUN AS AN INNOCENT BLANK LINE. A symbol ruler and a byte ruler answer DIFFERENT questions; the corpus had only the first. This is the byte ruler: any byte outside {tab, LF, CR, printable, UTF-8 >=0x80} in a .nx file is RED. A rule nothing must remember beats a list nobody maintains. verbs: scan [dir] | selftest <writable-scratch-dir> expect_exit: 0 license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_ctrlbyte_gate.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main cb_puts sys_write cb_vlen sys_exit sys_mmap cb_scan_dir sys_openat_rd sys_mmap ↻ sys_getdents64 dirent_reclen dirent_name dirent_type cb_join cb_vlen ↻ cb_scan_dir ↻ cb_ends_nx cb_vlen ↻ cb_scan_file sys_openat_rd ↻ sys_read sys_close cb_is_bad cb_puts ↻ cb_putn sys_write ↻ sys_mmap ↻ cb_hex2 sys_write ↻ sys_close ↻ cb_putn ↻ cb_join ↻ cb_write_file sys_openat_wr sys_write ↻ sys_close ↻ cb_vlen ↻ cb_scan_file ↻ cb_is_bad ↻

structs

none

consts

14const CB_DIRBUF: i64 = 131072
15const CB_FCAP: i64 = 4194304
16const CB_PATH: i64 = 1024
17const CB_DT_DIR: i64 = 4
18const CB_MODE_644: i64 = 420
19const CB_MAX_REPORT: i64 = 40
20const CB_SIG_RUN: i64 = 119

functions

22func cb_vlen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
23func cb_puts(s: *u8) -> i64 { sys_write(1, s, cb_vlen(s)); return 0 }
called by 2: cb_scan_filemain calls 2: sys_writecb_vlen
24func cb_putn(v: i64) -> i64
called by 2: cb_scan_filemain calls 2: sys_writesys_mmap
35func cb_hex2(v: i64) -> i64
called by 1: cb_scan_file calls 1: sys_write
46func cb_is_bad(c: i64) -> i64
called by 2: cb_scan_filemain
55func cb_ends_nx(nm: *u8) -> i64
called by 1: cb_scan_dir calls 1: cb_vlen
64func cb_join(dst: *u8, dir: *u8, nm: *u8) -> i64
called by 2: cb_scan_dirmain calls 1: cb_vlen
76func cb_scan_file(path: *u8, buf: *u8, reported: *i64) -> i64
112func cb_scan_dir(dir: *u8, recurse: i64, buf: *u8, stats: *i64, reported: *i64) -> i64
153func cb_write_file(path: *u8, data: *u8, n: i64) -> i64
161func main(argc: i64, argv: *i64) -> i64