code wiki / (root) / nx_run_timeout.nx

nx_run_timeout.nx

buildroot/runtime/nx_run_timeout.nx

3236 B67 linesdepth 2pulls 2 transitivereach 9 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_run_timeout.nx -- sovereign RUN-WITH-TIMEOUT primitive (bits-up, reusable). REASON TO EXIST: the engineer's cockpit (nx_engineer.nx) runs gates with a BLOCKING sys_wait4(pid, st, 0) -- so a gate that HANGS (infinite loop) hangs the engineer itself. It can clock SLOW but cannot detect a HANG. This is the bits-up capability gap. nx_run_timeout closes it: fork -> exec -> poll-wait against a monotonic deadline -> KILL on overrun. Returns the child's exit code, or NX_RT_TIMEOUT if it had to be killed (a true infinite loop). Reuse set: nx_engineer (detect hanging gates, not just slow), the compiler loop-detector (nx_cc_probe), any supervised spawn that must not block forever. NishiLang-native -- replaces `timeout N cmd` shell scaffolding. license_tier: ORIGINAL

dependencies 1 imports · 8 importers

nx_syscalls.nx nx_run_timeout.nx nx_cc_guardian.nx nx_cc_probe.nx nx_conductor.nx nx_conductor_live.nx nx_crew_selfheal.nx nx_engineer.nx nx_gate_runner.nx nx_race_board.nx

imports: nx_syscalls.nx

imported by: nx_cc_guardian.nxnx_cc_probe.nxnx_conductor.nxnx_conductor_live.nxnx_crew_selfheal.nxnx_engineer.nxnx_gate_runner.nxnx_race_board.nx

structs

none

consts

21const NX_RT_SYS_ALARM: i64 = 37
24const NX_RT_SYS_ALARM: i64 = 37
27const NX_RT_TIMEOUT: i64 = 1000 // child SIGALRM'd at the deadline (a HANG/loop)
28const NX_RT_FORK_FAIL: i64 = 1001 // fork or wait anomaly
29const NX_RT_SIGALRM: i64 = 14 // the deadline signal (default action = terminate)

functions

34func nx_rt_alarm(sec: i64) -> i64
41func nx_run_timeout(path: *u8, argv: *i64, envp: *i64,