mirror of
https://github.com/mii443/izoli.git
synced 2025-08-22 16:05:40 +00:00
add get_max_descendants
This commit is contained in:
@ -10,4 +10,6 @@ fn main() {
|
||||
println!("{:?}", cgroup.get_procs());
|
||||
println!("{:?}", cgroup.get_threads());
|
||||
println!("{:?}", cgroup.get_stat());
|
||||
println!("{:?}", cgroup.get_max_depth());
|
||||
println!("{:?}", cgroup.get_max_descendants());
|
||||
}
|
||||
|
@ -100,8 +100,19 @@ impl CGroup {
|
||||
}
|
||||
|
||||
pub fn get_max_depth(&self) -> Result<CGroupLimitValue<u64>, std::io::Error> {
|
||||
let max = self.read("cgroup.max.depth")?;
|
||||
self.get_limit_value("cgroup.max.depth")
|
||||
}
|
||||
|
||||
Ok(CGroupLimitValue::from_str(&max).unwrap())
|
||||
pub fn get_max_descendants(&self) -> Result<CGroupLimitValue<u64>, std::io::Error> {
|
||||
self.get_limit_value("cgroup.max.descendants")
|
||||
}
|
||||
|
||||
fn get_limit_value<T>(&self, name: &str) -> Result<CGroupLimitValue<T>, std::io::Error>
|
||||
where
|
||||
T: FromStr,
|
||||
{
|
||||
let value = self.read(name)?;
|
||||
|
||||
Ok(CGroupLimitValue::from_str(&value).unwrap())
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user