code wiki / _hdl_build / nx_import_probe.nx

nx_import_probe.nx source

↩ module page · 17 lines · 1078 B

1// nx_import_probe.nx -- EMPIRICAL test (Rule 2: verify runtime, don't trust the doc): can a _hdl_build/ organ 2// import BOTH a _hdl_build/ organ (nx_resource_governor) AND a runtime/ organ (nx_warden_lib)? If it compiles, 3// the unified governed+warden conductor can live here and reach both. license_tier: ORIGINAL expect_exit: 0 4import "nx_syscalls.nx" 5import "nx_resource_governor.nx" // _hdl_build/ (same dir as this file) 6import "nx_warden_lib.nx" // runtime/ (the cross-directory test) 7 8func main() -> i64 { 9 let nice: i64 = rg_nice(RG_POLITE) // symbol from the _hdl_build governor 10 let auth: i64 = warden_authorize(W_ADDITIVE, "/tmp/probe\x00" as *u8, 0) // symbol from the runtime warden 11 sys_write(1, "IMPORT-PROBE: both resolved nice=\x00" as *u8, 34) 12 if nice == 10 { sys_write(1, "10\x00" as *u8, 2) } 13 sys_write(1, " auth=\x00" as *u8, 6) 14 if auth == W_ALLOW { sys_write(1, "ALLOW\x00" as *u8, 5) } else { sys_write(1, "DENY\x00" as *u8, 4) } 15 sys_write(1, "\n\x00" as *u8, 1) 16 return 0 17}