code wiki / _hdl_build / nx_init.nx
nx_init.nx
buildroot/runtime/_hdl_build/nx_init.nx
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
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
structs
| none |
consts
| 14 | const MAXD: i64 = 4 |
functions
| 11 | func 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 } |
| 12 | func 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 } |
| 17 | func nx_topo(ndep: *i64, dep: *i64, N: i64, order: *i64) -> i64 |
| 35 | func nx_order_ok(order: *i64, oc: i64, ndep: *i64, dep: *i64, N: i64) -> i64 |
| 44 | func main() -> i64 |