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§
- Cgroup
Entry - An entry in /proc/self/cgroup
- Cgroup
V2 - The directory holding this process’s cgroup v2 interface files.
- Memory
Limit - 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).