first argument doesn't start with a '-' and ends in 't', the 't' only
gets converted to a 'T' (for listing processes on the current tty)
if it doesn't contain any other command line option characters that
take an argument. Problem noticed by ITOH Yasufumi on tech-userlevel.
If the 'start' format was the last column, the width wouldn't be set
and started() output a zero length string instead of a string the right
length - fix header width calculations so the the last column is handled
the same all others. This only showed up for 'start' because started()
knew that the column header is the same width and the field itself...
Update copyrights.
What this does to the POLS when a script that is parsing ps output just happens
to run in a narrow terminal cannot be described in polite company.
If STDOUT is not a tty, leave width at 80.
just because the latter returned a NULL - that may normally happen,
when the process is, for example, a kernel thread
procfs_getargv(): if the name is brackened in '(' and ')', just
return NULL immediately - the code in command() will DTRT
and the output will be same for procfs- and kvm- based lookup
in all cases
also process start time, process arguments and session leadership status.
The procfs fallback is also used when kvm_openfiles() completely fails
(e.g. when /dev/mem is not readable).
Solves PR 7772, though the final implementation is different.
fstatfs() on the open file to verify that no intruder has mounted
something on portions of /proc. This will catch, for instance,
"mount_null /tmp /proc/1378". We already do 5 syscalls per
process, so one more won't hurt :) ... and safety is better than
performance when ps is otherwise broken.
- Also added a few close()'s at early returns, to avoid chewing up fd's.
fallback method is used, as the results could be untrustworthy if an
intruder is present. It is highly likely that NetBSD-1.5 will have
an improved kvm interface for reading process information, at which
point this code can be garbage-collected. Also added a word to the
man page -x option description while I was here.
It wasn't working anyway, although that could have been fixed by moving it
down below the .include <bsd.prog.mk> line.
It's not completely clear that this usage of %y is in fact y2k-safe, it
seems safer for now to have a single XXX option in bsd.sys.mk, and we need
to rev this anyway for -Wno-uninitialized