Documentation
¶
Overview ¶
Package proc contains utilities for checking processes via /proc.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUserBusy = errors.New("user is currently used by process")
ErrUserBusy is returned by CheckUserBusy if the user is currently used by a process.
Functions ¶
func CheckUserBusy ¶
CheckUserBusy checks if a user is currently running any processes.
It is a re-implementation of this user_busy_processes() function: https://github.com/shadow-maint/shadow/blob/e78742e553c12222b40b13224d3b0fafaceae791/lib/user_busy.c#L164-L272
It returns ErrUserBusy if the user has active processes, nil otherwise.
Types ¶
type Process ¶ added in v0.7.2
type Process struct {
// contains filtered or unexported fields
}
Process holds a kernel reference to one process, independent of PID reuse.
func OpenProcess ¶ added in v0.7.2
OpenProcess opens a pidfd for a local process. RPC callers must instead use the pidfd supplied by SO_PEERPIDFD.
func ProcessFromFile ¶ added in v0.7.2
ProcessFromFile takes ownership of a pidfd, including on error.
func (*Process) Clone ¶ added in v0.7.2
Clone opens a separate pidfd for the same live process. A separate open file description prevents systemd from deduplicating owners of different users.