From owner-freebsd-hackers@FreeBSD.ORG Fri Jan 25 21:09:38 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0C19ECCA; Fri, 25 Jan 2013 21:09:38 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from mx0.deglitch.com (cl-414.sto-01.se.sixxs.net [IPv6:2001:16d8:ff00:19d::2]) by mx1.freebsd.org (Postfix) with ESMTP id B553396F; Fri, 25 Jan 2013 21:09:37 +0000 (UTC) Received: from freebsd.corp.qc (unknown [72.5.114.2]) by mx0.deglitch.com (Postfix) with ESMTPA id C7F2C8FC2B; Sat, 26 Jan 2013 01:09:31 +0400 (MSK) Date: Fri, 25 Jan 2013 13:09:29 -0800 From: Stanislav Sedov To: John Baldwin Subject: Re: libprocstat(3): retrieve process command line args and environment Message-Id: <20130125130929.3803f993e3df877f30653dbf@FreeBSD.org> In-Reply-To: <201301251531.43540.jhb@freebsd.org> References: <20130119151253.GB88025@gmail.com> <201301241120.52054.jhb@freebsd.org> <201301251531.43540.jhb@freebsd.org> Organization: The FreeBSD Project X-Mailer: carrier-pigeon Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Mikolaj Golub , Stanislav Sedov , "Robert N. M. Watson" , freebsd-hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Jan 2013 21:09:38 -0000 On Fri, 25 Jan 2013 15:31:43 -0500 John Baldwin mentioned: > On Friday, January 25, 2013 1:37:45 pm Robert N. M. Watson wrote: > > > > On 24 Jan 2013, at 16:20, John Baldwin wrote: > > > > >>> Hmm, are you going to rewrite ps(1) to use libprocstat? Or rather, is > that a > > >>> goal someday? That is one current consumer of kvm_getargv/envv. That > might > > >>> be fine if we want to make more tools use libprocstat instead of using > libkvm > > >>> directly. > > >> > > >> I didn't have any plans for ps(1) :-) That is why I wrote about "new > > >> code". But if you think it is good to do I might look at it one day... > > > > > > I'm mostly hoping Robert chimes in to see if that was his intention for > > > libprocstat. :) If we can ultimately replace all uses of kvm_get*v() with > > > calls to procstat_get*v*() then I'm fine with some code duplication in the > > > interim. > > > > > > Originally there was just proctstat(1), but it made sense to begin re- > encapsulating it in a libprocstat(3) because the code there is potentially > extremely reusable. This conflicts a bit with libkvm(3), which mysteriously > knows about sysctlbyname(3) despite a name suggesting otherwise. You can > imagine various approaches to fixing this, but indeed, making libprocstat(3) > the first-class citizen and preferring it for both kvm and sysctl methods > sounds like the way to go. I actually want to make libprocstat also support > snmp, but I've never actually found the time to investigate doing that. One of > my main unmet goals for procstat(1) was to introduce an extremely machine- > readable output format for it -- e.g., something XML-based or similar. I'd > still love to see that happen. > > BTW, one off-ball thought I have is that I would like to have a mode where > libprocstat operates on a core file (of a process, not a kernel crash dump), > so it could list the threads from a core dump, and possibly file descriptor > info (if PR kern/173723 is implemented). > That's actually a good idea. I was thinking about the same for some time. AFAIK Solaris' pfiles can do that, and maybe some other tools as well. I have not had time to look into yet, though. -- Stanislav Sedov ST4096-RIPE () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments