code wiki / (root) / nx_lock_reap.nx

nx_lock_reap.nx

buildroot/runtime/nx_lock_reap.nx

3239 B61 linesdepth 5pulls 5 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_lock_reap.nx -- CLI of the sovereign stale-lock reaper (R-ORCH-2a). Reaps ONE abandoned lock so a crashed workstream never blocks its siblings -- the janitorial pillar of the orchestration north-star, as an organ (never the ps|grep|rm shell sin). usage: nx_lock_reap <lockpath> <max_age_s> <owner_needle> [dry] owner_needle = a substring of the owner process's /proc cmdline (e.g. "nx_mgmt_api", "git"); pass "-" for no owner-check (age-only, for cross-boundary locks where /proc can't see the owner). Reaps iff exists AND owner not alive AND age > max_age_s. dry -> report only. Always exits 0 (a reaper must never fail its cron); appends a line to knowledge/status/lock_reap.log. license_tier: ORIGINAL expect_exit: 0

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_lock_reap_core.nx nx_lock_reap.nx

imports: nx_syscalls.nxnx_lock_reap_core.nx

imported by: nobody (leaf or entry point)

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

main r_puts sys_write sys_mmap ccz_num_at ccz_slen r_streq sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real lr_exists sys_mmap ↻ sys_fstatat lr_owner_alive ccz_slen ↻ lr_selfpid sys_mmap ↻ ccz_read sys_openat_rd sys_read sys_close ccz_num_at ↻ sys_openat_rd ↻ sys_mmap ↻ sys_getdents64 dirent_reclen dirent_name ccz_num_at ↻ ccz_read ↻ lr_contains ccz_slen ↻ sys_close ↻ lr_age_s ccz_mtime sys_mmap ↻ sys_fstatat ↻ sys_munmap lr_should_reap ccz_cat_str ccz_cat_num

structs

none

consts

12const K_MAGIC_1024: i64 = 1024

functions

14func r_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 1: main calls 1: sys_write
15func r_streq(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while a[i] != (0 as u8) { if a[i] != b[i] { return 0 } i = i + 1 } if b[i] != (0 as u8) { return 0 } return 1 }
called by 1: main
17func main(argc: i64, argv: *i64) -> i64