mirror of
https://github.com/mii443/izoli.git
synced 2025-08-22 16:05:40 +00:00
add get_subtree_control
This commit is contained in:
@ -6,6 +6,7 @@ fn main() {
|
|||||||
println!("{}", cgroup.check_status());
|
println!("{}", cgroup.check_status());
|
||||||
println!("{:?}", cgroup.read("cgroup.type"));
|
println!("{:?}", cgroup.read("cgroup.type"));
|
||||||
println!("{:?}", cgroup.get_controllers());
|
println!("{:?}", cgroup.get_controllers());
|
||||||
|
println!("{:?}", cgroup.get_subtree_control());
|
||||||
println!("{:?}", cgroup.get_procs());
|
println!("{:?}", cgroup.get_procs());
|
||||||
println!("{:?}", cgroup.get_stat());
|
println!("{:?}", cgroup.get_stat());
|
||||||
}
|
}
|
||||||
|
@ -57,8 +57,16 @@ impl CGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_controllers(&self) -> Result<Vec<Controller>, std::io::Error> {
|
pub fn get_controllers(&self) -> Result<Vec<Controller>, std::io::Error> {
|
||||||
|
self.inner_get_controllers("cgroup.controllers")
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_subtree_control(&self) -> Result<Vec<Controller>, std::io::Error> {
|
||||||
|
self.inner_get_controllers("cgroup.subtree_control")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn inner_get_controllers(&self, name: &str) -> Result<Vec<Controller>, std::io::Error> {
|
||||||
let controllers = self
|
let controllers = self
|
||||||
.read("cgroup.controllers")?
|
.read(name)?
|
||||||
.trim()
|
.trim()
|
||||||
.split(" ")
|
.split(" ")
|
||||||
.map(|controller| Controller::from_str(controller).unwrap_or(Controller::Unknown))
|
.map(|controller| Controller::from_str(controller).unwrap_or(Controller::Unknown))
|
||||||
|
Reference in New Issue
Block a user