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 Freeze for DevicesController
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.