Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ReadProcStat = defaultReadProcStat
ReadProcStat reads /proc/<pid>/stat for pid on Linux. Tests may replace it to simulate zombie or dead processes without spawning one.
Functions ¶
func Alive ¶
Alive reports whether pid refers to a process that is live or cannot be proved absent. Only non-positive PIDs, ESRCH, and Linux zombie/dead states (Z/X) report false; EPERM and other probe errors report true.
func Probe ¶
Probe checks whether pid refers to a live process on Unix.
It returns syscall.ESRCH when pid <= 0, when kill(pid, 0) returns ESRCH, or when /proc/<pid>/stat reports state Z (zombie) or X (dead). Otherwise it returns the kill(pid, 0) result (nil when alive, syscall.EPERM when owned by another user, or any other kernel error). If /proc/<pid>/stat is unreadable or unparseable, Probe falls back to the kill(pid, 0) result.
Types ¶
This section is empty.