PATCH for a more-POSIX `ps', and related adventures

Garance A Drosihn drosih at rpi.edu
Thu Mar 25 15:10:28 PST 2004


At 5:14 PM -0500 3/25/04, Albert Cahalan wrote:
>On Thu, 2004-03-25 at 16:07, Garance A Drosihn wrote:
>>  At 3:40 PM -0500 3/25/04, Albert Cahalan wrote:
>>  >
>  > >Also, I'd be happy to support a FreeBSD-compatible "Z" if
>  > >you can properly describe it to me.
>  >
>  > This description from the source might help (since I have
>  > not written the man-page entry for it yet.  Ahem...):
>
>'Z' != 'X'

Oops.  That just shows what happens when I don't get enough sleep!

`ps -Z' is an option which modifies the output format to add a
column called "LABEL".  It is only in 5.x, and looking at the code
I am not sure that it interacts all that well with the other `-o'
options.  But if you specify `-Z' before any other output-option,
then this LABEL column shows up as the first column of output.

What it shows is the MAC (Mandatory Access Control) label for
processes.  All my processes show up with a blank LABEL field,
because I'm not actually doing anything with MAC's yet. I know
very little about MAC-support.  Perhaps the following will help:

http://www.freebsd.org/cgi/man.cgi?query=lomac&manpath=FreeBSD+5.2-current

>Thanks for the "X" info though. Supporting "X" this way
>would be seriously hard for me.

I'd be happy enough if you just treated it as a no-op :-).

>I suppose the whole point is to filter processes out
>of the listed selections?

The point is just to have a reverse of -x.  I really wanted options
like '-G' to *not* show these processes by default, but someone
pointed out that doing that would be incompatible with how other
OS's handle those options.  But in BSD-land, a `ps' all by itself
defaults to what I'm calling `-X' (which is why we have a `-x'
option in the first place).

>This seems to be quite a bit of complexity for little gain.

We already have -x.  Adding -X is almost zero complexity in our
code path.  Most of the update for it is just that block of
comments which I sent in my previous message.

>It looks like you're headed toward something that might
>best be done like:
>     ps --match="ruid in 1,1000,1082 && tty!=NOTTY"

Uh, now adding *THAT* would add a huge amount of complexity to
our `ps'!  Wow!

>(instead of approaching it hack-by-hack over the years)

Well, I do not picture a series of similar hacks.  I am just trying
to make some sense out of our already-existing `-x' option vs. the
way options like `-G' are supposed to work according to the standards.

>I think "ps xX" should be an error, and maybe "ps xx" too.

Nah.

-- 
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-standards mailing list