Subject: Re: ps with more POSIX/SUSv3 support
To: Zafer Aydogan <zafer@gmx.org>
From: Valentin Nechayev <netch@lucky.net>
List: tech-userlevel
Date: 11/19/2005 10:08:14
 Fri, Nov 18, 2005 at 22:09:41, zafer wrote about "ps with more POSIX/SUSv3 support": 

> I've added the -A Option to 'ps' which I was missing a long time. -A is the
> same as '-ax' but SUSv3. I've taken the describing comment from FreeBSD.
> I've added a patch. I'd be glad to see this in Tree.

Whether the Posix/SUS-compatible ps should be the same as BSD ps?
Too many options have different meaning and incompatible with BSD
tradition (e.g. -e for all processes vs. -e for environment). In
most Linux distributions, this is solved using switching argument
parsing mode using environment variable (PS_PERSONALITY).

Posix contains semi-trick to allow compatibility only when
required: confstr(_CS_PATH) returns value for PATH to contain all
Posix utilities with Posix arguments; one can create /usr/posix/bin
and add to beginning of the list. Posix version of ps can be as
short as follows:

=== cut /usr/posix/bin/ps ===
#!/bin/sh
PS_PERSONALITY=posix exec /bin/ps "$@"
=== end cut ===

_CS_PATH with /usr/posix/bin/ already mentioned in, at least,
http://mail-index.netbsd.org/netbsd-bugs/2005/02/04/0008.html,
so it isn't very new;) There were objections to this idea,
generally because to possibility of merging options to one
consistent set, but for ps this merge isn't possible.


-netch-