Parses /proc/self/mountinfo into vectors of Mountinfo objects, returning (v2_mounts, v1_mounts).
()
| 144 | /// Parses /proc/self/mountinfo into vectors of Mountinfo objects, |
| 145 | /// returning (v2_mounts, v1_mounts). |
| 146 | fn parse_proc_self_mountinfo() -> Option<(Vec<MountInfo>, Vec<MountInfo>)> { |
| 147 | let file = File::open("/proc/self/mountinfo").ok()?; |
| 148 | let file = BufReader::new(file); |
| 149 | Some( |
| 150 | file.lines() |
| 151 | .map_while(Result::ok) |
| 152 | .filter_map(MountInfo::from_line) |
| 153 | .filter(|mi| mi.fs_type == "cgroup" || mi.fs_type == "cgroup2") |
| 154 | .partition(|mi| mi.fs_type == "cgroup2"), |
| 155 | ) |
| 156 | } |
| 157 | |
| 158 | /// Represents a cgroup limits, with both memory and swap maximums if they |
| 159 | /// exist. |
no test coverage detected