line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
########################################### |
2
|
|
|
|
|
|
|
package Proc::Info::Environment::Linux; |
3
|
|
|
|
|
|
|
########################################### |
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
37
|
|
5
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
6
|
1
|
|
|
1
|
|
5
|
use base qw(Proc::Info::Environment); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
364
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
########################################### |
9
|
|
|
|
|
|
|
sub env { |
10
|
|
|
|
|
|
|
########################################### |
11
|
1
|
|
|
1
|
0
|
6
|
my($self, $pid) = @_; |
12
|
|
|
|
|
|
|
|
13
|
1
|
50
|
|
|
|
4
|
if(!defined $pid) { |
14
|
0
|
|
|
|
|
0
|
die "Variable \$pid not defined"; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
|
|
3
|
my $file = "/proc/$pid/environ"; |
18
|
|
|
|
|
|
|
|
19
|
1
|
50
|
|
|
|
48
|
if(! open FILE, "<$file") { |
20
|
0
|
|
|
|
|
0
|
$self->error( "Cannot open $file ($!)" ); |
21
|
0
|
|
|
|
|
0
|
return undef; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
5
|
local $/ = undef; |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
104
|
my $data = ; |
27
|
1
|
|
|
|
|
11
|
close FILE; |
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
|
|
2
|
my %found = (); |
30
|
|
|
|
|
|
|
|
31
|
1
|
|
|
|
|
10
|
for my $chunk (split /\0/, $data) { |
32
|
22
|
|
|
|
|
49
|
my($key, $value) = split /=/, $chunk, 2; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
###l4p DEBUG("Found in env of pid=$pid: key=$key value=$value"); |
35
|
|
|
|
|
|
|
|
36
|
22
|
|
|
|
|
56
|
$found{ $key } = $value; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
1
|
|
|
|
|
8
|
return \%found; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |