pub enum Adoption {
Live,
Gone,
PidRecycled {
current: ProcessIdentity,
},
}Expand description
What a recorded ProcessIdentity turns out to refer to now.
§One journal entry can answer differently on different platforms
For a PID now held by another account’s process, Linux answers
Adoption::PidRecycled while macOS and Windows answer
ProcessError::Identity: /proc/<pid>/stat is world-readable, whereas
proc_pidinfo and OpenProcess refuse an inspection this account is not
entitled to. So the same journal entry, read back after the agent’s service
account has been changed, is a recycled PID on one platform and an error on
the other two. e3 branches on this, and should treat the error as the same
decision as PidRecycled — do not adopt, do not terminate — rather than
as a platform bug.
Variants§
Live
The same process is still running. Adopt it; do not start a replacement.
Gone
Nothing holds the PID. The process is gone and its attempt is terminal.
PidRecycled
Something holds the PID, but it is not the recorded process.
Distinct from Adoption::Gone on purpose. The recorded process is
equally gone in both cases, but here there is a stranger at that PID,
and treating this as Gone is one refactor away from treating it as
Live — which is how an agent terminates somebody else’s process.
Fields
current: ProcessIdentityWhoever holds the PID now.