code wiki / _hdl_build / nx_init.nx

nx_init.nx

buildroot/runtime/_hdl_build/nx_init.nx

5453 B87 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_init.nx -- SOVEREIGN INIT SYSTEM (OS gap: INIT-SERVICES). Service UNITS declare dependencies; init computes a dependency-ordered START ORDER (topological sort, Kahn's algorithm) so each unit starts only after its deps, and DETECTS cycles. Ties together the daemons the ecosystem already has under a real init. Grounded: os_init.raw. T1 topo-sort the Nishi service graph -> all units ordered (no cycle). T2 each unit's deps precede it. T3 the root (syscalls, no deps) is first. T4 teeth: a dependency CYCLE is detected (cannot order all). HONEST BEHIND vs systemd: no socket-activation / cgroups / parallel start / live restart-supervision loop (asterisk). expect_exit: 0 Sovereign: nx_syscalls. NEVER-BRICK: orders/launches userspace, writes 0 firmware.

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_g_puts_lib.nx nx_init.nx

imports: nx_syscalls.nxnx_g_puts_lib.nx

imported by: nobody (leaf or entry point)

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

main g_puts sys_write sys_mmap nx_topo sys_mmap ↻ ck g_puts ↻ nx_order_ok sys_mmap ↻ g_pn sys_mmap ↻ sys_write ↻ sys_openat_append sys_write ↻ sys_close sys_exit

structs

none

consts

14const MAXD: i64 = 4

functions

11func g_pn(v: i64) -> i64 { let b: *u8=sys_mmap(28); var x: i64=v; if x<0{b[0]=45;sys_write(1,b,1);x=0-x} if x==0{b[0]=48;sys_write(1,b,1);return 0} var d: i64=0; var y: i64=x; while y>0{d=d+1;y=y/10} var i: i64=d-1; y=x; while i>=0{b[i]=(48+(y%10)) as u8;y=y/10;i=i-1} sys_write(1,b,d); return 0 }
called by 1: main calls 2: sys_mmapsys_write
12func ck(name: *u8, c: i64) -> i64 { if c==1 { g_puts(" PASS " as *u8) } else { g_puts(" FAIL " as *u8) } g_puts(name); g_puts("\n" as *u8); return c }
called by 1: main calls 1: g_puts
17func nx_topo(ndep: *i64, dep: *i64, N: i64, order: *i64) -> i64
called by 1: main calls 1: sys_mmap
35func nx_order_ok(order: *i64, oc: i64, ndep: *i64, dep: *i64, N: i64) -> i64
called by 1: main calls 1: sys_mmap
44func main() -> i64