code wiki / (root) / nx_lock_reap_core.nx

nx_lock_reap_core.nx

buildroot/runtime/nx_lock_reap_core.nx

5258 B117 linesdepth 4pulls 4 transitivereach 2 importersview sourcekind library
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_crashresume_census_core.nx nx_lock_reap_core.nx nx_lock_reap.nx nx_lock_reap_gate.nx

imports: nx_syscalls.nxnx_crashresume_census_core.nx

imported by: nx_lock_reap.nxnx_lock_reap_gate.nx

structs

none

consts

17const K_MAGIC_65536: i64 = 65536
18const K_MAGIC_8192: i64 = 8192

functions

24func lr_exists(path: *u8) -> i64
called by 2: mainmain calls 2: sys_mmapsys_fstatat
31func lr_age_s(path: *u8, now: i64) -> i64
called by 2: mainmain calls 1: ccz_mtime
38func lr_contains(hay: *u8, hn: i64, needle: *u8) -> i64
called by 1: lr_owner_alive calls 1: ccz_slen
53func lr_selfpid() -> i64
63func lr_owner_alive(needle: *u8) -> i64
111func lr_should_reap(exists: i64, owner_alive: i64, age_s: i64, max_age_s: i64) -> i64
called by 2: mainmain