Documentation
¶
Overview ¶
Package procinventory reads process identities from procfs for the acceptance harnesses, which observe what an installed candidate started before they may repair anything themselves.
Listing processes and reading their per-process files are separate steps, so a process can exit in between: ESRCH and ENOENT both mean "already exited" and count as an absence rather than a failed observation. Only processes still present when an inventory completes are reported, so a caller's ownership assertions apply to survivors alone.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Descendants ¶
Descendants lists the PIDs procfs reports as children of pid across all of its threads. A thread, or the whole process, that exits while the lists are read contributes nothing instead of failing the listing. The PIDs are the ones procfs reported; any of them may have exited by the time a caller reads them, which Read then reports through Exited.
func Exited ¶
Exited reports whether err means the process was already gone when it was read, rather than a failure of the observation itself.
Types ¶
type Process ¶
type Process struct {
PID int `json:"pid"`
Parent int `json:"parent_pid"`
Group int `json:"group"`
Start string `json:"start_ticks"`
Executable string `json:"executable"`
Command string `json:"command"`
Arguments []string `json:"arguments,omitempty"`
State string `json:"state"`
}
Process is one process as procfs reported it. Start is the start time in clock ticks, which separates a live process from a later reuse of its PID, and State is the single-letter state from stat.
func Inventory ¶
Inventory reads every PID in pids and reports, in the order given, the processes still present when it completed; every read failure that does not mean "already exited" is reported. Each identity comes from the confirming read, so a caller holding an earlier one can still recognize a reused PID.