Expand description
Reads the state of the system: interface addresses, processes and mounts.
Structs§
- Addresses
- Formats interface addresses as
rmnet_data0 has 10.0.0.1, .... - Interface
Address - An IPv4 address of an interface.
Enums§
- Command
Error - Error of
run.
Constants§
- COMM_
LEN 🔒 - The kernel truncates
/proc/<pid>/commto this many bytes. - DEBUGFS
- Mount point of debugfs.
- RMNET_
PREFIX - Interfaces of data calls.
Functions§
- comm_
matches - Returns whether a
commvalue belongs to the programname. - exists
- Returns whether a path exists.
- for_
each_ 🔒process - Calls
fwith the PID and thecommvalue of every running process. - has_
ipv4 - Returns whether
interfacehas an IPv4 address that matcheswanted. - ipv4_
addresses - Returns the IPv4 addresses of interfaces whose name starts with
prefix. - is_
mounted - Returns whether
mounts(the content of/proc/mounts) has a file system ofkindattarget. - pids
- Returns the PIDs of the processes of the program
name. - process_
names - Returns the names of all running processes from
/proc/<pid>/comm. - run
- Runs a command and collects its output.
- run_
detached - Runs a command with stdin, stdout and stderr connected to
/dev/nulland returns its exit status.