line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Eixo::Zone; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
18735
|
use 5.018002; |
|
1
|
|
|
|
|
4
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
341
|
use Eixo::Zone::Driver; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use Eixo::Zone::Starter; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my @NS = qw( |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
user |
13
|
|
|
|
|
|
|
pid |
14
|
|
|
|
|
|
|
net |
15
|
|
|
|
|
|
|
mnt |
16
|
|
|
|
|
|
|
uts |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub create{ |
21
|
|
|
|
|
|
|
my ($self, %args) = @_; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Eixo::Zone::Starter->init(%args); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# if we dont pass anything, a hash of flags is passed |
27
|
|
|
|
|
|
|
sub same_namespace{ |
28
|
|
|
|
|
|
|
my ($self, $pid1, $pid2, $namespace) = @_; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
$namespace = lc($namespace); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
kill(0, $pid1) || die("Eixo::Zone::same_namespace: pid1 ($pid1) doesn't exist"); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
kill(0, $pid2) || die("Eixo::Zone::same_namespace: pid1 ($pid2) doesn't exist"); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
unless(!$namespace || grep { $_ eq $namespace } @NS) { |
37
|
|
|
|
|
|
|
die("Eixo::Zone::same_namespace: $namespace unknown"); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
if($namespace){ |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
return $self->__same_namespace($pid1, $pid2, $namespace); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
my %same_namespace; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
foreach(@NS){ |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
$same_namespace{$_} = $self->__same_namespace($pid1, $pid2, $_); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub __same_namespace{ |
54
|
|
|
|
|
|
|
my ($self, $p1, $p2, $namespace) = @_; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
(stat("/proc/$p1/ns/$namespace"))[1] == (stat("/proc/$p2/ns/$namespace"))[1]; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
__END__ |