diff options
author | Elliott Hughes <enh@google.com> | 2016-09-27 12:20:41 -0700 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2016-09-28 15:19:19 -0500 |
commit | 2b66afffb8b51a4e68b508be1858dcde7706142e (patch) | |
tree | 077355b610ddf27cc8453cab39e2780ae892959e /toys | |
parent | 0b545a471ca8a0a6fc95838b5352510d181fa407 (diff) | |
download | toybox-2b66afffb8b51a4e68b508be1858dcde7706142e.tar.gz |
Show thread names with "ps -T" on Android.
Android uses NAME rather than CMD by default, but that's not what we
want with -T. Noticed because it broke systrace's reporting of thread
names (see https://developer.android.com/studio/profile/systrace.html).
Bug: 31741954
Diffstat (limited to 'toys')
-rw-r--r-- | toys/posix/ps.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/toys/posix/ps.c b/toys/posix/ps.c index 6a128bde..bb6bcbad 100644 --- a/toys/posix/ps.c +++ b/toys/posix/ps.c @@ -1178,7 +1178,9 @@ void ps_main(void) else if (toys.optflags&FLAG_l) not_o = "F,S,UID,%sPPID,C,PRI,NI,ADDR,SZ,WCHAN,TTY,TIME,CMD"; else if (CFG_TOYBOX_ON_ANDROID) - not_o = "USER,%sPPID,VSIZE,RSS,WCHAN:10,ADDR:10=PC,S,NAME"; + sprintf(not_o = toybuf+128, + "USER,%%sPPID,VSIZE,RSS,WCHAN:10,ADDR:10=PC,S,%s", + (toys.optflags&FLAG_T) ? "CMD" : "NAME"); sprintf(toybuf, not_o, (toys.optflags & FLAG_T) ? "PID,TID," : "PID,"); // Init TT.fields. This only uses toybuf if TT.ps.o is NULL |