[patch] sockstat output bad
Barry Pederson
bp at barryp.org
Sat Jul 17 08:33:57 PDT 2004
I noticed that the output of sockstat is bad in DFly 1.0 - looks like
the addition of the "CPU" column in the output of the "netstat" utility
is throwing sockstat off. For example, for sshd under "LOCAL ADDRESS"
you see "0" instead of "*:22"
I've attached a patch to the /usr/bin/sockstat Perl script that seems to
fix the problem.
Barry
--- sockstat.bad 2004-07-11 15:30:54.000000000 -0500
+++ sockstat 2004-07-14 17:56:54.000000000 -0500
@@ -109,11 +109,11 @@
foreach $fsd (@{$fstat{$af}}) {
next unless defined($fsd->[7]);
$nsd = $netstat{$fsd->[7]} || $unknown;
- next if (!$conn && $nsd->[5] ne '*.*');
- next if (!$listen && $nsd->[5] eq '*.*');
+ next if (!$conn && $nsd->[6] ne '*.*');
+ next if (!$listen && $nsd->[6] eq '*.*');
printf($inet_fmt, $fsd->[0], $fsd->[1], $fsd->[2],
substr($fsd->[3], 0, -1),
- $nsd->[1], addr($nsd->[4]), addr($nsd->[5]));
+ $nsd->[2], addr($nsd->[5]), addr($nsd->[6]));
}
print("\n");
}
@@ -137,11 +137,11 @@
foreach $fsd (@{$fstat{"local"}}) {
next unless defined($fsd->[6]);
next if (!$conn && defined($fsd->[8]));
- next if (!$listen && !defined($fsd->[8]));
+ next if (!$listen && !defined($fsd->[9]));
$nsd = $netstat{$fsd->[6]} || $unknown;
printf($unix_fmt, $fsd->[0], $fsd->[1], $fsd->[2],
substr($fsd->[3], 0, -1), $fsd->[5],
- $nsd->[8] || (($fsd->[8] && $endpoint{$fsd->[8]}) ? $endpoint{$fsd->[8]} : "(none)"));
+ $nsd->[9] || (($fsd->[8] && $endpoint{$fsd->[8]}) ? $endpoint{$fsd->[8]} : "(none)"));
}
print("\n");
}
More information about the Bugs
mailing list