mirror of
https://github.com/kata-containers/cgroups-rs.git
synced 2026-08-05 02:13:23 +00:00
change *limit* in memory from u64 to i64
Signed-off-by: bin liu <bin@hyper.sh>
This commit is contained in:
12
src/cpu.rs
12
src/cpu.rs
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user