svn commit: trunk/busybox: include procps

vda at busybox.net vda at busybox.net
Wed Aug 29 18:23:37 UTC 2007


Author: vda
Date: 2007-08-29 11:23:36 -0700 (Wed, 29 Aug 2007)
New Revision: 19735

Log:
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.



Modified:
   trunk/busybox/include/libbb.h
   trunk/busybox/procps/ps.c


Changeset:
Modified: trunk/busybox/include/libbb.h
===================================================================
--- trunk/busybox/include/libbb.h	2007-08-29 18:18:08 UTC (rev 19734)
+++ trunk/busybox/include/libbb.h	2007-08-29 18:23:36 UTC (rev 19735)
@@ -891,7 +891,7 @@
 	USE_SELINUX(char *context;)
 	/* Everything below must contain no ptrs to malloc'ed data:
 	 * it is memset(0) for each process in procps_scan() */
-	unsigned vsz, rss; /* we round it to kbytes */
+	unsigned long vsz, rss; /* we round it to kbytes */
 	unsigned long stime, utime;
 	unsigned pid;
 	unsigned ppid;

Modified: trunk/busybox/procps/ps.c
===================================================================
--- trunk/busybox/procps/ps.c	2007-08-29 18:18:08 UTC (rev 19734)
+++ trunk/busybox/procps/ps.c	2007-08-29 18:23:36 UTC (rev 19735)
@@ -48,7 +48,7 @@
 	sprintf(buf, "%*u", size, ps->pgid);
 }
 
-static void put_u(char *buf, int size, unsigned u)
+static void put_lu(char *buf, int size, unsigned long u)
 {
 	char buf5[5];
 	smart_ulltoa5( ((unsigned long long)u) << 10, buf5);
@@ -57,12 +57,12 @@
 
 static void func_vsz(char *buf, int size, const procps_status_t *ps)
 {
-	put_u(buf, size, ps->vsz);
+	put_lu(buf, size, ps->vsz);
 }
 
 static void func_rss(char *buf, int size, const procps_status_t *ps)
 {
-	put_u(buf, size, ps->rss);
+	put_lu(buf, size, ps->rss);
 }
 
 static void func_tty(char *buf, int size, const procps_status_t *ps)
@@ -405,7 +405,7 @@
 				len = printf("%5u %-8s        %s ",
 					p->pid, user, p->state);
 			else
-				len = printf("%5u %-8s %6u %s ",
+				len = printf("%5u %-8s %6lu %s ",
 					p->pid, user, p->vsz, p->state);
 		}
 




More information about the busybox-cvs mailing list