diff options
author | Elliott Hughes <enh@google.com> | 2015-10-30 15:16:45 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2015-10-30 15:16:45 -0700 |
commit | d2e26c0e309dd43352d444e11191e7261621faf9 (patch) | |
tree | 0af9b3599acd3ab2e449c228f9abc87f11acedee /toolbox | |
parent | 9d1636b193adf9ba6cd598e3637bbebafcf4f9bf (diff) | |
download | core-d2e26c0e309dd43352d444e11191e7261621faf9.tar.gz core-d2e26c0e309dd43352d444e11191e7261621faf9.tar.bz2 core-d2e26c0e309dd43352d444e11191e7261621faf9.zip |
Fix ps -Z so it combines with other arguments.
This is another step towards being able to swap toolbox ps out for
a more complete ps. This should also let us fix dumpstate to not
need a separate "ps -Z" run --- we can just add -Z to the previous
run of ps instead.
Change-Id: I0b96dff51988edd2b33879f8c31faccebeeffddd
Diffstat (limited to 'toolbox')
-rw-r--r-- | toolbox/ps.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/toolbox/ps.c b/toolbox/ps.c index 4d84b19b6..3bc540d15 100644 --- a/toolbox/ps.c +++ b/toolbox/ps.c @@ -167,8 +167,7 @@ static int ps_line(int pid, int tid) if (r > 0) macline[r] = 0; } - printf("%-30s %-9s %-5d %-5d %s\n", macline, user, pid, ppid, cmdline[0] ? cmdline : name); - return 0; + printf("%-30s ", macline); } printf("%-9s %-5d %-5d %-6d %-5d", user, pid, ppid, vss / 1024, rss * 4); @@ -305,15 +304,15 @@ int ps_main(int argc, char **argv) } if (display_flags & SHOW_MACLABEL) { - printf("LABEL USER PID PPID NAME\n"); - } else { - printf("USER PID PPID VSIZE RSS %s%s %sWCHAN %*s %sNAME\n", - (display_flags&SHOW_CPU)?"CPU ":"", - (display_flags&SHOW_PRIO)?"PRIO NICE RTPRI SCHED ":"", - (display_flags&SHOW_POLICY)?"PCY " : "", - (int) PC_WIDTH, "PC", - (display_flags&SHOW_ABI)?"ABI " : ""); + printf("LABEL "); } + printf("USER PID PPID VSIZE RSS %s%s %sWCHAN %*s %sNAME\n", + (display_flags&SHOW_CPU)?"CPU ":"", + (display_flags&SHOW_PRIO)?"PRIO NICE RTPRI SCHED ":"", + (display_flags&SHOW_POLICY)?"PCY " : "", + (int) PC_WIDTH, "PC", + (display_flags&SHOW_ABI)?"ABI " : ""); + while((de = readdir(d)) != 0){ if(isdigit(de->d_name[0])){ int pid = atoi(de->d_name); |