]> git.proxmox.com Git - pve-lxc-syscalld.git/blob - src/process/cgroups.rs
d8d88b3f4a33aa6d47f90f12170ac3717e549991
[pve-lxc-syscalld.git] / src / process / cgroups.rs
1 use std::collections::HashMap;
2 use std::ffi::{OsStr, OsString};
3
4 #[derive(Default)]
5 pub struct CGroups {
6 pub v1: HashMap<String, OsString>,
7 pub v2: Option<OsString>,
8 }
9
10 impl CGroups {
11 pub fn new() -> Self {
12 Self::default()
13 }
14
15 pub fn get(&self, name: &str) -> Option<&OsStr> {
16 self.v1.get(name).map(|s| s.as_os_str())
17 }
18
19 pub fn v2(&self) -> Option<&OsStr> {
20 self.v2.as_ref().map(|s| s.as_os_str())
21 }
22 }