File Coverage

lib/Mojo/IOLoop/ReadWriteProcess/CGroup/v1/Devices.pm
Criterion Covered Total %
statement 8 8 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 0 2 0.0
total 12 14 85.7


line stmt bran cond sub pod time code
1             package Mojo::IOLoop::ReadWriteProcess::CGroup::v1::Devices;
2              
3 15     15   110 use Mojo::Base -base;
  15         29  
  15         95  
4              
5             use constant {
6 15         3098 DEVICES_ALLOW_INTERFACE => 'devices.allow',
7             DEVICES_DENY_INTERFACE => 'devices.deny'
8 15     15   2546 };
  15         18  
9              
10             has cgroup => sub { Mojo::IOLoop::ReadWriteProcess::CGroup::v1->new };
11              
12 1     1 0 8 sub allow { shift->cgroup->_write(DEVICES_ALLOW_INTERFACE, @_) }
13 1     1 0 10 sub deny { shift->cgroup->_write(DEVICES_DENY_INTERFACE, @_) }
14              
15             1;
16              
17             =encoding utf-8
18              
19             =head1 NAME
20              
21             Mojo::IOLoop::ReadWriteProcess::CGroup::v1::Devices - CGroups v1 Devices Controller.
22              
23             =head1 SYNOPSIS
24              
25             use Mojo::IOLoop::ReadWriteProcess::CGroup::v1;
26              
27             my $cgroup = Mojo::IOLoop::ReadWriteProcess::CGroup::v1->new( name => "test" );
28              
29             $cgroup->devices->allow('a *:* rwm');
30              
31             =head1 DESCRIPTION
32              
33             This module uses features that are only available on Linux,
34             and requires cgroups and capability for unshare syscalls to achieve pid isolation.
35              
36             =head1 METHODS
37              
38             L inherits all methods from L and implements
39             the following new ones.
40              
41             =head1 LICENSE
42              
43             Copyright (C) Ettore Di Giacinto.
44              
45             This library is free software; you can redistribute it and/or modify
46             it under the same terms as Perl itself.
47              
48             =head1 AUTHOR
49              
50             Ettore Di Giacinto Eedigiacinto@suse.comE
51              
52             =cut