pub struct Cgroup { /* private fields */ }Expand description
Cgroup v2 manager
Implements the cgroup lifecycle state machine from Nucleus_Resources_CgroupLifecycle.tla
Implementations§
Source§impl Cgroup
impl Cgroup
Sourcepub fn create(name: &str) -> Result<Self>
pub fn create(name: &str) -> Result<Self>
Create a new cgroup with the given name
State transition: Nonexistent -> Created
Sourcepub fn set_limits(&mut self, limits: &ResourceLimits) -> Result<()>
pub fn set_limits(&mut self, limits: &ResourceLimits) -> Result<()>
Set resource limits
State transition: Created -> Configured
Sourcepub fn attach_process(&mut self, pid: u32) -> Result<()>
pub fn attach_process(&mut self, pid: u32) -> Result<()>
Attach a process to this cgroup
State transition: Configured -> Attached
Sourcepub fn memory_current(&self) -> Result<u64>
pub fn memory_current(&self) -> Result<u64>
Get current memory usage
Sourcepub fn state(&self) -> CgroupState
pub fn state(&self) -> CgroupState
Get the current state of this cgroup
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Cgroup
impl RefUnwindSafe for Cgroup
impl Send for Cgroup
impl Sync for Cgroup
impl Unpin for Cgroup
impl UnsafeUnpin for Cgroup
impl UnwindSafe for Cgroup
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more