Scan /proc/<pid>/cmdline for GC roots
This commit is contained in:
parent
769f662165
commit
194e3374b8
1 changed files with 8 additions and 4 deletions
|
@ -15,8 +15,6 @@ sub readProc {
|
||||||
|
|
||||||
my $process = "/proc/$name";
|
my $process = "/proc/$name";
|
||||||
|
|
||||||
#print STDERR "=== $process\n";
|
|
||||||
|
|
||||||
my $target;
|
my $target;
|
||||||
print "$target\n" if $target = readlink "$process/exe";
|
print "$target\n" if $target = readlink "$process/exe";
|
||||||
print "$target\n" if $target = readlink "$process/cwd";
|
print "$target\n" if $target = readlink "$process/cwd";
|
||||||
|
@ -38,11 +36,17 @@ sub readProc {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get all store paths that appear in the environment of this process.
|
# Get all store paths that appear in the environment of this process.
|
||||||
|
my $re = "\Q$Nix::Config::storeDir\E\/[0-9a-z]+[0-9a-zA-Z\+\-\._\?=]*";
|
||||||
eval {
|
eval {
|
||||||
my $env = Nix::Utils::readFile "$process/environ";
|
my $env = Nix::Utils::readFile "$process/environ";
|
||||||
my @matches = $env =~ /\Q$Nix::Config::storeDir\E\/[0-9a-z]+[0-9a-zA-Z\+\-\._\?=]*/g;
|
my @matches = $env =~ /$re/g;
|
||||||
print "$_\n" foreach @matches;
|
print "$_\n" foreach @matches;
|
||||||
}
|
};
|
||||||
|
eval {
|
||||||
|
my $cmdline = Nix::Utils::readFile "$process/cmdline";
|
||||||
|
my @matches = $cmdline =~ /$re/g;
|
||||||
|
print "$_\n" foreach @matches;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
closedir DIR;
|
closedir DIR;
|
||||||
|
|
Loading…
Reference in a new issue