Skip to main content

Module cgroup

Module cgroup 

Source
Expand description

Linux cgroup detection utilities.

NOTE: this module must stay free of non-std dependencies. It is compiled unconditionally, including into feature-reduced builds such as the wasm32 one, where mz_ore’s optional dependencies are absent. Reaching for tracing here breaks that build. Callers that want the resolved cgroup reported should log CgroupV2::path themselves.

Structs§

CgroupEntry
An entry in /proc/self/cgroup
CgroupV2
The directory holding this process’s cgroup v2 interface files.
MemoryLimit
Represents a cgroup memory limit, with both ram and swap maximums if they exist. Fields should be None if a limit does not exist or when running on a platform without cgroup support (ie: non-Linux platforms).
Mountinfo
An entry in /proc/self/mountinfo

Functions§

detect_memory_limit
Returns the cgroup (v1 or v2) memory limit if it exists.
parse_proc_self_cgroup
Parses /proc/self/cgroup into a Vec<CgroupEntry>, if the file exists.
parse_proc_self_mountinfo
Parses /proc/self/mountinfo into vectors of Mountinfo objects, returning (v2_mounts, v1_mounts).