[patch] sockstat output bad

Matthew Dillon dillon at apollo.backplane.com
Sat Jul 17 16:25:04 PDT 2004


    There is no "CPU" column in the sockstat that is in the DragonFly
    source tree.  Are you sure this is DragonFly source you are looking
    at?

					-Matt
					Matthew Dillon 
					<dillon at xxxxxxxxxxxxx>


: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
:
:
:--------------000805000308060906060404
:Content-Type: text/plain;
: name="sockstat.patch"
:Content-Transfer-Encoding: 7bit
:Content-Disposition: inline;
: filename="sockstat.patch"
:
:--- 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