CgroupOps

Trait CgroupOps 

Source
pub trait CgroupOps:
    Send
    + Sync
    + 'static {
    // Required methods
    fn id(&self) -> u64;
    fn add_process(
        &self,
        locked: &mut Locked<FileOpsCore>,
        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 get_freezer_state(&self) -> CgroupFreezerState;
    fn freeze(&self, locked: &mut Locked<FileOpsCore>);
    fn thaw(&self);
}
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, locked: &mut Locked<FileOpsCore>, 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 get_freezer_state(&self) -> CgroupFreezerState

Get the freezer self state and effective state.

Source

fn freeze(&self, locked: &mut Locked<FileOpsCore>)

Freeze all tasks in the cgroup.

Source

fn thaw(&self)

Thaw all tasks in the cgroup.

Implementors§