aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/ps.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2016-01-20 17:33:31 -0600
committerRob Landley <rob@landley.net>2016-01-20 17:33:31 -0600
commitbe7e9e02c3e21bfaff85f7c41db0ae83d718b7a2 (patch)
tree45b382fecd8807b9a3b2a47f26a4271f073e4fb0 /toys/posix/ps.c
parent941f9d6cc09adaa0155ee71ac34e6f9b773a90f1 (diff)
downloadtoybox-be7e9e02c3e21bfaff85f7c41db0ae83d718b7a2.tar.gz
Correct units of %MEM and %VSZ.
Diffstat (limited to 'toys/posix/ps.c')
-rw-r--r--toys/posix/ps.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/toys/posix/ps.c b/toys/posix/ps.c
index bddb3a9d..6c3ed374 100644
--- a/toys/posix/ps.c
+++ b/toys/posix/ps.c
@@ -327,7 +327,7 @@ struct typography {
// Remaining ungrouped
{"STIME", 5, 19}, {"F", 1, 64|6}, {"S", -1, 64}, {"C", 1, 64|11}, {"%CPU", 4, 64|11},
- {"STAT", -5, 64}, {"%VSZ", 5, 23}, {"VIRT", 4, 47}, {"RES", 4, 48},
+ {"STAT", -5, 64}, {"%VSZ", 5, 20}, {"VIRT", 4, 47}, {"RES", 4, 48},
{"SHR", 4, 49}, {"READ", 6, 50}, {"WRITE", 6, 51}, {"IO", 6, 28},
{"DREAD", 6, 52}, {"DWRITE", 6, 53}, {"SWAP", 6, 54}, {"DIO", 6, 29},
{"%MEM", 5, 21}
@@ -472,7 +472,8 @@ static char *string_field(struct carveup *tb, struct strawberry *field)
if (out<buf) out = buf;
} else if (strchr((char []){PS_C,PS__CPU,PS__VSZ,PS__MEM,0}, which)) {
ll = slot[sl&63]*1000;
- if (which==PS__VSZ || which==PS__MEM) ll /= TT.si.totalram;
+ if (which==PS__VSZ || which==PS__MEM)
+ ll /= TT.si.totalram/((which==PS__VSZ) ? 1024 : 4096);
else if (slot[44]) ll /= slot[44];
sl = ll;
if (which==PS_C) sl += 5;