Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Mar 2004 19:36:58 -0500
From:      Garance A Drosehn <gad@FreeBSD.org>
To:        Nate Lawson <nate@root.org>
Cc:        cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/bin/ps ps.1 ps.c
Message-ID:  <p0602041ebc7e95743f8e@[128.113.24.47]>
In-Reply-To: <20040317145908.P3595@root.org>
References:  <20040317224702.A8A0416A52E@hub.freebsd.org> <20040317145908.P3595@root.org>

next in thread | previous in thread | raw e-mail | index | archive | help
At 2:59 PM -0800 3/17/04, Nate Lawson wrote:
>On Wed, 17 Mar 2004, Garance A Drosehn wrote:
>>    Modified files:
>>      bin/ps               ps.1 ps.c
>>    Log:
>  >   Improvements to 'ps -p <x>'.  If <x> is a process id that does
>  >   not exist, then just print the header (if any) and exit, thus
>  >   matching the behavior on -stable and other OS's.

>If not found, shouldn't it print no header, an error message to
>stderr and return non-zero?

It isn't clear from SUSv3 if it should do that.  And, as mentioned,
the behavior in -stable is the same as the behavior on other OS's,
so I felt that it was reasonable to keep that behavior in -current.

Further, 'ps -U someuser' does not give an error message when there
are no processes matching that user.  'ps' only does that if there
is no userid named 'someuser'.  It's the same for 'ps -t /dev/ttyx'.
Also consider the (now supported) case of:    ps -p 1,12790
if process #1 does exist, and process #12790 does not exist.  Do
you really want 'ps' to abort in that case, with a message to
stderr?  I do not feel that is desirable.

However, in some further checking on other OS's, I do see that
'ps' does seem to return non-zero if there are no processes which
match the given process-list or user-list.  And we also seem to
do that for '-u someuser'.  Given that I basically copied the
userlist code to create the support for process-lists, I will
have to check why 'ps' does a zero-return in some cases where
no processes are matched.  I didn't intend that.  I'll try to
get that fixed tonight.

-- 
Garance Alistair Drosehn     =      gad@gilead.netel.rpi.edu
Senior Systems Programmer               or   gad@FreeBSD.org
Rensselaer Polytechnic Institute;             Troy, NY;  USA



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