nx_run_timeout.nx
buildroot/runtime/nx_run_timeout.nx
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
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
| 21 | const NX_RT_SYS_ALARM: i64 = 37 |
| 24 | const NX_RT_SYS_ALARM: i64 = 37 |
| 27 | const NX_RT_TIMEOUT: i64 = 1000 // child SIGALRM'd at the deadline (a HANG/loop) |
| 28 | const NX_RT_FORK_FAIL: i64 = 1001 // fork or wait anomaly |
| 29 | const NX_RT_SIGALRM: i64 = 14 // the deadline signal (default action = terminate) |
functions
| 34 | func nx_rt_alarm(sec: i64) -> i64 |
| 41 | func nx_run_timeout(path: *u8, argv: *i64, envp: *i64, called by 7: g_measurecp_runc_measurecl_gatesh_measurerun_gate+1 calls 10: sys_now_mssys_forksys_openat_wrsys_dup3nx_rt_alarmsys_execve+4 |