Skip to main content

Module process

Module process 

Source

Structs§

NameMatches
Result of find_by_name_for_uid: matches owned by the requested uid, plus a count of matches owned by other users (so the caller can tell “no such process” apart from “that process belongs to someone else”).
ProcessGroup
Extended process info with grouping information
ProcessInfo
Basic process info
StatusFields
The fields of /proc//status this crate cares about.

Functions§

current_uid
The calling process’s real uid.
find_all_by_executable
Find all processes matching an executable name (all instances)
find_by_name
Find all PIDs matching a process name
find_by_name_for_uid
Find all PIDs matching name, split by ownership. Only errors (ProcessNameNotFound) when there are no matches at all, own-uid or otherwise.
find_process_tree
Find all processes that share the same parent process tree Returns processes that are descendants of the given PID
group_by_executable
Group processes by executable path (same application)
group_by_session
Group processes by session ID (same process group)
list_all
List all running processes with extended information
list_for_uid
List processes owned by uid. A cheap stat() pre-filter (comparing the /proc/<pid> directory’s owning uid) skips reading any file belonging to another user’s process before read_process opens status/stat/exe.
parse_cgroup_v2
Parse the v2 line of /proc//cgroup (“0::”). Hybrid-mode lines for other controllers are noise and skipped.
parse_status
Parse /proc/<pid>/status.
read_process
Read the full ProcessInfo snapshot for one pid. status is required (its Uid:/Name: fields anchor the snapshot); stat, exe, and cgroup are each best-effort and simply left at their default/None if unreadable (e.g. the process exited mid-read, or exe requires permissions we don’t have). Returns None only if status can’t be read or parsed.