From owner-freebsd-hackers@FreeBSD.ORG Mon Nov 19 12:09:42 2007 Return-Path: Delivered-To: freebsd-hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4BD1016A469 for ; Mon, 19 Nov 2007 12:09:42 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [209.31.154.42]) by mx1.freebsd.org (Postfix) with ESMTP id 056E213C4BB for ; Mon, 19 Nov 2007 12:09:42 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [209.31.154.41]) by cyrus.watson.org (Postfix) with ESMTP id CE59E46E63; Mon, 19 Nov 2007 07:12:02 -0500 (EST) Date: Mon, 19 Nov 2007 12:09:29 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Skip Ford In-Reply-To: <20071118221317.GF813@menantico.com> Message-ID: <20071119115508.M59049@fledge.watson.org> References: <20071114112304.GA835@menantico.com> <20071114121812.U2025@fledge.watson.org> <20071114132743.GB835@menantico.com> <20071116144356.S10677@fledge.watson.org> <20071116212342.GD835@menantico.com> <20071117215003.U53707@maildrop.int.zabbadoz.net> <20071117223910.GD813@menantico.com> <20071118151712.GA21185@voi.aagh.net> <20071118204743.GE813@menantico.com> <20071118205541.U97497@fledge.watson.org> <20071118221317.GF813@menantico.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: "Bjoern A. Zeeb" , freebsd-hackers@FreeBSD.org, Yuri Subject: Re: How to get filename of an open file descriptor X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Nov 2007 12:09:42 -0000 On Sun, 18 Nov 2007, Skip Ford wrote: >>> 1) procstat_args() doesn't use a local variable and the buffer doesn't >>> get cleared between calls: >>> >>> $ procstat -a 797 >>> PID ARGS >>> 797 audacious >>> $ procstat -a 795 797 >>> PID ARGS >>> 795 xterm -xtsessionID 11c0a80103000118536826300000007680000 >>> 797 audacious essionID 11c0a80103000118536826300000007680000 >>> $ >>> >>> Other option's functions are not similarly affected. Indeed, it turned out I fixed another related bug but not this bug (that if there was no pathname returned, we would print the previous pathname). The bug here is not so much the buffer handling, but rather, that the termination condition for the printing loop was wrong. I coded it to look for a double-nul, but in fact, I just needed to loop through until I hit the limit of the data returned by sysctl. So this should now also be fixed. I'm going going to hack a bit more on procstat today and then put up a new drop. The main missing feature right now, from my perspective, is signal information, but are there other pieces of detailed process information we could usefully be displaying? I'm not sure I want to get into teaching procinfo about generating stack traces, which is something the Solaris tools can do, but perhaps there are other things we could be displaying. Although it occurs to me that, in many ways, it would be nice to be able to generate a kernel stack trace for each user thread--often when debugging a hung process, that's one of the pieces of information I'd really like to have, as just seeing a generic wchan sleep on a lock is not very useful. Robert N M Watson Computer Laboratory University of Cambridge