code wiki / _hdl_build / nx_jobcancel_gate.nx
nx_jobcancel_gate.nx
buildroot/runtime/_hdl_build/nx_jobcancel_gate.nx
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
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
structs
| none |
consts
| 12 | const G_DIR: *u8 = "/tmp/nx_jobcancel_gate/" |
| 13 | const G_JRNL: *u8 = "/tmp/nx_jobcancel_gate/jobrun.jrnl" |
| 14 | const G_CONF: *u8 = "/tmp/nx_jobcancel_gate/jobrun.conf" |
| 15 | const G_CONF_ROWS: *u8 = "# planted\ncancel_grace_ms 250\n" |
| 16 | const G_OUT_A: *u8 = "/tmp/nx_jobcancel_gate/job_a.out" |
| 17 | const G_OUT_B: *u8 = "/tmp/nx_jobcancel_gate/job_b.out" |
| 18 | const G_OUT_NONE: *u8 = "/tmp/nx_jobcancel_gate/never_launched.out" |
| 19 | const G_WRONG_ELF: *u8 = "/tmp/nx_jobcancel_gate/not_this.elf" |
| 20 | const G_CHILD_SLEEP_MS: i64 = 30000 |
| 21 | const G_GRACE_MS: i64 = 2000 |
| 22 | const G_POLL_MS: i64 = 50 |
| 23 | const G_EPOCH: i64 = 1789482000 |
| 24 | const G_MODE_644: i64 = 420 |
| 25 | const G_SIG_MASK: i64 = 128 // the low 7 bits of a wait4 status word carry the terminating signal |
| 26 | const G_WAIT_WORDS: i64 = 2 |
| 27 | const G_ROW_CAP: i64 = 2048 |
functions
| 29 | func 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 } |
| 30 | func 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 } |
| 31 | func g_child() -> i64 { let pid: i64 = sys_fork(); if pid == 0 { sys_sleep_ms(G_CHILD_SLEEP_MS); sys_exit(0) } return pid } |
| 32 | func g_count_rows(path: *u8, kind: *u8) -> i64 |
| 52 | func main(argc: i64, argv: *i64) -> i64 |