posix ps (was Re: Adding `pgrep' and `pkill' to /usr/bin)
Cyrille Lefevre
root at gits.dyndns.org
Sat Mar 27 01:02:53 PST 2004
"Albert Cahalan" <albert at users.sourceforge.net> wrote:
> On Fri, 2004-03-26 at 17:51, Cyrille Lefevre wrote:
> > "Albert Cahalan" <albert at users.sourceforge.net> wrote:
> > > Cyrille Lefevre writes:
[snip]
> Oh, OK. It's kind of weird, since "ps -o pid,help,comm"
> would seem to be something for 3 columns, but suit yourself.
> I didn't bother, thinking "ps L" and "man ps" would do.
>
> I suppose the -X has to be the first option...?
not necesserally, but usually :)
I prefer the env var use.
[snip]
> Eh, "-ww" plus turning on argument display, right?
> It's the opposite of BSD "c" AFAIK, and implied by "-f".
not exactly, -f is a sort of -w, and -fx is a true -ww.
another solution would be to double -f, say -ff, but
nobody seems to implement that AFAIK.
> > > BTW, I have a regression test suite that you might find useful.
> >
> > yes, of course. for instance, I'm trying to resolve header's naming,
> > say user is USER or UID depending of the personality... etc.
>
> First of all, perfection is the enemy of good.
I know, but I'm like that... perfectionist.
> Part of my solution:
> {"uid_hack", "UID", pr_euser, sr_nop, 8, USR, XXX, ET|USER},
well, for instacance, I keyword aliases w/ personalities :
ALIAS("user", "UID", "user", _SUSV3|_HPUX|_SOLARIS),
SIZE("user", "USER", LJUST, uname, s_uname, USER,
_BSD44|_FREE|_NET|_OPEN|_SUNOS|_IRIX|_TRU64),
but that part is not completed and has not been validated, yet.
ALIAS and SIZE (aka CALL w/ DSIZ) are macros which greatly
improve the readability of the keywords array.
> > > > -M from irix
> > >
> > > Do you have documentation or examples for this?
> >
> > irix -M is freebsd -Z, so, simple to implement :)
>
> It's never that simple.
reading the manual page, yes. but I have no testing machine for that.
[snip]
> The bsd43reno/bsd44/freebsd distinction is interesting.
> I hope you'll add "linux" to your list. :-)
at last, since the linux manual page is really poor and the code ir really
unreadable.
> I was hoping that your syntax covered fall-back choices.
please, explain your mind by fall-back choices ?
for instance, -X unknown gives up w/ an error message
and the list of choices.
> Then I could ask for "unixware" as a first choice, and
> for "posix" if "unixware" is unknown.
unixware could be an alias on plain susv3.
in my mind, posix just say posix syntax.
> > possible switches
> > bsd : bsd syntax
> > extended : allow enhanced options and keywords.
> > pedantic : be strict about the syntax (-p pid instead of -p pidlist)
>
> It's normal to allow a list. The list is either the remaining
> part of the current argument ("ps -p42,45,16") or the next one.
> I ban crud like "ps -p 42,,7" and "ps -p ,42,91,".
no problem for that, empty values are ignored.
> > > The name isn't so good. Tru64 uses CMD_ENV for this, affecting
> > > more than just ps. I made PS_PERSONALITY take priority so that
> > > you could change ps behavior without changing other behaviors.
> >
> > PS_PERSONALITY is the name that linux uses. this may conflict in
> > .profiles since the syntax is different. to complete what you say :
> > irix uses _XPG=1 and hpux uses UNIX95=1
> > of course, all of them could be tested for more and more compatobility :)
>
> Heh. I do in fact check _XPG=1 and UNIX95=1.
>
> > > You forgot the "-F" from DYNIX/ptx. It's really nice.
> >
> > any pointer ?
>
> It's a friendly format, kind of along the lines of BSD "u".
>
> $ ps -F
> UID PID PPID C SZ RSS PSR STIME TTY TIME CMD
> albert 21666 21665 1 770 1672 0 19:11 pts/14 00:00:00 bash
> albert 21674 21666 0 744 880 0 19:11 pts/14 00:00:00 ps -F
well, a kind of solaris ps -clPy but shorter :)
S UID PID PPID CLS PSR PRI RSS SZ WCHAN TTY TIME CMD
Cyrille Lefevre.
--
home: mailto:cyrille.lefevre at laposte.net
More information about the freebsd-arch
mailing list