pub fn pid_alive(pid: u32) -> boolExpand description
Best-effort liveness check for a process id, read through sysinfo’s
process table - read-only, and no helper process is spawned.
A pid the table does not list reads as dead. On a platform sysinfo does
not support the query fails, which reads as alive.
Every uncertain outcome reads as alive, on purpose. This exists so
crate::daemon::sweep_stale_claims can reclaim a lock faster than its
age-based fallback when the owning process is verifiably gone; the risk
on the other side - reclaiming a lock a live process still holds - lets a
second daemon start a second run on the same task, which costs far more
than leaving one lock alone a little longer. So a helper program that is
missing, output that cannot be parsed, or a permission error that merely
proves the pid exists under another account, all count as “alive” rather
than as license to reclaim.