For some cgroup file operations, when failed, add the path
and the value (for write operation) to the error message.
Fixes: #93
Signed-off-by: bin liu <liubin0329@gmail.com>
Add feature "serde" that derives all resource and statistics types from
Serialize and Deserialize. The feature is turned off by default.
Fixes#54Fixes#55Fixes#56
Signed-off-by: Felix Obenhuber <felix@obenhuber.de>
cargo-clippy has moved the upper_case_acronyms lint to
pedantic(removed from the default list), but we need
the lint to keep names consistent and follow the rust
naming conventions.
Signed-off-by: Tim Zhang <tim@hyper.sh>
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>
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>
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>
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>