add get file path

This commit is contained in:
mii443
2024-10-17 01:37:49 +00:00
parent 09ff168cea
commit 30d21769a3

View File

@ -31,10 +31,15 @@ impl CGroup {
root.exists() && root.is_dir()
}
pub fn get_file_path(&self, name: &str) -> PathBuf {
let root = self.get_root_path();
root.join(name)
}
pub fn get_root_path(&self) -> PathBuf {
let cgroup_root = PathBuf::from("/sys/fs/cgroup/");
let root = cgroup_root.join(&self.path);
root
cgroup_root.join(&self.path)
}
}