Documentation
¶
Overview ¶
Package proc answers one question for the broker: "is the process that holds this claim still alive?" — the signal that lets a live holder's lease survive TTL expiry (so we never hand a busy agent's simulator to someone else) while a dead holder's lease is reclaimed immediately.
macOS notes baked in here (verified against darwin kill(2) / ps):
- os.FindProcess always "succeeds" on unix, so liveness must probe with signal 0: nil or EPERM => the pid exists, ESRCH => it's gone.
- A bare pid is reuse-prone (the OS recycles pids), so Alive also matches a start-time fingerprint captured at claim time. A recycled pid has a different start time and is correctly treated as dead.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Alive ¶
Alive reports whether pid is a live process matching fingerprint.
- pid <= 0 -> dead (no holder).
- pid gone (ESRCH) -> dead.
- pid exists, fingerprint == "" -> alive (we have nothing to verify against; erring toward "alive" is the safe choice — it never reclaims a possibly-live holder's device out from under it).
- pid exists, fingerprint set -> alive only if the current start time still matches (else the pid was reused -> dead).
func StartFingerprint ¶
StartFingerprint returns a stable per-process start-time string for pid, used to distinguish the original holder from a later process that reused its pid. On macOS this is `ps -o lstart=` (1-second granularity, e.g. "Sat May 31 01:23:45 2026"). An empty string + nil error is possible if ps returns nothing; callers treat an empty stored fingerprint as "unverifiable".
Types ¶
This section is empty.