Struct cgroups_rs::Cgroup [−][src]
pub struct Cgroup { /* fields omitted */ }
Expand description
A control group is the central structure to this crate.
What are control groups?
Lifting over from the Linux kernel sources:
Control Groups provide a mechanism for aggregating/partitioning sets of tasks, and all their future children, into hierarchical groups with specialized behaviour.
This crate is an attempt at providing a Rust-native way of managing these cgroups.
Implementations
Create a new control group in the hierarchy hier
, with name path
.
Returns a handle to the control group that can be used to manipulate it.
Create a new control group in the hierarchy hier
, with name path
and relative_paths
Returns a handle to the control group that can be used to manipulate it.
Note that this method is only meaningful for cgroup v1, call it is equivalent to call new
in the v2 mode
Create a handle for a control group in the hierarchy hier
, with name path
.
Returns a handle to the control group (that possibly does not exist until create()
has
been called on the cgroup.
Create a handle for a control group in the hierarchy hier
, with name path
and relative_paths
Returns a handle to the control group (that possibly does not exist until create()
has
been called on the cgroup.
Note that this method is only meaningful for cgroup v1, call it is equivalent to call load
in the v2 mode
The list of subsystems that this control group supports.
Deletes the control group.
Note that this function makes no effort in cleaning up the descendant and the underlying system call will fail if there are any descendants. Thus, one should check whether it was actually removed, and remove the descendants first if not. In the future, this behavior will change.
Apply a set of resource limits to the control group.
pub fn controller_of<'a, T>(&'a self) -> Option<&'a T> where
&'a T: From<&'a Subsystem>,
T: Controller + ControllIdentifier,
pub fn controller_of<'a, T>(&'a self) -> Option<&'a T> where
&'a T: From<&'a Subsystem>,
T: Controller + ControllIdentifier,
Retrieve a container based on type inference.
Example:
let pids: &PidController = control_group.controller_of()
.expect("No pids controller attached!");
let cpu: &CpuController = control_group.controller_of()
.expect("No cpu controller attached!");
Removes a task from the control group.
Note that this means that the task will be moved back to the root control group in the hierarchy and any rules applied to that control group will still apply to the task.
Attach a task to the control group by thread group id.
Set notify_on_release to the control group.
Set release_agent
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Cgroup
impl !UnwindSafe for Cgroup
Blanket Implementations
Mutably borrows from an owned value. Read more