From owner-freebsd-bugs@FreeBSD.ORG Sat Jan 14 00:10:17 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4383C10656F9 for ; Sat, 14 Jan 2012 00:10:17 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 2ECB78FC1E for ; Sat, 14 Jan 2012 00:10:16 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q0E0AF4Y089086 for ; Sat, 14 Jan 2012 00:10:15 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q0E0AFsU089085; Sat, 14 Jan 2012 00:10:15 GMT (envelope-from gnats) Date: Sat, 14 Jan 2012 00:10:15 GMT Message-Id: <201201140010.q0E0AFsU089085@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Jilles Tjoelker Cc: Subject: Re: bin/164081: sockstat not reporting all open sockets X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Jilles Tjoelker List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2012 00:10:17 -0000 The following reply was made to PR bin/164081; it has been noted by GNATS. From: Jilles Tjoelker To: bug-followup@FreeBSD.org, pirzyk@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