pub fn process_age(pid: u32) -> Option<Duration>Expand description
How long pid has been running: /proc/uptime (seconds since boot)
minus process_start_time (ticks since boot, converted to seconds
via the kernel’s own reported tick rate — never a hardcoded divisor).
This is the primitive reap_stray_candidates’ age floor (25-12/999.47,
the production half of the defect class) is built on: a process
discover_stray_devflow_processes catches mid-execve is genuinely
the same process with genuinely the same recorded start time as its
parent — is_same_process cannot distinguish the two — but its age
is sub-millisecond, while a genuine orphan is minutes to hours old.
reap_stray_candidates (devflow-cli::commands) is the one caller
that consumes this to make a signalling decision; see its own doc
comment for how the separation is used.
Returns None when age could not be determined at all: /proc/uptime
is unreadable or unparseable, the tick rate cannot be resolved, or
process_start_time itself returns None. Callers MUST treat None
as “do not act” — never as “old enough” — matching the fail-closed
posture process_start_time documents for identity.
A negative difference — the two clocks read microseconds apart — is clamped to zero rather than treated as an error: it is a rounding artefact, not evidence of anything, and zero keeps the fail-closed direction (an age of zero sits below any floor).