diff options
author | Rob Landley <rob@landley.net> | 2016-06-10 18:37:41 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2016-06-10 18:37:41 -0500 |
commit | 1f69674020ad01fb03a24f34ea0cc476c785eeb2 (patch) | |
tree | 08987040c12f7bf71c3ecdec5d9d87b3fd9fc2f7 /toys/other/chcon.c | |
parent | d32309a3c0014e7e6c3d2a2fcd5ed9fb19cb6585 (diff) | |
download | toybox-1f69674020ad01fb03a24f34ea0cc476c785eeb2.tar.gz |
Shuffle arguments around (TNAME->NAME->COMM->CMD), working around posix
constraints while still trying to get sane behavior. Discard the old CMD,
move COMM to CMD, move the old NAME to COMM, and move TNAME to NAME.
Posix assumes argv[] is the only source of process name data, but Linux has
three sources (/proc/$PID/cmdline, /proc/$PID/exe, /proc/$PID/stat field 2)
and android uses multiple sources simultaneously to identify its processes
and threads.
Toybox ps also assumes that the field names displayed in the headers
can be fed to -o to get that output, which is an assumption posix's
ps spec clearly does not have. Before we were erring on the side of posix,
now we're erring on the side of sanity.
CMD now shows stat[2], all the time. The posix -f behavior change is now
just an ARGS=CMD alias in the -f default command line, which -o overrides.
(Before -f changed the behavior of -o CMD, which is closer to what
posix says but is _insane_ and we've stopped doing it.)
COMM now shows /proc/$PID/exe minus the path. (I'm aware posix says argv[0]
here, but it says argv everywhere.)
NAME is now argv[0] of $PID.
TNAME went away.
Both $COMM and $NAME show the data for $PID, which is a thread's parent
process when $TID != $PID.
Diffstat (limited to 'toys/other/chcon.c')
0 files changed, 0 insertions, 0 deletions