Tim Zhang
9ec1010a15
Fix clippy warnings
...
Fix clippy warnings.
Signed-off-by: Tim Zhang <tim@hyper.sh >
2021-03-03 13:44:29 +08:00
LiYa'nan
033fa4b857
optimize and refactor: read_to_string and read_i[u]64_from
...
There's so many Duplicated read_string_from method in different
subsystem's implementation, so as read_u64_from/read_i64_from methods.
(1) Move the read_string_from method into `lib.rs`,
called by each subsystem implementation as needed.
(2) Refactor read_u[i]64_from method with the help Rust Generic f
unction `read_from` and wrapped by read_u64_from or read_i64_from.
fix : #20
Signed-off-by: LiYa'nan <oliverliyn@gmail.com >
2020-12-24 09:25:00 +08:00
Tim Zhang
1f188be405
Detect subsystems and get root from /proc/self/mountinfo
...
Delete check_support and stop detecting subsystems by finding in the
root folders because the detecting method is not accurate.
Signed-off-by: Tim Zhang <tim@hyper.sh >
2020-12-17 17:56:46 +08:00
Tim Zhang
567cdb43b3
Use Option as resource fields, remove the update switch: update_values
...
Use idiomatic Option::None to represent optional fields.
This enables updates where not all fields need to be specified.
Signed-off-by: Tim Zhang <tim@hyper.sh >
2020-12-17 17:56:41 +08:00
Tim Zhang
0c18b0855e
Support customized attributes for CpuController and MemController
...
Customized attributes are useful for customized kernels.
Usage:
let resource = &mut cgroups::Resources::default();
resource.cpu.attrs.insert("cpu.cfs_init_buffer_us", "10".to_string());
// apply here
Signed-off-by: Tim Zhang <tim@hyper.sh >
2020-12-17 16:45:41 +08:00
bin liu
152af17f8f
fix build warnings
...
And in Travis CI, treat warnings as error
to keep from merging codes with warning.
Fixes : #13
Signed-off-by: bin liu <bin@hyper.sh >
2020-09-23 16:19:51 +08:00
bin liu
f8d653e987
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 >
2020-09-14 13:00:43 +08:00
bin liu
250ada183a
cargo fmt
...
Signed-off-by: bin liu <bin@hyper.sh >
2020-09-09 16:42:55 +08:00
bin liu
ff6a0ea82a
add SPDX-License-Identifier for modified files
...
Signed-off-by: bin liu <bin@hyper.sh >
2020-09-09 13:35:46 +08:00
bin liu
bcbf438823
Merge remote-tracking branch 'upstream/master'
2020-09-09 13:27:12 +08:00
bin liu
86b245076c
add SPDX-License-Identifier for all source
...
Add SPDX-License-Identifier for all existing codes.
Fixes : #2
Signed-off-by: bin liu <bin@hyper.sh >
2020-09-07 20:29:40 +08:00
bin liu
cd2c748a74
add systemd controller; add more tests; update blkio stat for v2
...
Signed-off-by: bin liu <bin@hyper.sh >
2020-09-07 14:18:41 +08:00
bin liu
c623dc3fba
add basic v2 cpu/memory functions
...
Signed-off-by: bin liu <bin@hyper.sh >
2020-09-02 22:03:11 +08:00
bin liu
9fe6cb58e4
change *limit* in memory from u64 to i64
...
Signed-off-by: bin liu <bin@hyper.sh >
2020-08-27 23:06:44 +08:00
Levente Kurusa
01a3c22829
Transition to Rust 2018
...
Signed-off-by: Levente Kurusa <lkurusa@acm.org >
2018-12-23 16:31:05 +01:00
Sam Wilson
c63dad411b
Hide most of the previously undocumented methods in a sealed trait
2018-10-12 09:49:52 +02:00
Sam Wilson
7826b798bd
Implement ::std::error::Error
2018-10-12 09:49:52 +02:00
Hidehito Yabuuchi
adc3323be4
Replace '/*' style comments with '//' style, which is recommended officially
2018-10-06 18:05:59 +02:00
Hidehito Yabuuchi
2149e1c0c4
Run rustfmt
2018-10-06 18:05:59 +02:00
Hidehito Yabuuchi
5660656e3a
Use self short-hand
2018-10-01 11:56:12 +02:00
Levente Kurusa
0e350463a1
controllers: verify that resource application went ok or not
...
Signed-off-by: Levente Kurusa <lkurusa@acm.org >
2018-09-14 15:59:29 +02:00
Levente Kurusa
c82a94b58e
tree: add some simple error reporting
...
There's still plenty to wish for.
Signed-off-by: Levente Kurusa <lkurusa@acm.org >
2018-09-03 00:11:33 +02:00
Levente Kurusa
6ef19363be
cpu,cpuacct,cpuset: add first docs
...
Signed-off-by: Levente Kurusa <lkurusa@acm.org >
2018-08-28 18:41:37 +02:00
Levente Kurusa
9162c5a6ad
Initial work
...
Signed-off-by: Levente Kurusa <lkurusa@acm.org >
2018-08-28 14:52:23 +02:00