Expand description
Process liveness detection for reservation reaping.
heddle agent reserve is a one-shot command — the CLI process exits as
soon as the reservation has been recorded. Holding a per-session
flock for the life of that process therefore buys nothing: the
kernel releases the lock on exit(2) long before the next agent ever
needs to check liveness.
We instead record (pid, boot_id) at reservation time and check
liveness on demand with kill(pid, 0) plus a boot-id comparison.
ESRCH means the process is gone. A boot id mismatch means the host
rebooted and the PID has been reused — the original owner is also
gone.
Enums§
Functions§
- current_
boot_ id - Best-effort current boot identifier.
- is_
owner_ alive - Combined check: PID is alive and the recorded boot id matches the
current boot id (when both are known). Missing fields collapse to
Unknown— callers should not reap onUnknown. - process_
alive trueif the process identified bypidis still running. ESRCH fromkill(pid, 0)is treated as dead. Any other error (notably EPERM — the process exists but is owned by a different user) is treated as alive: “alive in another uid namespace” still means the reservation might be valid.