add add_procs

This commit is contained in:
mii443
2024-10-17 08:43:23 +00:00
parent d725fccf92
commit 003fc66754

View File

@ -145,6 +145,18 @@ impl CGroup {
self.write_value("cgroup.max.descendants", max)
}
pub fn add_procs(&self, procs: Vec<u32>) -> Result<(), std::io::Error> {
let to_write = procs
.iter()
.map(|proc| proc.to_string())
.collect::<Vec<String>>()
.join("\n");
self.write("cgroup.procs", &to_write)?;
Ok(())
}
fn write_value<T>(&self, name: &str, value: T) -> Result<(), std::io::Error>
where
T: fmt::Display,