code wiki / _hdl_build / nx_jobcancel_gate.nx

nx_jobcancel_gate.nx

buildroot/runtime/_hdl_build/nx_jobcancel_gate.nx

7094 B103 linesdepth 4pulls 5 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_jobcancel_gate.nx -- referee for nx_jobcancel_lib (engineshift ES29, 2026-09-15): a REAL child of this gate sleeps as the job under test, the launch row is planted in a /tmp fixture journal, and the cancel verb is driven through every named outcome: REFUSED-ABSENT (no row), REFUSED-MISMATCH (row names another elf: the child must survive), CANCELLED (TERM suffices, the child is reaped with signal 15), ALREADY-GONE (a second cancel of the same row). The KILL escalation is NOT exercised here (a child that ignores TERM needs a signal mask this gate does not install) and the receipt says so. Fixture dir /tmp/nx_jobcancel_gate/, journal truncated at SETUP. license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_jobcancel_lib.nx nx_syscalls.nx nx_gate_verdict.nx nx_jobcancel_gate.nx

imports: nx_jobcancel_lib.nxnx_syscalls.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 ↻ gv_head gv_puts sys_write ↻ sys_mkdir gv_check gv_puts ↻ g_fresh sys_openat_wr sys_close sys_mmap ↻ gv_check_eq gv_check ↻ gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻ sys_munmap jc_cancel sys_mmap ↻ jc_find sys_mmap ↻ sys_read_file sys_openat_rd

structs

none

consts

12const G_DIR: *u8 = "/tmp/nx_jobcancel_gate/"
13const G_JRNL: *u8 = "/tmp/nx_jobcancel_gate/jobrun.jrnl"
14const G_CONF: *u8 = "/tmp/nx_jobcancel_gate/jobrun.conf"
15const G_CONF_ROWS: *u8 = "# planted\ncancel_grace_ms 250\n"
16const G_OUT_A: *u8 = "/tmp/nx_jobcancel_gate/job_a.out"
17const G_OUT_B: *u8 = "/tmp/nx_jobcancel_gate/job_b.out"
18const G_OUT_NONE: *u8 = "/tmp/nx_jobcancel_gate/never_launched.out"
19const G_WRONG_ELF: *u8 = "/tmp/nx_jobcancel_gate/not_this.elf"
20const G_CHILD_SLEEP_MS: i64 = 30000
21const G_GRACE_MS: i64 = 2000
22const G_POLL_MS: i64 = 50
23const G_EPOCH: i64 = 1789482000
24const G_MODE_644: i64 = 420
25const G_SIG_MASK: i64 = 128 // the low 7 bits of a wait4 status word carry the terminating signal
26const G_WAIT_WORDS: i64 = 2
27const G_ROW_CAP: i64 = 2048

functions

29func g_fresh(path: *u8) -> i64 { let fd: i64 = sys_openat_wr(path, G_MODE_644); if fd >= 0 { sys_close(fd); return 1 } return 0 }
called by 1: main calls 2: sys_openat_wrsys_close
30func g_write(path: *u8, body: *u8) -> i64 { let fd: i64 = sys_openat_wr(path, G_MODE_644); if fd < 0 { return 0 } sys_write(fd, body, jc_slen(body)); sys_close(fd); return 1 }
31func g_child() -> i64 { let pid: i64 = sys_fork(); if pid == 0 { sys_sleep_ms(G_CHILD_SLEEP_MS); sys_exit(0) } return pid }
called by 1: main calls 3: sys_forksys_sleep_mssys_exit
32func g_count_rows(path: *u8, kind: *u8) -> i64
52func main(argc: i64, argv: *i64) -> i64