pub struct CgroupRoot {
pub hierarchy_id: u32,
pub controllers: BTreeSet<ControllerType>,
/* private fields */
}Expand description
CgroupRoot is the root of the cgroup hierarchy. The root cgroup is different from the rest of
the cgroups in a cgroup hierarchy (sub-cgroups of the root) in a few ways:
-
The root contains all known processes on cgroup creation, and all new processes as they are spawned. As such, the root cgroup reports processes belonging to it differently than its sub-cgroups.
-
The root does not contain resource controller interface files, as otherwise they would apply to the whole system.
-
The root does not own a
FsNodeas it is created and owned by theFileSysteminstead.
Fields§
§hierarchy_id: u32The ID of this hierarchy. 0 is reserved for cgroup v2.
controllers: BTreeSet<ControllerType>Controllers supported by this hierarchy.
Implementations§
Source§impl CgroupRoot
impl CgroupRoot
pub fn new( hierarchy_id: u32, controllers: BTreeSet<ControllerType>, ) -> Arc<CgroupRoot> ⓘ
pub fn has_controller(&self, controller: ControllerType) -> bool
pub fn get_cgroup<TG: Copy + Into<ThreadGroupKey>>( &self, tg: TG, ) -> Option<Weak<Cgroup>>
pub fn get_cgroup_inspect(&self) -> Inspector
Trait Implementations§
Source§impl CgroupOps for CgroupRoot
impl CgroupOps for CgroupRoot
Source§fn add_process(&self, thread_group: &ThreadGroup) -> Result<(), Errno>
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>
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_child(&self, name: &FsStr) -> Result<CgroupHandle, Errno>
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>
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_children(&self) -> Result<Vec<CgroupHandle>, Errno>
fn get_children(&self) -> Result<Vec<CgroupHandle>, Errno>
Gets all children of this cgroup.
Source§fn get_pids(&self, kernel: &Kernel) -> Vec<pid_t> ⓘ
fn get_pids(&self, kernel: &Kernel) -> Vec<pid_t> ⓘ
Return all pids that belong to this cgroup.
Source§fn is_populated(&self) -> bool
fn is_populated(&self) -> bool
Whether the cgroup or any of its descendants have any processes.
Source§fn freezer(&self) -> Option<&dyn FreezerOps>
fn freezer(&self) -> Option<&dyn FreezerOps>
Returns freezer ops if freezer controller is supported.
Source§impl CpusetOps for CgroupRoot
impl CpusetOps for CgroupRoot
Source§fn cpuset_cpus(&self) -> Vec<u32>
fn cpuset_cpus(&self) -> Vec<u32>
Returns the cpuset cpus of the cgroup.
Source§fn set_cpuset_cpus(&self, _cpus: Vec<u32>)
fn set_cpuset_cpus(&self, _cpus: Vec<u32>)
Sets the cpuset cpus of the cgroup.
Auto Trait Implementations§
impl !Freeze for CgroupRoot
impl !RefUnwindSafe for CgroupRoot
impl !UnwindSafe for CgroupRoot
impl Send for CgroupRoot
impl Sync for CgroupRoot
impl Unpin for CgroupRoot
impl UnsafeUnpin for CgroupRoot
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
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
fn fidl_into_native(self) -> Box<N>
§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
Converts the given service transport handle of type
T to [Self]Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more