aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2007-02-08 08:21:58 +0000
committerMike Frysinger <vapier@gentoo.org>2007-02-08 08:21:58 +0000
commit0aa6ba5d44af32d0bf460c8d92cda686bae64c92 (patch)
tree72424e60f565c397b8a2b10f88855f11b46c4010 /libbb
parent4423e5beefd6f17dfa836211899ee70edcc64a5b (diff)
downloadbusybox-0aa6ba5d44af32d0bf460c8d92cda686bae64c92.tar.gz
make sure ps/top output what they claim: vsz, not rss ... down the line we should make the output controllable either at runtime or buildtime as both statistics are quite useful
Diffstat (limited to 'libbb')
-rw-r--r--libbb/procps.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/libbb/procps.c b/libbb/procps.c
index e7635e5f4..c9dcfde0c 100644
--- a/libbb/procps.c
+++ b/libbb/procps.c
@@ -127,7 +127,7 @@ procps_status_t* procps_scan(procps_status_t* sp, int flags)
* ("continue" would mean that current /proc/NNN
* is not a valid process info) */
- memset(&sp->rss, 0, sizeof(*sp) - offsetof(procps_status_t, rss));
+ memset(&sp->vsz, 0, sizeof(*sp) - offsetof(procps_status_t, vsz));
sp->pid = pid;
if (!(flags & ~PSSCAN_PID)) break;
@@ -164,17 +164,16 @@ procps_status_t* procps_scan(procps_status_t* sp, int flags)
"%*s %*s %*s " /* cutime, cstime, priority */
"%ld " /* nice */
"%*s %*s %*s " /* timeout, it_real_value, start_time */
- "%*s " /* vsize */
- "%lu", /* rss */
+ "%lu ", /* vsize */
sp->state, &sp->ppid,
&sp->pgid, &sp->sid,
&sp->utime, &sp->stime,
&tasknice,
- &sp->rss);
+ &sp->vsz);
if (n != 8)
break;
- if (sp->rss == 0 && sp->state[0] != 'Z')
+ if (sp->vsz == 0 && sp->state[0] != 'Z')
sp->state[1] = 'W';
else
sp->state[1] = ' ';
@@ -185,11 +184,7 @@ procps_status_t* procps_scan(procps_status_t* sp, int flags)
else
sp->state[2] = ' ';
-#ifdef PAGE_SHIFT
- sp->rss <<= (PAGE_SHIFT - 10); /* 2**10 = 1kb */
-#else
- sp->rss *= (getpagesize() >> 10); /* 2**10 = 1kb */
-#endif
+ sp->vsz >>= 10; /* vsize is in bytes and we want kb */
}
if (flags & PSSCAN_CMD) {
@@ -230,7 +225,6 @@ procps_status_t* procps_scan(procps_status_t* sp, int flags)
tty_pgrp,
task->flags,
min_flt,
-
cmin_flt,
maj_flt,
cmaj_flt,