Struct cgroups_rs::devices::DevicesController
source · [−]pub struct DevicesController { /* private fields */ }Expand description
A controller that allows controlling the devices subsystem of a Cgroup.
In essence, using the devices controller, it is possible to allow or disallow sets of devices to be used by the control group’s tasks.
Implementations
sourceimpl DevicesController
impl DevicesController
sourcepub fn new(root: PathBuf) -> Self
pub fn new(root: PathBuf) -> Self
Constructs a new DevicesController with root serving as the root of the control group.
sourcepub fn allow_device(
&self,
devtype: DeviceType,
major: i64,
minor: i64,
perm: &[DevicePermissions]
) -> Result<()>
pub fn allow_device(
&self,
devtype: DeviceType,
major: i64,
minor: i64,
perm: &[DevicePermissions]
) -> Result<()>
Allow a (possibly, set of) device(s) to be used by the tasks in the control group.
When -1 is passed as major or minor, the kernel interprets that value as “any”,
meaning that it will match any device.
sourcepub fn deny_device(
&self,
devtype: DeviceType,
major: i64,
minor: i64,
perm: &[DevicePermissions]
) -> Result<()>
pub fn deny_device(
&self,
devtype: DeviceType,
major: i64,
minor: i64,
perm: &[DevicePermissions]
) -> Result<()>
Deny the control group’s tasks access to the devices covered by dev.
When -1 is passed as major or minor, the kernel interprets that value as “any”,
meaning that it will match any device.
sourcepub fn allowed_devices(&self) -> Result<Vec<DeviceResource>>
pub fn allowed_devices(&self) -> Result<Vec<DeviceResource>>
Get the current list of allowed devices.
Trait Implementations
sourceimpl Clone for DevicesController
impl Clone for DevicesController
sourcefn clone(&self) -> DevicesController
fn clone(&self) -> DevicesController
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresourceimpl Debug for DevicesController
impl Debug for DevicesController
sourceimpl<'a> From<&'a Subsystem> for &'a DevicesController
impl<'a> From<&'a Subsystem> for &'a DevicesController
sourcefn from(sub: &'a Subsystem) -> &'a DevicesController
fn from(sub: &'a Subsystem) -> &'a DevicesController
Auto Trait Implementations
impl RefUnwindSafe for DevicesController
impl Send for DevicesController
impl Sync for DevicesController
impl Unpin for DevicesController
impl UnwindSafe for DevicesController
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<T> Controller for Twhere
T: ControllerInternal,
impl<T> Controller for Twhere
T: ControllerInternal,
sourcefn apply(&self, res: &Resources) -> Result<(), Error>
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.
sourcefn add_task_by_tgid(&self, pid: &CgroupPid) -> Result<(), Error>
fn add_task_by_tgid(&self, pid: &CgroupPid) -> Result<(), Error>
Attach a task to this controller by thread group id.
sourcefn tasks(&self) -> Vec<CgroupPid, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
fn tasks(&self) -> Vec<CgroupPid, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
Get the list of tasks that this controller has.