[Toybox] Fun with ps.

Rob Landley rob at landley.net
Fri Oct 9 14:29:40 PDT 2015


Default ps output gets trunctated to screen width. Unfortunately this is
a little difficult to demonstrate using the posix options because ps -A
defaults to -o pid,tty,time,cmd and cmd is just command name not command
line, but:

  ps -A -o pid,tty,time,command

Demonstrates it reasonably well. This is why -w exists., so "ps -Aw -o
..." can produce the full command line output.

However, if I do:

ps -o pid,pid,pid,pid,pid,pid,pid,pid,pid,pid,pid,pid,pid,pid,pid,pid

This happily wraps around the edge of the screen. So what's clipping at
the right edge is the expansion of the _last_ field, using the special
last field rules which only apply to left justified fields anyway.

It would be so nice if the posix spec were worth something here. I'm sad
we haven't got a standards body that can actually explain how any of
this stuff is supposed to work.

Grrr. Need test suite entries for this, which means the controlled
environment with known process IDs to run them in. (Well, known-ish
given that I can't control how many kernel threads the kernel launches
for random drivers on startup, which changes each kernel version
"upgrade"...)

Rob

 1444426180.0


More information about the Toybox mailing list