Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Dec 2009 17:55:13 +0000 (GMT)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Xin LI <delphij@gmail.com>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dag-Erling Smorgrav <des@freebsd.org>
Subject:   Re: svn commit: r200779 - head/usr.bin/sockstat
Message-ID:  <alpine.BSF.2.00.0912211752080.73550@fledge.watson.org>
In-Reply-To: <a78074950912210936u63a183e4m76cadc70532e4878@mail.gmail.com>
References:  <200912211723.nBLHN4RR034528@svn.freebsd.org> <a78074950912210936u63a183e4m76cadc70532e4878@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--621616949-2080532969-1261418113=:73550
Content-Type: TEXT/PLAIN; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8BIT

On Mon, 21 Dec 2009, Xin LI wrote:

> On Mon, Dec 21, 2009 at 9:23 AM, Dag-Erling Smorgrav <des@freebsd.org> wrote:
>> Author: des
>> Date: Mon Dec 21 17:23:04 2009
>> New Revision: 200779
>> URL: http://svn.freebsd.org/changeset/base/200779
>>
>> Log:
>>  Note that sockstat(1) does not display kernel-owned sockets.
>
> Just curious - is this easily fixable?  (Perhaps not since sockstat(1) does 
> not use libkvm?)

Not really, and it's not 100% clear to me it's desirable to fix.  sockstat, 
fstat, and procstat work by walking the list of processes, and for each 
process, then walking its file descriptor table.  This means that a single 
socket may not appear if it's not in use by any process (as with nlm, NFS 
server, etc, where the sockets don't even have file descriptors), or it may 
appear multiple times (if it's in use by more than one process -- think apache 
listen sockets).  To list sockets that have no process linkage, you'd need to 
change its underlying model of operation, and right now we simply don't keep 
global lists of sockets (because global lists are expensive and unnecessary).

I'm actually not sure I consider this a bug, so perhaps the comment should be 
moved to the IMPLEMENTATION NOTES section.  The point of these tools is to 
generate lists by process.  netstat works in a completely different way, by 
walking the connection lists in the TCP/IP code, and therefore will list them, 
since they have full socket state at that layer.

Robert N M Watson
Computer Laboratory
University of Cambridge
--621616949-2080532969-1261418113=:73550--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.00.0912211752080.73550>