From owner-freebsd-hackers@FreeBSD.ORG Fri Jan 25 18:37:47 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id AD624DAA; Fri, 25 Jan 2013 18:37:47 +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 73F45FA5; Fri, 25 Jan 2013 18:37:47 +0000 (UTC) Received: from cilantro.sec.cl.cam.ac.uk (cilantro.sec.cl.cam.ac.uk [128.232.18.69]) by cyrus.watson.org (Postfix) with ESMTPSA id AC86846B5B; Fri, 25 Jan 2013 13:37:46 -0500 (EST) Subject: Re: libprocstat(3): retrieve process command line args and environment Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset=iso-8859-1 From: "Robert N. M. Watson" In-Reply-To: <201301241120.52054.jhb@freebsd.org> Date: Fri, 25 Jan 2013 18:37:45 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: References: <20130119151253.GB88025@gmail.com> <201301231131.43972.jhb@freebsd.org> <20130123214949.GA3120@gmail.com> <201301241120.52054.jhb@freebsd.org> To: John Baldwin X-Mailer: Apple Mail (2.1283) Cc: Mikolaj Golub , Stanislav Sedov , 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 18:37:47 -0000 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. >>=20 >> 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... >=20 > 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. Robert=