code wiki / _hdl_build / nx_tool_run_timeout_gate.nx

nx_tool_run_timeout_gate.nx

buildroot/runtime/_hdl_build/nx_tool_run_timeout_gate.nx

32486 B723 linesdepth 5pulls 7 transitivereach 0 importersview sourcekind gate/prooftopic tool
docsdependenciesstructsconstsfunctions

about

nx_tool_run_timeout_gate.nx -- proves tr_run_capture_to actually BOUNDS a hanging child (seq1412). The claim under test is not "the function returns a timeout constant" -- that is trivial to fake. It is "a child that would run for 10 seconds is KILLED at the deadline, its output is still captured, it is REAPED rather than orphaned, and a fast child is NOT falsely timed out". So every tooth measures something an empty implementation would fail: T1 the deadline FIRES -- 10s sleeper, 500ms budget -> TR_ERR_TIMEOUT T2 the deadline is REAL TIME -- that call returns in well under the sleeper's 10s (the load-bearing tooth: returning -5 after waiting the full 10s would be a lie) T3 NEG-CONTROL fast child -- a 50ms sleeper with a 5s budget exits 0, NOT timed out T4 output survives -- the fast child's stdout is captured intact T5 REPEATABLE -- a second timeout run behaves identically; resource-leak accounting requires separate lifecycle evidence T6 opt-out is explicit -- timeout_ms<=0 delegates to the unbounded path and still succeeds license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_tool_run.nx nx_os_proc.nx nx_gate_verdict.nx nx_tool_run_timeout_gate.nx

imports: nx_syscalls.nxnx_tool_run.nxnx_os_proc.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

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

main gv_ctr sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ tg_lifecycle_gate osp_fd_count sys_mmap ↻ osp_ppath osp_itoa sys_mmap ↻ sys_openat_rd sys_munmap osp_fd_count_from_fd osp_fd_count_from_fd_resul sys_mmap ↻ sys_getdents64 dirent_reclen dirent_name sys_munmap ↻ sys_close tg_capture_crash_check sys_fork tg_capture_owner_crash sys_prctl sys_fork ↻ sys_mmap ↻ tr_run_capture_to

structs

none

consts

24const TG_RLIMIT_NOFILE: i64 = 7
26const TG_HIGH_FD_WITNESS: i64 = 2048
27const TG_CHILDREN_READ_WINDOW: i64 = 4096
29const TG_STDOUT: i64 = 1
30const TG_SLEEPER: *u8 = "_build/nx_tr_sleeper.sov.elf"
31const TG_OUTCAP: i64 = 65536
34const TG_HANG_MS: i64 = 10000
35const TG_BUDGET_MS: i64 = 500
38const TG_MAX_ELAPSED_S: i64 = 5
39const TG_FAST_MS: i64 = 50
40const TG_FAST_BUDGET_MS: i64 = 5000
77const TG_STREAM_CAP: i64 = 16384
78const TG_STREAM_BLOCKS: i64 = 16
79const TG_STREAM_EXIT: i64 = 23
80const TG_SYS_GETPID: i64 = 172 // portable syscall ABI used by nx_getpid_const_probe
247const TG_PARALLEL_SMALL: i64=8
248const TG_PARALLEL_LARGE: i64=15
249const TG_PARALLEL_ROW: i64=8
468const TG_LIFETIME_WAIT_MS: i64 = 10
469const TG_LIFETIME_ATTEMPTS: i64 = 50

functions

42func tg_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(TG_STDOUT, s, n); return 0 }
43func tg_num(v: i64) -> i64
56func tg_check(ok: i64, label: *u8, got: i64, want: i64) -> i64
68func tg_run(ms: *u8, budget: i64, out: *u8, ol: *i64) -> i64
called by 1: main calls 2: sys_mmaptr_run_capture_to
81func tg_stream_child(mode: i64) -> i64
111func tg_stream_check(self: *u8, mode: *u8, traced: i64, wantcut: i64, wantlen: i64) -> i64
142func tg_stream_timeout(self: *u8) -> i64
159func tg_invalid_capacity() -> i64
173func tg_descendant_deadline(self: *u8) -> i64
189func tg_lifecycle_exit(self: *u8, mode: *u8, budget: i64, expected: i64) -> i64
204func tg_wait_observe() -> i64
226func tg_cwd_check(self: *u8, mode: *u8, cwd: *u8, expected: i64) -> i64
250func tg_parallel_producer(identity: i64) -> i64
called by 1: main calls 3: sys_sleep_mssys_mmapsys_write
268func tg_parallel_worker(self: *u8, index: i64, row: *i64) -> i64
294func tg_parallel_capture(self: *u8, count: i64) -> i64
361func tg_resource_finish(pid: i64, baseline: i64) -> i64
395func tg_high_descriptor_subject(self: *u8) -> i64
440func tg_high_descriptor(self: *u8) -> i64
470func tg_lifetime_fixture(late: i64) -> i64
541func tg_lifetime_check(late: i64) -> i64
555func tg_owner_children(owner: i64, pids: *i64) -> i64
called by 1: tg_capture_owner_crash calls 1: osp_children
558func tg_capture_owner_crash(self: *u8, incomplete: i64) -> i64
620func tg_capture_crash_check(self: *u8, incomplete: i64) -> i64
636func tg_lifecycle_gate(self: *u8) -> i64
649func main(argc: i64, argv: *i64) -> i64