mirror of
https://github.com/mii443/izoli.git
synced 2025-08-22 16:05:40 +00:00
add get_procs
This commit is contained in:
@ -1,10 +1,10 @@
|
||||
use izolilib::cgroup::cgroup::CGroup;
|
||||
|
||||
fn main() {
|
||||
println!("test");
|
||||
let cgroup = CGroup::new("test").unwrap();
|
||||
println!("{:?}", cgroup.get_root_path());
|
||||
println!("{}", cgroup.check_status());
|
||||
println!("{:?}", cgroup.read("cgroup.type"));
|
||||
println!("{:?}", cgroup.get_controllers());
|
||||
println!("{:?}", cgroup.get_procs());
|
||||
}
|
||||
|
@ -66,4 +66,14 @@ impl CGroup {
|
||||
|
||||
Ok(controllers)
|
||||
}
|
||||
|
||||
pub fn get_procs(&self) -> Result<Vec<u32>, std::io::Error> {
|
||||
let procs = self
|
||||
.read("cgroup.procs")?
|
||||
.lines()
|
||||
.map(|proc| u32::from_str(proc.trim()).unwrap())
|
||||
.collect();
|
||||
|
||||
Ok(procs)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user