From owner-freebsd-hackers@FreeBSD.ORG Tue Jan 22 22:18:00 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 074993C6; Tue, 22 Jan 2013 22:18:00 +0000 (UTC) (envelope-from stas@freebsd.org) Received: from mx0.deglitch.com (backbone.deglitch.com [78.110.53.255]) by mx1.freebsd.org (Postfix) with ESMTP id B4AE99AD; Tue, 22 Jan 2013 22:17:58 +0000 (UTC) Received: from [10.0.1.4] (c-98-234-104-237.hsd1.ca.comcast.net [98.234.104.237]) by mx0.deglitch.com (Postfix) with ESMTPSA id 5DE008FC2B; Wed, 23 Jan 2013 02:17:45 +0400 (MSK) Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) Subject: Re: libprocstat(3): retrieve process command line args and environment From: Stanislav Sedov In-Reply-To: <201301221648.50747.jhb@freebsd.org> Date: Tue, 22 Jan 2013 14:17:39 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <9679EEE4-BE52-493E-9188-CAECEE5E63D3@freebsd.org> References: <20130119151253.GB88025@gmail.com> <201301221201.06290.jhb@freebsd.org> <20130122211743.GA4490@gmail.com> <201301221648.50747.jhb@freebsd.org> To: John Baldwin X-Mailer: Apple Mail (2.1499) Cc: Mikolaj Golub , freebsd-hackers@freebsd.org, Robert Watson 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: Tue, 22 Jan 2013 22:18:00 -0000 On Jan 22, 2013, at 1:48 PM, John Baldwin wrote: >=20 > Well, you could make procstat open a kvm handle in both cases (open a = "live"=20 > handle in the procstat_open_sysctl() case). It just seems rather = silly to be=20 > duplicating code in the two interfaces. More a question for Robert: = does=20 > libprocstat intentionally duplicate the code in libkvm for other = things as=20 > well in the live case? (Like fetching the list of processes?) >=20 It does not actually has a duplicate code, the code for fetching the = list of processes via sysctl is different from the KVM case. The open file = descriptors processing is different as well. Because libprocstat implements almost = the same functionality both for sysctl and mvm backends, it can be used to = analyze both the live system and the kernel crash dumps. The code Mikolaj = proposed only implements the sysctl backend currently, so it does not seem to = have any relation to KVM, so it will be a bit weird to make it open a KVM = handle though it does not use it. -- ST4096-RIPE