pub struct FreezerController { /* private fields */ }
Expand description

A controller that allows controlling the freezer subsystem of a Cgroup.

In essence, this subsystem allows the user to freeze and thaw (== “un-freeze”) the processes in the control group. This is done transparently so that neither the parent, nor the children of the processes can observe the freeze.

Note that if the control group is currently in the Frozen or Freezing state, then no processes can be added to it.

Implementations§

source§

impl FreezerController

source

pub fn new(root: PathBuf, v2: bool) -> Self

Contructs a new FreezerController with root serving as the root of the control group.

source

pub fn freeze(&self) -> Result<()>

Freezes the processes in the control group.

source

pub fn thaw(&self) -> Result<()>

Thaws, that is, unfreezes the processes in the control group.

source

pub fn state(&self) -> Result<FreezerState>

Retrieve the state of processes in the control group.

Trait Implementations§

source§

impl Clone for FreezerController

source§

fn clone(&self) -> FreezerController

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for FreezerController

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> From<&'a Subsystem> for &'a FreezerController

source§

fn from(sub: &'a Subsystem) -> &'a FreezerController

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Controller for Twhere T: ControllerInternal,

source§

fn apply(&self, res: &Resources) -> Result<(), Error>

Apply a set of resources to the Controller, invoking its internal functions to pass the kernel the information.

source§

fn create(&self)

Create this controller

source§

fn set_notify_on_release(&self, enable: bool) -> Result<(), Error>

Set notify_on_release

source§

fn set_release_agent(&self, path: &str) -> Result<(), Error>

Set release_agent

source§

fn exists(&self) -> bool

Does this controller already exist?

source§

fn delete(&self) -> Result<(), Error>

Delete the controller.

source§

fn add_task(&self, pid: &CgroupPid) -> Result<(), Error>

Attach a task to this controller.

source§

fn add_task_by_tgid(&self, pid: &CgroupPid) -> Result<(), Error>

Attach a task to this controller by thread group id.

source§

fn procs(&self) -> Vec<CgroupPid, Global>

Get the list of procs that this controller has.

source§

fn tasks(&self) -> Vec<CgroupPid, Global>

Get the list of tasks that this controller has.

source§

fn set_cgroup_type(&self, cgroup_type: &str) -> Result<(), Error>

set cgroup.type

source§

fn get_cgroup_type(&self) -> Result<String, Error>

get cgroup.type

source§

fn control_type(&self) -> Controllers

source§

fn path(&self) -> &Path

The file system path to the controller.
source§

fn v2(&self) -> bool

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.