change *limit* in memory from u64 to i64

Signed-off-by: bin liu <bin@hyper.sh>
This commit is contained in:
bin liu
2020-08-25 13:28:36 +08:00
parent c702852fd7
commit 9fe6cb58e4
21 changed files with 700 additions and 166 deletions

View File

@@ -23,6 +23,7 @@ use crate::{
pub struct CpuController {
base: PathBuf,
path: PathBuf,
v2: bool,
}
/// The current state of the control group and its processes.
@@ -51,6 +52,10 @@ impl ControllerInternal for CpuController {
&self.base
}
fn is_v2(&self) -> bool {
self.v2
}
fn apply(&self, res: &Resources) -> Result<()> {
// get the resources that apply to this controller
let res: &CpuResources = &res.cpu;
@@ -109,12 +114,15 @@ fn read_u64_from(mut file: File) -> Result<u64> {
impl CpuController {
/// Contructs a new `CpuController` with `oroot` serving as the root of the control group.
pub fn new(oroot: PathBuf) -> Self {
pub fn new(oroot: PathBuf, v2: bool) -> Self {
let mut root = oroot;
root.push(Self::controller_type().to_string());
if !v2 {
root.push(Self::controller_type().to_string());
}
Self {
base: root.clone(),
path: root,
v2: v2,
}
}