summaryrefslogtreecommitdiff
path: root/procps/ps.c
diff options
context:
space:
mode:
authorMike Frysinger2007-02-08 08:21:58 +0000
committerMike Frysinger2007-02-08 08:21:58 +0000
commit0aa6ba5d44af32d0bf460c8d92cda686bae64c92 (patch)
tree72424e60f565c397b8a2b10f88855f11b46c4010 /procps/ps.c
parent4423e5beefd6f17dfa836211899ee70edcc64a5b (diff)
downloadbusybox-0aa6ba5d44af32d0bf460c8d92cda686bae64c92.zip
busybox-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 'procps/ps.c')
-rw-r--r--procps/ps.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/procps/ps.c b/procps/ps.c
index f3d11b7..a9da807 100644
--- a/procps/ps.c
+++ b/procps/ps.c
@@ -47,10 +47,10 @@ static void func_pgid(char *buf, int size, const procps_status_t *ps)
snprintf(buf, size+1, "%*u", size, ps->pgid);
}
-static void func_rss(char *buf, int size, const procps_status_t *ps)
+static void func_vsz(char *buf, int size, const procps_status_t *ps)
{
char buf5[5];
- smart_ulltoa5( ((unsigned long long)ps->rss) << 10, buf5);
+ smart_ulltoa5( ((unsigned long long)ps->vsz) << 10, buf5);
snprintf(buf, size+1, "%.*s", size, buf5);
}
@@ -103,9 +103,9 @@ static const ps_out_t out_spec[] = {
// { "ruser" ,"RUSER" ,func_ruser ,PSSCAN_UIDGID,sizeof("RUSER" )-1 },
// { "time" ,"TIME" ,func_time ,PSSCAN_ ,sizeof("TIME" )-1 },
// { "tty" ,"TT" ,func_tty ,PSSCAN_ ,sizeof("TT" )-1 },
-// { "vsz" ,"VSZ" ,func_vsz ,PSSCAN_VSZ ,4 },
+ { "vsz" ,"VSZ" ,func_vsz ,PSSCAN_VSZ ,4 },
// Not mandated by POSIX:
- { "rss" ,"RSS" ,func_rss ,PSSCAN_RSS ,4 },
+// { "rss" ,"RSS" ,func_rss ,PSSCAN_RSS ,4 },
};
#define VEC_SIZE(v) ( sizeof(v) / sizeof((v)[0]) )
@@ -321,13 +321,13 @@ int ps_main(int argc, char **argv)
if (use_selinux)
puts(" PID Context Stat Command");
else
- puts(" PID Uid VmSize Stat Command");
+ puts(" PID Uid VSZ Stat Command");
while ((p = procps_scan(p, 0
| PSSCAN_PID
| PSSCAN_UIDGID
| PSSCAN_STATE
- | PSSCAN_RSS
+ | PSSCAN_VSZ
| PSSCAN_CMD
))) {
char *namecmd = p->cmd;
@@ -355,12 +355,12 @@ int ps_main(int argc, char **argv)
#endif
{
const char *user = get_cached_username(p->uid);
- if (p->rss == 0)
+ if (p->vsz == 0)
len = printf("%5u %-8s %s ",
p->pid, user, p->state);
else
len = printf("%5u %-8s %6ld %s ",
- p->pid, user, p->rss, p->state);
+ p->pid, user, p->vsz, p->state);
}
i = terminal_width-len;