From d88b3ea4da29b09b21de832096d3b2a6e45cce93 Mon Sep 17 00:00:00 2001 From: mii443 Date: Thu, 17 Oct 2024 07:58:12 +0000 Subject: [PATCH] add get_max_depth --- src/cgroup/cgroup.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cgroup/cgroup.rs b/src/cgroup/cgroup.rs index 8afbba8..f0af93a 100644 --- a/src/cgroup/cgroup.rs +++ b/src/cgroup/cgroup.rs @@ -5,7 +5,7 @@ use std::{ str::FromStr, }; -use super::{cgroup_stat::CGroupStat, controller::Controller}; +use super::{cgroup_stat::CGroupStat, controller::Controller, limit_value::CGroupLimitValue}; pub struct CGroup { pub path: PathBuf, @@ -98,4 +98,10 @@ impl CGroup { Ok(CGroupStat::from_str(&stat).unwrap()) } + + pub fn get_max_depth(&self) -> Result, std::io::Error> { + let max = self.read("cgroup.max.depth")?; + + Ok(CGroupLimitValue::from_str(&max).unwrap()) + } }