Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Mar 2004 13:19:03 -0500
From:      Garance A Drosihn <drosih@rpi.edu>
To:        Ruslan Ermilov <ru@freebsd.org>
Cc:        current@freebsd.org
Subject:   Re: Question on 'ps -p <n>' in current
Message-ID:  <p060204e9bc73b9cbbec9@[128.113.24.47]>
In-Reply-To: <20040309085843.GD55680@ip.net.ua>
References:  <p060204e7bc72d891f49a@[128.113.24.47]> <20040309085843.GD55680@ip.net.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
At 10:58 AM +0200 3/9/04, Ruslan Ermilov wrote:
>On Mon, Mar 08, 2004, Garance A Drosihn wrote:
>  >
>  > 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.

Hmm.  That could be it.  I know 'ps' has behaved this way in 5.x
for awhile, but I can't remember when it started.  In fact, it
behaved this way for awhile, then it returned to 4.x behavior,
and then it went back to it's present behavior.  That's why I
haven't said anything until now.  I kept thinking "someone else
will fix this...".  A recent change for rc.subr reminded me that
no one else had commented on it.

>  > 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.

I do agree that kvm_getprocs() is doing what it should do, so I
would only be changing the code in ps.c.

-- 
Garance Alistair Drosehn            =   gad@gilead.netel.rpi.edu
Senior Systems Programmer           or  gad@freebsd.org
Rensselaer Polytechnic Institute    or  drosih@rpi.edu



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p060204e9bc73b9cbbec9>