From owner-freebsd-fs@FreeBSD.ORG Wed Feb 23 15:35:55 2011 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47396106566B for ; Wed, 23 Feb 2011 15:35:55 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id D28848FC08 for ; Wed, 23 Feb 2011 15:35:54 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p1NFYJ9B027407 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 23 Feb 2011 17:34:19 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id p1NFYJVM069613; Wed, 23 Feb 2011 17:34:19 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p1NFYJXv069612; Wed, 23 Feb 2011 17:34:19 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 23 Feb 2011 17:34:19 +0200 From: Kostik Belousov To: Martin Simmons Message-ID: <20110223153419.GQ78089@deviant.kiev.zoral.com.ua> References: <201102211707.p1LH7c8n075660@lurza.secnetix.de> <476667.58379.qm@web121516.mail.ne1.yahoo.com> <20110222095211.GA96223@icarus.home.lan> <201102220931.17733.jhb@freebsd.org> <20110222211444.GD78089@deviant.kiev.zoral.com.ua> <201102231513.p1NFDOw4031044@higson.cam.lispworks.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="jwHhyFZm5GCAobZr" Content-Disposition: inline In-Reply-To: <201102231513.p1NFDOw4031044@higson.cam.lispworks.com> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-fs@freebsd.org Subject: Re: Why is procfs deprecated in favor of procstat? X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Feb 2011 15:35:55 -0000 --jwHhyFZm5GCAobZr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Feb 23, 2011 at 03:13:24PM +0000, Martin Simmons wrote: > >>>>> On Tue, 22 Feb 2011 23:14:44 +0200, Kostik Belousov said: > >=20 > > On Tue, Feb 22, 2011 at 01:10:57PM -0600, Bob Friesenhahn wrote: > > > On Tue, 22 Feb 2011, John Baldwin wrote: > > > > > > > >Actually, the replacement for procfs is not sysctl, but ptrace(2), a= nd > > > >there > > >=20 > > > I have been following this discussion with my jaw agape. It seems=20 > > > that the many men standing around this elephant are all perceiving=20 > > > completely different things based on their own interests and=20 > > > experiences. > > >=20 > > > My own software is using procfs to efficiently determine the path to= =20 > > > the currently running executable. I am sure that other software does= =20 > > > the same since Linux procfs (and probably OS X) supports the same=20 > > > mechanism. It is difficult to imagine how this would be done via=20 > > > ptrace(2). > > Look at the PT_VM_TIMESTAMP + PT_VM_ENTRY. You would iterate over > > the the mappings in the address space and look at the binaries at > > pve_path, if any. The one that is elf object f the ET_EXEC type > > is the binary. It is somewhat clumsy but the end result is the same > > as if reading /proc//file. > >=20 > > Or, you use sysctl kern.proc.vmmap and get essentially the same data. > > PT_VM_ENTRY was added long after the sysctl, I did not objected exactly > > because ptrace(2) looked more logical. > >=20 > > The advantage of using procfs or sysctl instead of ptrace(2) is that > > you do not need to attach as debugger, causing the issues with signal > > delivery for the debugee. >=20 > Another advantage I find of (linux) procfs is that you always get a textu= al > version of it, which can be useful in shell scripts and debugging situati= ons. >=20 > /sbin/sysctl kern.proc.vmmap isn't usable because the command has no way = to > specify the pid. >=20 > /usr/bin/procstat gives access to only part of the procfs and sysctl > namespace. Apparently, there is kern.proc.pathname sysctl and -b switch to procstat. I never claimed that sysctls are useful from the command line, rather, they form a binary interface for the programs. --jwHhyFZm5GCAobZr Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk1lKPoACgkQC3+MBN1Mb4h40QCfaX563yW53iGI6besxmMkbCcv gkMAn0aDetdGj8xoSnL8apFxJBDDE981 =tG46 -----END PGP SIGNATURE----- --jwHhyFZm5GCAobZr--