diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-08-29 18:23:36 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-08-29 18:23:36 +0000 |
commit | fc1e9951c6393f9b0e42d9a7fa2899b8618b21f8 (patch) | |
tree | ee5fdd64596f2b9171f333d7b623328e479f67f2 | |
parent | 8bdba4d011887ce77cd6de93859cacf7adea391e (diff) | |
download | busybox-w32-fc1e9951c6393f9b0e42d9a7fa2899b8618b21f8.tar.gz busybox-w32-fc1e9951c6393f9b0e42d9a7fa2899b8618b21f8.tar.bz2 busybox-w32-fc1e9951c6393f9b0e42d9a7fa2899b8618b21f8.zip |
vsz and rss are unsigned longs (ulong ~= width of void* =>
suitable for expressing total RAM in system). We account
for "32 bit in 64 bit" systems by storing kbytes, not bytes
there. Should allow for up to ~2000 Gb RAM on 32 bits.
-rw-r--r-- | include/libbb.h | 2 | ||||
-rw-r--r-- | procps/ps.c | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/include/libbb.h b/include/libbb.h index 678c56109..6c6b4863c 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -891,7 +891,7 @@ typedef struct procps_status_t { | |||
891 | USE_SELINUX(char *context;) | 891 | USE_SELINUX(char *context;) |
892 | /* Everything below must contain no ptrs to malloc'ed data: | 892 | /* Everything below must contain no ptrs to malloc'ed data: |
893 | * it is memset(0) for each process in procps_scan() */ | 893 | * it is memset(0) for each process in procps_scan() */ |
894 | unsigned vsz, rss; /* we round it to kbytes */ | 894 | unsigned long vsz, rss; /* we round it to kbytes */ |
895 | unsigned long stime, utime; | 895 | unsigned long stime, utime; |
896 | unsigned pid; | 896 | unsigned pid; |
897 | unsigned ppid; | 897 | unsigned ppid; |
diff --git a/procps/ps.c b/procps/ps.c index 805fe0615..f5c801d20 100644 --- a/procps/ps.c +++ b/procps/ps.c | |||
@@ -48,7 +48,7 @@ static void func_pgid(char *buf, int size, const procps_status_t *ps) | |||
48 | sprintf(buf, "%*u", size, ps->pgid); | 48 | sprintf(buf, "%*u", size, ps->pgid); |
49 | } | 49 | } |
50 | 50 | ||
51 | static void put_u(char *buf, int size, unsigned u) | 51 | static void put_lu(char *buf, int size, unsigned long u) |
52 | { | 52 | { |
53 | char buf5[5]; | 53 | char buf5[5]; |
54 | smart_ulltoa5( ((unsigned long long)u) << 10, buf5); | 54 | smart_ulltoa5( ((unsigned long long)u) << 10, buf5); |
@@ -57,12 +57,12 @@ static void put_u(char *buf, int size, unsigned u) | |||
57 | 57 | ||
58 | static void func_vsz(char *buf, int size, const procps_status_t *ps) | 58 | static void func_vsz(char *buf, int size, const procps_status_t *ps) |
59 | { | 59 | { |
60 | put_u(buf, size, ps->vsz); | 60 | put_lu(buf, size, ps->vsz); |
61 | } | 61 | } |
62 | 62 | ||
63 | static void func_rss(char *buf, int size, const procps_status_t *ps) | 63 | static void func_rss(char *buf, int size, const procps_status_t *ps) |
64 | { | 64 | { |
65 | put_u(buf, size, ps->rss); | 65 | put_lu(buf, size, ps->rss); |
66 | } | 66 | } |
67 | 67 | ||
68 | static void func_tty(char *buf, int size, const procps_status_t *ps) | 68 | static void func_tty(char *buf, int size, const procps_status_t *ps) |
@@ -405,7 +405,7 @@ int ps_main(int argc, char **argv) | |||
405 | len = printf("%5u %-8s %s ", | 405 | len = printf("%5u %-8s %s ", |
406 | p->pid, user, p->state); | 406 | p->pid, user, p->state); |
407 | else | 407 | else |
408 | len = printf("%5u %-8s %6u %s ", | 408 | len = printf("%5u %-8s %6lu %s ", |
409 | p->pid, user, p->vsz, p->state); | 409 | p->pid, user, p->vsz, p->state); |
410 | } | 410 | } |
411 | 411 | ||