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.

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.

Attach a task to the control group by thread group id.

Set notify_on_release to the control group.

Set release_agent

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

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

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

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.