Skip to main content

Module system

Module system 

Source
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, ....
InterfaceAddress
An IPv4 address of an interface.

Enums§

CommandError
Error of run.

Constants§

COMM_LEN 🔒
The kernel truncates /proc/<pid>/comm to this many bytes.
DEBUGFS
Mount point of debugfs.
RMNET_PREFIX
Interfaces of data calls.

Functions§

comm_matches
Returns whether a comm value belongs to the program name.
exists
Returns whether a path exists.
for_each_process 🔒
Calls f with the PID and the comm value of every running process.
has_ipv4
Returns whether interface has an IPv4 address that matches wanted.
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 of kind at target.
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/null and returns its exit status.