Struct cgroups::cgroup::Cgroup

source ·
pub struct Cgroup<'b> { /* private fields */ }
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.

Note that if the handle goes out of scope and is dropped, the control group is not destroyed.

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.

Note that if the handle goes out of scope and is dropped, the control group is not destroyed.

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.

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.

Returns an Iterator that can be used to iterate over the tasks that are currently in the control group.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.