cpu: change cfs_quota from u64 to i64

cfs_quota can be set to -1 to indicate no limit

Fixes: #5

Signed-off-by: bin liu <bin@hyper.sh>
This commit is contained in:
bin liu
2020-09-14 13:00:40 +08:00
parent d20e6a5383
commit f8d653e987
3 changed files with 166 additions and 20 deletions
+12
View File
@@ -768,3 +768,15 @@ pub fn libc_rmdir(p: &str) {
// with int return value
let _ = unsafe { libc::rmdir(p.as_ptr() as *const i8) };
}
/// read and parse an i64 data
pub fn read_i64_from(mut file: File) -> Result<i64> {
let mut string = String::new();
match file.read_to_string(&mut string) {
Ok(_) => string
.trim()
.parse()
.map_err(|e| Error::with_cause(ParseError, e)),
Err(e) => Err(Error::with_cause(ReadFailed, e)),
}
}