From owner-freebsd-current@FreeBSD.ORG Tue Mar 9 00:58:59 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 07CC016A4CE for ; Tue, 9 Mar 2004 00:58:59 -0800 (PST) Received: from tigra.ip.net.ua (tigra.ip.net.ua [82.193.96.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id BE2B643D39 for ; Tue, 9 Mar 2004 00:58:55 -0800 (PST) (envelope-from ru@ip.net.ua) Received: from heffalump.office.ipnet (heffalump.ip.net.ua [82.193.96.213]) by tigra.ip.net.ua (8.12.10/8.12.9) with ESMTP id i2992K1t044786 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 9 Mar 2004 11:02:21 +0200 (EET) (envelope-from ru@ip.net.ua) Received: (from ru@localhost) by heffalump.office.ipnet (8.12.11/8.12.11) id i298wj3x056019; Tue, 9 Mar 2004 10:58:45 +0200 (EET) (envelope-from ru) Date: Tue, 9 Mar 2004 10:58:43 +0200 From: Ruslan Ermilov To: Garance A Drosihn Message-ID: <20040309085843.GD55680@ip.net.ua> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="x4pBfXISqBoDm8sr" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.6i X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) cc: current@freebsd.org Subject: Re: Question on 'ps -p ' in current X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2004 08:58:59 -0000 --x4pBfXISqBoDm8sr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Mar 08, 2004 at 09:40:21PM -0500, Garance A Drosihn wrote: > This topic may have come up before, a long time ago, and I just > missed it. If so, apologies for the repeat. >=20 > On stable, if you say 'ps -p ', and there is no process '', > then you get the header-line from 'ps' and nothing else. The > command-status is set to indicate failure. >=20 > On -current, the same command gives you the error message: >=20 > ps: kvm_getprocs: No such process >=20 > and you get no header line. Other OS's also give you the header > line and no special error message. >=20 > I think this behavior in current is an unplanned side-effect of > the change in revision 1.46 of > http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libkvm/kvm_proc.c >=20 > where that was fixing a side-effect of a fix in revision 1.60 > of malloc.c. >=20 I don't think that rev. 1.46 is the problem. The sysctl is what returns ESRCH if no process exists. In RELENG_4, it returns 0. See sys/kern/kern_proc.c:sysctl_kern_proc(), the handing of KERN_PROC_PID. The semantics has been changed in rev. 1.192. > In some other OS's, 'ps' behaves the way it does for us in -stable. > Looking at SUSv3, it's not clear to me if either behavior is > preferred. >=20 > Should 'ps' in this situation behave like it does in -stable? Or > is this a change that we deliberately wanted to make in -current? > I would be willing to change 'ps' if people prefer the earlier > behavior, but I'll leave it alone if this was an intentional change. >=20 I believe that the current behavior of KERN_PROC_PID is correct. I personally don't care how ps(1) should behave if no PID exists. Cheers, --=20 Ruslan Ermilov FreeBSD committer ru@FreeBSD.org --x4pBfXISqBoDm8sr Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQFATYdDUkv4P6juNwoRAga8AJ0YtNHEOqNBHPGcMZ9KyN0rprKZ7QCcCoI0 o3QVbSINtYfMnTx7/RwKLQQ= =wiNo -----END PGP SIGNATURE----- --x4pBfXISqBoDm8sr--