Parenthesized arguments in a "ps" list

Philip Lantz philipl at azure.UUCP
Sun Nov 13 04:17:53 AEST 1983


Ps has a fixed size buffer into which it reads the command arguments
(including the environment, which is pushed onto the stack before the
arguments).  The size is CLSIZE*NBPG (defined in /usr/include/sys/-
param.h, 1024 on our VAX) bytes.

Ps doesn't know where the beginning of the argument list is, so it
starts at the end of the list and works backwards until it finds the
beginning of the argument list.  If it reaches the beginning of its
buffer before it finds the beginning of the arguments, it gives up and
just puts the command name (known by the system) in parentheses.

So it is the total length of the argument list and environment which
determines what ps will do.  One common long environment variable is
TERMCAP.  I have taken to just setting this to the name of the file
containing the termcap entry, instead of to the entry itself.  (As
documented in termcap(3)).

Note that this is NOT an operating system problem; it is in ps.  If you
don't like it, you can fix you own version of ps that will keep reading
blocks until it finds the beginning of the list.  (On systems that do
not need ps to be setuid, that is.)

Philip Lantz
tekmdp!philipl



More information about the Comp.unix.wizards mailing list