nx_lock_reap_core.nx
buildroot/runtime/nx_lock_reap_core.nx
about
nx_lock_reap_core.nx -- importable CORE of the SOVEREIGN stale-lock reaper (R-ORCH-2a; the
BUILD(missing) gap the triage flagged + the exact class that blocked commits this session, now
mechanized as an ORGAN instead of the ps|grep|rm shell sin). A workstream that crashes mid-write
can leave a stale lock (git index.lock, a WMS lease, cp_deploy.lease, a reconcile lock) blocking
every sibling -- exactly what the orchestration north-star must never let a crash cost. This
reaps such a lock, but ONLY when it is provably abandoned.
FAIL-SAFE BY CONSTRUCTION (the load-bearing property, gate-proven): reap iff the lock EXISTS AND
no OWNER process is alive (a /proc cmdline scan for the owner needle -- authoritative for same-
kernel NAS/WSL processes) AND it is older than the age threshold. A live-owned lock is NEVER
reaped (even if old); a fresh lock is NEVER reaped (a legit in-flight op). Default = do nothing.
(Cross-boundary note: a Windows git.exe holding /mnt/c/.git/index.lock is NOT visible in WSL
/proc; that case is closed by the sovereign-commit path, not this reaper -- honest scope.)
license_tier: ORIGINAL
dependencies 2 imports · 2 importers
imports: nx_syscalls.nxnx_crashresume_census_core.nx
imported by: nx_lock_reap.nxnx_lock_reap_gate.nx
structs
| none |
consts
| 17 | const K_MAGIC_65536: i64 = 65536 |
| 18 | const K_MAGIC_8192: i64 = 8192 |
functions
| 21 | func lr_unlink(path: *u8) -> i64 { return __syscall(263, AT_FDCWD, path, 0, 0, 0, 0) } |
| 24 | func lr_exists(path: *u8) -> i64 |
| 31 | func lr_age_s(path: *u8, now: i64) -> i64 |
| 38 | func lr_contains(hay: *u8, hn: i64, needle: *u8) -> i64 |
| 53 | func lr_selfpid() -> i64 |
| 63 | func lr_owner_alive(needle: *u8) -> i64 called by 2: mainmain calls 11: ccz_slenlr_selfpidsys_openat_rdsys_mmapsys_getdents64dirent_reclen+5 |
| 111 | func lr_should_reap(exists: i64, owner_alive: i64, age_s: i64, max_age_s: i64) -> i64 |