OSDN Git Service

Show "-" rather 0 if we don't know whether a process is 32- or 64-bit.
authorElliott Hughes <enh@google.com>
Fri, 29 Apr 2016 21:04:40 +0000 (14:04 -0700)
committerRob Landley <rob@landley.net>
Fri, 29 Apr 2016 23:51:30 +0000 (18:51 -0500)
toys/posix/ps.c

index e56a8e5..8b35e1c 100644 (file)
@@ -409,7 +409,7 @@ static char *string_field(struct carveup *tb, struct strawberry *field)
   long long *slot = tb->slot, ll = (sl >= 0) ? slot[sl&63] : 0;
 
   // numbers, mostly from /proc/$PID/stat
-  if (which <= PS_CPU) {
+  if (which <= PS_BIT) {
     char *fmt = "%lld";
 
     if (which==PS_PRI) ll = 39-ll;
@@ -418,7 +418,7 @@ static char *string_field(struct carveup *tb, struct strawberry *field)
     else if (which==PS_RSS) ll <<= 2;
     else if (which==PS_VSZ) ll >>= 10;
     else if (which==PS_PR && ll<-9) fmt="RT";
-    else if (which==PS_RTPRIO && ll == 0) fmt="-";
+    else if ((which==PS_RTPRIO || which==PS_BIT) && ll == 0) fmt="-";
     sprintf(out, fmt, ll);
 
   // String fields