mirror of
https://github.com/mii443/izoli.git
synced 2025-08-22 16:05:40 +00:00
add cgroup enter
This commit is contained in:
@ -12,4 +12,6 @@ fn main() {
|
||||
println!("{:?}", cgroup.get_stat());
|
||||
println!("{:?}", cgroup.get_max_depth());
|
||||
println!("{:?}", cgroup.get_max_descendants());
|
||||
|
||||
cgroup.enter().unwrap();
|
||||
}
|
||||
|
@ -30,6 +30,12 @@ impl CGroup {
|
||||
fs::create_dir_all(root)
|
||||
}
|
||||
|
||||
pub fn enter(&self) -> Result<(), std::io::Error> {
|
||||
let pid = std::process::id();
|
||||
|
||||
self.add_procs(vec![pid])
|
||||
}
|
||||
|
||||
pub fn read(&self, name: &str) -> Result<String, std::io::Error> {
|
||||
let path = self.get_file_path(name);
|
||||
let mut file = File::open(path)?;
|
||||
|
Reference in New Issue
Block a user