code wiki / _hdl_build / nx_sov_tree_audit.nx

nx_sov_tree_audit.nx

buildroot/runtime/_hdl_build/nx_sov_tree_audit.nx

10517 B190 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic sov
docsdependenciesstructsconstsfunctions

about

nx_sov_tree_audit.nx -- WHOLE-TREE sovereignty census. Recursively walks a directory root (getdents64 + newfstatat, so it works even where d_type is DT_UNKNOWN on DrvFs), and: - every .nx file: scans for non-sovereign markers (exec-target string-literals "/bin/sh,"python,"qemu,... + non-.nx imports) -> counts sovereign vs FLAGGED, lists the flagged organs (the program-path worklist) - every non-.nx SOURCE file (.sh/.py/.java/.jar/.go/.js/.ts/.rb/.pl/.class/.c/.cpp): counts by extension - vendored trees (node_modules/.git/.alelane) are recorded but NOT descended (bounded + honest) This turns "do we have hidden python/sh/java anywhere" into a repeatable mechanical census. It does NOT use sys_read_file (that reserves ~4GB/call -> OOM over thousands of files); it reads into ONE reused buffer. nx_sov_tree_audit [root] (default ".") license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_sov_tree_audit.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 ta_puts sys_write sys_mmap sys_openat_rd ta_getdents ta_eq ta_join ta_isdir ta_strlen ta_ends ta_strlen ↻ ta_read sys_openat_rd ↻ sys_read sys_close ta_check_nx ta_strlen ↻ ta_find ta_strlen ↻ ta_puts ↻ sys_close ↻ ta_num sys_mmap ↻ sys_write ↻ sys_exit

structs

none

consts

12const K_MAGIC_16384: i64 = 16384
13const K_MAGIC_65536: i64 = 65536
14const K_MAGIC_4194304: i64 = 4194304

functions

16func ta_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 2: ta_check_nxmain calls 1: sys_write
17func ta_num(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=(48 as u8);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(1,bb,k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
18func ta_strlen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
19func ta_eq(a: *u8, b: *u8) -> i64 { var i: i64=0; while a[i]!=(0 as u8){ if a[i]!=b[i]{return 0} i=i+1 } if b[i]!=(0 as u8){return 0} return 1 }
called by 1: main
21func ta_ends(path: *u8, pl: i64, ext: *u8) -> i64
called by 1: main calls 1: ta_strlen
25func ta_find(buf: *u8, n: i64, pat: *u8, start: i64) -> i64
called by 1: ta_check_nx calls 1: ta_strlen
32func ta_join(dst: *u8, dir: *u8, name: *u8) -> i64
called by 1: main
40func ta_read(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
46func ta_getdents(fd: i64, buf: *u8, count: i64) -> i64 { return __syscall(217, fd, buf, count, 0, 0, 0) }
called by 1: main
48func ta_isdir(path: *u8, st: *u8) -> i64
called by 1: main
57func ta_check_nx(path: *u8, buf: *u8, n: i64, M: *i64, mc: i64) -> i64
called by 1: main calls 3: ta_strlenta_findta_puts
90func main(argc: i64, argv: *i64) -> i64