This commit is contained in:
MeiK 2020-03-23 19:20:39 +08:00
parent efed729ce8
commit 97a37345cd
2 changed files with 30 additions and 6 deletions

21
src/cgroup.rs Normal file
View File

@ -0,0 +1,21 @@
use std::result;
#[derive(Debug)]
pub enum Error {
Error(String),
}
pub type Result<T> = result::Result<T, Error>;
pub struct Cgroup {
pid: u32
}
impl Cgroup {
pub fn new(pid: u32) -> Result<Self> {
return Ok(Cgroup { pid });
}
pub fn attach(&self) -> Result<()> {
return Ok(());
}
}

View File

@ -1,15 +1,18 @@
extern crate libc;
mod cgroup;
use std::process::{Command, Stdio}; use std::process::{Command, Stdio};
use std::process;
use std::io::Read; use std::io::Read;
use libc;
use libc::{time_t, suseconds_t, c_long}; use libc::{time_t, suseconds_t, c_long};
fn main() { fn main() {
run(); run();
cgroup(); match cgroup::Cgroup::new(process::id()) {
} Ok(_) => println!("Hello World!"),
Err(e) => println!("{:?}", e),
fn cgroup() { }
println!("cgroup");
} }
fn run() { fn run() {