ps enhencements (posix syntax, and more)
Jilles Tjoelker
jilles at stack.nl
Thu Apr 22 10:24:03 PDT 2004
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
More information about the freebsd-standards
mailing list