Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Apr 2004 19:24:01 +0200
From:      Jilles Tjoelker <jilles@stack.nl>
To:        Cyrille Lefevre <root@gits.dyndns.org>
Cc:        Albert Cahalan <albert@users.sourceforge.net>
Subject:   Re: ps enhencements (posix syntax, and more)
Message-ID:  <20040422172401.GA88130@stack.nl>
In-Reply-To: <00ba01c427f3$b3477f40$7890a8c0@dyndns.org>
References:  <019601c426b0$77dc91a0$7890a8c0@dyndns.org> <p0602040dbcab0fdc78a2@[128.113.24.47]> <1082504719.3444.534.camel@cube> <00ba01c427f3$b3477f40$7890a8c0@dyndns.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Apr 22, 2004 at 12:54:51AM +0200, Cyrille Lefevre wrote:
> > > fname   FNAME   alias to ucomm [solaris]

> > Yes, except that it's narrow. Make it 8 characters wide.

> yes, I know, but, for instance, it's just an alias and I don't
> understand the 8 char limit ? 13 yes, but 8 !

Because solaris does it that way.

Quoting from the pr:

> -s    show signal output, same as -O SFMT (option taken from tru64
>       conflicts w/ netbsd -s, aka show threads w/ different fields
>       IMHO, this may be implemented as part of freebsd -H).

Historic BSD used it to show kernel stack size. Tried with Ultrix
4.x, NextSTEP and 4.3BSD-Quasijarus. It may look like (from the latter):

% ps s$$
SSIZ   PID TT STAT  TIME COMMAND
1032  2248 01 S    0:00 -csh (csh)
% ps su$$
ps: specify only one of s,l,v and u
%

The 4.3BSD man page says:
     s    Adds the size SSIZ of the kernel stack of each process
          (for use by system maintainers) to the basic output
          format.

It's quite likely that 's' for signals is an OSF invention.

>     added keywords (bsd) :

Keep the -o option equal between bsd and posix modes, if possible.

>    enhancements to the posix syntax are :
>    -O              same as -o pid,fmtlist,tty,time,comm

Where do you have this from? Keep this -O same as BSD -O if possible.

SUSv3 mentions BSD's -O in an informative section and recommends -O
being used for that purpose.

> Format string which contains both an equal sign and a comma are considered
> to be comma only separated list. so, both
> -o "pid=process id,ppid=parent pid,command=command line" and
> -o "pid=child ppid=parent command=command" are well parsed,
> unfortunately, mixing "user=user name,pid=pid command" isn't...

Hmm, FreeBSD 5.x follows the spec exactly in this respect, an equal sign
marks the rest of the argument as header text, so I doubt whether it's
worth doing this. Note that FreeBSD 4.x aborts header texts at a comma
or space.

>   findvar() rewritten to handle header specification on aliases.
>   now, you may say "ps -O acflg=XXX" as well as "ps -O acfalg=XXX"

There's a PR of mine open on that, too (much simpler).

> -t '?' to select process not attached to a terminal (from older bsd)

Good.

> tsid added in -j format string

Use sid instead, it's more informative (in case of processes that can't
access their ctty anymore (like 'p2-') or don't have a ctty at all). I
think I had a PR for that, too (certainly a local patch, at least).

> if (!S_ISCHR(sb.st_mode)) {

Use isatty(3) for checking whether it's a tty. Things like ps -t
/dev/da0s1a are meaningless but I think your patch will not reject it.

-- 
Jilles Tjoelker



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