Date: Tue, 9 Mar 2004 10:58:43 +0200 From: Ruslan Ermilov <ru@freebsd.org> To: Garance A Drosihn <drosih@rpi.edu> Cc: current@freebsd.org Subject: Re: Question on 'ps -p <n>' in current Message-ID: <20040309085843.GD55680@ip.net.ua> In-Reply-To: <p060204e7bc72d891f49a@[128.113.24.47]> References: <p060204e7bc72d891f49a@[128.113.24.47]>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --] 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. > > On stable, if you say 'ps -p <n>', and there is no process '<n>', > then you get the header-line from 'ps' and nothing else. The > command-status is set to indicate failure. > > On -current, the same command gives you the error message: > > ps: kvm_getprocs: No such process > > and you get no header line. Other OS's also give you the header > line and no special error message. > > 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 > > where that was fixing a side-effect of a fix in revision 1.60 > of malloc.c. > 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. > > 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. > 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, -- Ruslan Ermilov FreeBSD committer ru@FreeBSD.org [-- Attachment #2 --] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQFATYdDUkv4P6juNwoRAga8AJ0YtNHEOqNBHPGcMZ9KyN0rprKZ7QCcCoI0 o3QVbSINtYfMnTx7/RwKLQQ= =wiNo -----END PGP SIGNATURE-----help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040309085843.GD55680>
