MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / procStartToken

Function procStartToken

internal/cli/proc_start_linux.go:28–31  ·  view source on GitHub ↗

procStartToken returns a stable owner-identity token for a pid on Linux: the process's start time (field 22 of /proc/ /stat, in clock ticks since boot). It is constant for the life of a process and differs for a reused pid, so comparing it defeats the pid-reuse hazard the headless arm-state fall

(pid int)

Source from the content-addressed store, hash-verified

26// that follow are space-separated. State is the 3rd field overall (index
27// 0 after comm) and starttime is the 22nd (index 19 after comm).
28func procStartToken(pid int) (string, bool) {
29 tok, err := procStartTokenErr(pid)
30 return tok, err == nil
31}
32
33// procStartTokenErr is procStartToken with the failure preserved, so a
34// caller that must tell "this process is gone" (os.ErrNotExist, errProcZombie)

Callers

nothing calls this directly

Calls 1

procStartTokenErrFunction · 0.70

Tested by

no test coverage detected