aboutsummaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2000-09-10 16:13:41 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2000-09-10 16:13:41 +0000
commit78dc631c98a0a7f795e4e95123fa35e111554d18 (patch)
tree291171dd2b4184f214acb798c0fa6ffce2b938e3 /init
parent8c1b0e80c845e28f2ccd6efafd82f09879e796f8 (diff)
downloadbusybox-w32-78dc631c98a0a7f795e4e95123fa35e111554d18.tar.gz
busybox-w32-78dc631c98a0a7f795e4e95123fa35e111554d18.tar.bz2
busybox-w32-78dc631c98a0a7f795e4e95123fa35e111554d18.zip
Make init handle current 2.4.x sysinfo behavior
-Erik git-svn-id: svn://busybox.net/trunk/busybox@1028 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'init')
-rw-r--r--init/init.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/init/init.c b/init/init.c
index 91a72550b..b532ea88f 100644
--- a/init/init.c
+++ b/init/init.c
@@ -296,20 +296,17 @@ static int check_free_memory()
296 printf("Error checking free memory: %s\n", strerror(errno)); 296 printf("Error checking free memory: %s\n", strerror(errno));
297 return -1; 297 return -1;
298 } 298 }
299 /* Kernels prior to 2.4.x will return info.mem_unit==0, so cope... */
299 if (info.mem_unit==0) { 300 if (info.mem_unit==0) {
300 /* Looks like we have a kernel prior to Linux 2.4.x */ 301 info.mem_unit=1;
301 info.mem_unit=1024;
302 info.totalram/=info.mem_unit;
303 info.totalswap/=info.mem_unit;
304 } else {
305 /* Bah. Linux 2.4.x completely changed sysinfo. This can in theory
306 overflow a 32 bit unsigned long, but who puts more then 4GiB ram+swap
307 on an embedded system? */
308 info.mem_unit/=1024;
309 info.totalram*=info.mem_unit;
310 info.totalswap*=info.mem_unit;
311 } 302 }
312 303 info.mem_unit*=1024;
304
305 /* Note: These values can in theory overflow a 32 bit unsigned long (i.e.
306 * mem >= Gib), but who puts more then 4GiB ram+swap on an embedded
307 * system? */
308 info.totalram/=info.mem_unit;
309 info.totalswap/=info.mem_unit;
313 return(info.totalram+info.totalswap); 310 return(info.totalram+info.totalswap);
314} 311}
315 312