bin/164081: sockstat not reporting all open sockets

Jilles Tjoelker jilles at stack.nl
Sat Jan 14 00:10:17 UTC 2012


The following reply was made to PR bin/164081; it has been noted by GNATS.

From: Jilles Tjoelker <jilles at stack.nl>
To: bug-followup at FreeBSD.org, pirzyk at FreeBSD.org
Cc:  
Subject: Re: bin/164081: sockstat not reporting all open sockets
Date: Sat, 14 Jan 2012 01:03:34 +0100

 > [netstat reports sockets that sockstat does not]
 
 The sockstat utility checks all file descriptors open by all processes
 looking for sockets, while netstat shows all kernel-level sockets. This
 may mismatch in many ways: a process may have closed its descriptor but
 TCP still needs to maintain some state like TIME_WAIT (as mentioned in
 the sockstat(1) man page), multiple descriptors may exist for a single
 socket and kernel code (like nlockmgr) may use the socket(9) API
 directly so there is no descriptor. However, any socket file descriptor
 shown by sockstat must correspond to a kernel-level socket shown by
 netstat.
 
 This does appear to be intended, although it is surprising and not
 documented very well.
 
 -- 
 Jilles Tjoelker


More information about the freebsd-bugs mailing list