tracefile -p <pid>

This commit is contained in:
Ole Tange 2016-03-02 20:50:53 +01:00
parent 3a4d91432b
commit 845ee0e7ce
2 changed files with 8 additions and 0 deletions

View file

@ -13,6 +13,7 @@ if(not ($opt::exists or $opt::nonexists or $opt::all)) {
my @cmd = shell_quote(@ARGV); my @cmd = shell_quote(@ARGV);
my $dir = "."; my $dir = ".";
my $pid = $opt::pid ? "-p $pid" : "";
open(IN, "-|", "strace -ff -e trace=file @cmd 2>&1") || die; open(IN, "-|", "strace -ff -e trace=file @cmd 2>&1") || die;
while(<IN>) { while(<IN>) {
@ -49,6 +50,7 @@ sub options_hash {
"exists|exist|e" => \$opt::exists, "exists|exist|e" => \$opt::exists,
"nonexists|nonexist|non-exists|non-exist|n" => \$opt::nonexists, "nonexists|nonexist|non-exists|non-exist|n" => \$opt::nonexists,
"all|a" => \$opt::all, "all|a" => \$opt::all,
"pid|p=i" => $opt::pid,
); );
} }

View file

@ -8,6 +8,8 @@ tracefile - list files being accessed
B<tracefile> [-aenu] I<command> B<tracefile> [-aenu] I<command>
B<tracefile> [-aenu] -p I<pid>
=head1 DESCRIPTION =head1 DESCRIPTION
B<tracefile> will print the files being accessed by the command. B<tracefile> will print the files being accessed by the command.
@ -35,6 +37,10 @@ List only existing files.
List only non-existing files. List only non-existing files.
=item B<-p> I<pid>
Trace process id.
=item B<-u> =item B<-u>