Question on 'ps -p <n>' in current
Garance A Drosihn
drosih at rpi.edu
Tue Mar 9 10:19:05 PST 2004
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 at gilead.netel.rpi.edu
Senior Systems Programmer or gad at freebsd.org
Rensselaer Polytechnic Institute or drosih at rpi.edu
More information about the freebsd-current
mailing list