From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 17:55:14 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40FC7106568D; Mon, 21 Dec 2009 17:55:14 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 168298FC18; Mon, 21 Dec 2009 17:55:14 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id B7B2746B2D; Mon, 21 Dec 2009 12:55:13 -0500 (EST) Date: Mon, 21 Dec 2009 17:55:13 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Xin LI In-Reply-To: Message-ID: References: <200912211723.nBLHN4RR034528@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="621616949-2080532969-1261418113=:73550" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dag-Erling Smorgrav Subject: Re: svn commit: r200779 - head/usr.bin/sockstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 17:55:14 -0000 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 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--