Expand description
Shared flock(2)-backed advisory pid-file guard.
This is the single-instance-lock primitive used by both zeph-core::daemon::PidGuard
and zeph-scheduler::pidfile::PidFile. The lock is acquired with LOCK_EX | LOCK_NB
so a second invocation fails immediately rather than blocking, and the pid file is
unlinked when the guard is dropped.
Invariant: the pid file MUST reside on a local filesystem. NFS mounts do not
guarantee reliable exclusive locking with flock(2).
Unix only — flock(2) has no portable equivalent, so callers on other platforms must
implement their own fallback (see zeph-core::daemon::PidGuard’s non-Unix branch).
Structs§
- PidLock
Guard - Exclusive,
flock(2)-backed guard on a pid file.
Enums§
- PidLock
Error - Error acquiring or maintaining a
PidLockGuard.
Functions§
- is_
process_ alive - Check whether a process with the given PID is currently alive.
- read_
pid_ lenient - Best-effort read of the PID stored in the file at
path.