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)
| 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). |
| 28 | func 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) |
nothing calls this directly
no test coverage detected