Re: posix ps (was Re: Adding `pgrep' and `pkill' to /usr/bin)

From: Albert Cahalan (albert_at_users.sf.net)
Date: 03/27/04

  • Next message: Garance A Drosihn: "Re: posix ps (was Re: Adding `pgrep' and `pkill' to /usr/bin)"
    To: Cyrille Lefevre <root@gits.dyndns.org>
    Date: 26 Mar 2004 19:13:11 -0500
    
    

    On Fri, 2004-03-26 at 17:51, Cyrille Lefevre wrote:
    > "Albert Cahalan" <albert@users.sourceforge.net> wrote:
    >
    > > Cyrille Lefevre writes:
    > >
    > > > two years ago, I've added posix syntax and so to my locally ps(1).
    > > > for instance, I'm currently adding the notion of dynamic personalities
    > >
    > > OK, would YOU be interested in working with me on some sort of
    > > common ps specification beyond what SUSv3 has to offer? I'd love
    > > to see something that Sun could adopt, and that could be mostly
    > > merged into the next revision of the standard.
    >
    > why not :)

    Great. Unless people object, I'll wipe the Cc: list for this.

    BTW, I hadn't meant to imply that any other person was being
    some kind of uncooperative prick. We all have time constraints
    and plenty of projects.

    > > So you use "-X" as an escape into long options? Why not "--help"?
    >
    > no, PERSONALITY=solaris is the same as -X solaris. -X is the option
    > I use to switch between personalities. so, -X help is a sort of -L which
    > lists available keywords. -o help in the posix syntax stands for -L in
    > the bsd syntax. I don't use -L as in the bsd syntax to avoid a
    > conflict with -L which permit to list threads in the solaris syntax.

    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...?

    > > > personalities enable options such as :
    > > > bsd ps :
    > > > -g and -n from sunos, -s from tru64 and some other options.
    > > > posix ps : see susv3 man (see
    > > > http://www.opengroup.org/onlinepubs/007904975/toc.htm)
    > > > -j from all except posix
    > > > -c, -y and -P from solaris
    > > > -C cmdlist (ala pgrep :) and -x from hpux
    > >
    > > That "-x" will hurt you. Without it, it is easy for a SUSv3 parser
    > > to detect the common old "ps -ax" syntax.
    >
    > well, hpux -f only list the first 64 characters of a command line
    > (where solaris list the first 80 ones), the hpux -x option is
    > equivalent to the bsd -ww option.

    Eh, "-ww" plus turning on argument display, right?
    It's the opposite of BSD "c" AFAIK, and implied by "-f".

    > > 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.

    Part of my solution:
    {"uid_hack", "UID", pr_euser, sr_nop, 8, USR, XXX, ET|USER},

    > > > -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.

    > > > $ PERSONALITY=susv3,+extended ps -?
    > > > usage: ps [-AacdefjlPxy] [-C cmdlist] [-G grouplist] [-g pgrplist]
    > > > [-n system [-n core]] [-O fmtlist] [-o fmtlist] [-p pidlist]
    > > > [-s sidlist] [-t ttylist] [-U ruserlist] [-u userlist] [-X
    > perslist]
    > > > ps -o help
    > > > ps -X help
    > >
    > > What syntax do you use for PERSONALITY settings? Let's do
    > > something compatible.
    >
    > [=+-]keyword[,[=+-]keyword ...]
    >
    > "=" is optional and say "this personality", "+" say add "this personality"
    > to the previous one, and "-" say delete "this personality" to the previous one.
    >
    > possible personalities by themself are :
    > bsd43reno bsd44 default freebsd hpux irix netbsd openbsd solaris sunos susv3
    > tru64
    > any : all above
    > none : none of the above

    The bsd43reno/bsd44/freebsd distinction is interesting.
    I hope you'll add "linux" to your list. :-)

    I was hoping that your syntax covered fall-back choices.
    Then I could ask for "unixware" as a first choice, and
    for "posix" if "unixware" is unknown.

    > 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,".

    > > 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

    _______________________________________________
    freebsd-arch@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-arch
    To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"


  • Next message: Garance A Drosihn: "Re: posix ps (was Re: Adding `pgrep' and `pkill' to /usr/bin)"

    Relevant Pages

    • Re: differences in ps commands?
      ... One is BSD syntax, and the other is System V syntax. ... Taking a look at the old UNIX manual that I have, ... Here is what my book says about the 'ps' command, ...
      (comp.unix.questions)
    • posix ps (was Re: Adding `pgrep and `pkill to /usr/bin)
      ... common ps specification beyond what SUSv3 has to offer? ... ps does old BSD behavior by default ... /usr/ucb/ps is a script that sets the old BSD personality ...
      (freebsd-arch)
    • Re: comp.unix.bsd.dragonflybsd ?
      ... >Adam H. Kerman wrote: ... I'm not a user of any BSD and still miss the days when Unixware was one ...
      (comp.unix.bsd.netbsd.misc)
    • Re: comp.unix.bsd.dragonflybsd ?
      ... >Adam H. Kerman wrote: ... I'm not a user of any BSD and still miss the days when Unixware was one ...
      (comp.unix.bsd.freebsd.misc)
    • Re: comp.unix.bsd.dragonflybsd ?
      ... >Adam H. Kerman wrote: ... I'm not a user of any BSD and still miss the days when Unixware was one ...
      (comp.unix.bsd.openbsd.misc)