[padb-devel] [padb commit] r37 - Add a proc-shows-fds=full option to show the newly
codesite-noreply at google.com
codesite-noreply at google.com
Mon Jun 8 22:56:00 BST 2009
Author: apittman
Date: Mon Jun 8 14:55:12 2009
New Revision: 37
Modified:
trunk/src/padb
Log:
Add a proc-shows-fds=full option to show the newly
exported flags and pos info for all file descriptors.
Modified: trunk/src/padb
==============================================================================
--- trunk/src/padb (original)
+++ trunk/src/padb Mon Jun 8 14:55:12 2009
@@ -4774,11 +4774,40 @@
opendir( FDS, "$dir/fd" );
my @fds = readdir(FDS);
closedir(FDS);
+ my @all_fddata;
foreach my $fd (@fds) {
next if ( $fd eq "." );
next if ( $fd eq ".." );
my $target = readlink "$dir/fd/$fd";
- output $vp, "fd$fd: $target";
+
+ my %fdhash;
+ $fdhash{target} = $target;
+ $fdhash{fd} = $fd;
+
+ # New fdinfo data, it's verbose so only enable it
+ # if requested by -O proc-shows-fds=full
+ if ( $confInner{"proc-shows-fds"} eq "full" ) {
+ if ( -f "$dir/fdinfo/$fd" ) {
+ open( FDI, "$dir/fdinfo/$fd" );
+ my @fdi = (<FDI>);
+ close FDI;
+ foreach my $fdi (@fdi) {
+ chomp($fdi);
+ my ( $key, $value ) = split( ":", $fdi );
+ $value =~ s/\t//g;
+ $fdhash{$key} = $value;
+ }
+ }
+ }
+ push( @all_fddata, \%fdhash );
+ }
+ foreach my $fd (@all_fddata) {
+ if ( defined $fd->{pos} ) {
+ output( $vp,
+ "fd$fd->{fd}: $fd->{target} \($fd->{pos}
$fd->{flags}\)" );
+ } else {
+ output( $vp, "fd$fd->{fd}: $fd->{target}" );
+ }
}
}
if ( $confInner{"proc-shows-maps"} ) {
More information about the padb-devel
mailing list