Skip to main content

CgroupOps

Trait CgroupOps 

Source
pub trait CgroupOps:
    Send
    + Sync
    + 'static {
    // Required methods
    fn id(&self) -> u64;
    fn add_process(&self, thread_group: &ThreadGroup) -> Result<(), Errno>;
    fn new_child(&self, name: &FsStr) -> Result<CgroupHandle, Errno>;
    fn get_children(&self) -> Result<Vec<CgroupHandle>, Errno>;
    fn get_child(&self, name: &FsStr) -> Result<CgroupHandle, Errno>;
    fn remove_child(&self, name: &FsStr) -> Result<CgroupHandle, Errno>;
    fn get_pids(&self, kernel: &Kernel) -> Vec<pid_t> ;
    fn kill(&self);
    fn is_populated(&self) -> bool;
    fn freezer(&self) -> Option<&dyn FreezerOps>;
    fn cpuset(&self) -> Option<&dyn CpusetOps>;
}
Expand description

Common operations of all cgroups.

Required Methods§

Source

fn id(&self) -> u64

Returns the unique ID of the cgroup. ID of root cgroup is 0.

Source

fn add_process(&self, thread_group: &ThreadGroup) -> Result<(), Errno>

Add a process to a cgroup. Errors if the cgroup has been deleted.

Source

fn new_child(&self, name: &FsStr) -> Result<CgroupHandle, Errno>

Create a new sub-cgroup as a child of this cgroup. Errors if the cgroup is deleted, or a child with name already exists.

Source

fn get_children(&self) -> Result<Vec<CgroupHandle>, Errno>

Gets all children of this cgroup.

Source

fn get_child(&self, name: &FsStr) -> Result<CgroupHandle, Errno>

Gets the child with name, errors if not found.

Source

fn remove_child(&self, name: &FsStr) -> Result<CgroupHandle, Errno>

Remove a child from this cgroup and return it, if found. Errors if cgroup is deleted, or a child with name is not found.

Source

fn get_pids(&self, kernel: &Kernel) -> Vec<pid_t>

Return all pids that belong to this cgroup.

Source

fn kill(&self)

Kills all processes in the cgroup and its descendants.

Source

fn is_populated(&self) -> bool

Whether the cgroup or any of its descendants have any processes.

Source

fn freezer(&self) -> Option<&dyn FreezerOps>

Returns freezer ops if freezer controller is supported.

Source

fn cpuset(&self) -> Option<&dyn CpusetOps>

Returns cpuset ops if cpuset controller is supported.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§