This crate provides to an interface into the linux
procfs filesystem, usually mounted at
This is a pseudo-filesystem which is available on most every linux system and provides an interface to kernel data structures.
Not all fields/data are available in each kernel. Some fields were added in specific kernel
releases, and other fields are only present in certain kernel configuration options are
enabled. These are represented as
Option fields in this crate.
This crate aims to support all 2.6 kernels (and newer). WSL2 is also supported.
In almost all cases, the documentation is taken from the
proc.5 manual page. This means that
sometimes the style of writing is not very "rusty", or may do things like reference related files
(instead of referencing related structs). Contributions to improve this are welcome.
While previous versions of the library could panic, this current version aims to be panic-free
in a many situations as possible. Whenever the procfs crate encounters a bug in its own
parsing code, it will return an
InternalError error. This should be considered a
bug and should be reported. If you encounter a panic,
please report that as well.
The following cargo features are available:
chrono-- Default. Optional. This feature enables a few methods that return values as
backtrace-- Optional. This feature lets you get a stack trace whenever an
Examples can be found in the various modules shown below, or in the examples folder of the code repository.
Functions related to the in-kernel key management and retention facility
Information about the networking layer.
Functions and structs related to process information
Sysctl is a means of configuring certain aspects of the kernel at run-time,
Container group controller information.
Represents the data from
CPU pressure information
The amount of time, measured in ticks, the CPU has been in specific states
Disk IO stat information
An internal error in the procfs crate
IO pressure information
Details about a loaded kernel module
Kernel/system statistics, from
Load average figures.
Details about an individual file lock
This struct reports statistics about memory usage on the system, based on
Memory pressure information
Pressure stall information for either CPU, memory, or IO.
Information about a process cgroup
Possible values for a kernel config option
The kind of a lock (read or write)
The mode of a lock (advisory or mandatory)
The type of a file lock
The various error conditions in the procfs crate.
The boot time of the system, as a
The boottime of the system, in seconds since the epoch
Information about the cgroup controllers that are compiled into the kernel
Get disk IO stat info from /proc/diskstats
Returns a configuration options used to build the currently running kernel
Get a list of current file locks and leases
Get a list of loaded kernel modules
Memory page size, in bytes.
Return the number of ticks per second.
Get various virtual memory statistics
The main error type for the procfs crate.