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§
source§impl 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§
source§impl Clone for DevicesController
impl Clone for DevicesController
source§fn clone(&self) -> DevicesController
fn clone(&self) -> DevicesController
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for DevicesController
impl Debug for DevicesController
source§impl<'a> From<&'a Subsystem> for &'a DevicesController
impl<'a> From<&'a Subsystem> for &'a DevicesController
source§fn 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§
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
source§impl<T> Controller for Twhere
T: ControllerInternal,
impl<T> Controller for Twhere T: ControllerInternal,
source§fn 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.
source§fn 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.