summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen2000-06-21 22:06:56 +0000
committerEric Andersen2000-06-21 22:06:56 +0000
commitc5c5e3d1449848153971704a24ab854264f09d74 (patch)
treea0e161287c8d061bf0a0c7ed445a0597286b1b2f
parentafa0662860253fa74c2588ffffb7f87bac64a547 (diff)
downloadbusybox-c5c5e3d1449848153971704a24ab854264f09d74.zip
busybox-c5c5e3d1449848153971704a24ab854264f09d74.tar.gz
Add in my little patch for 2.4.x to make sysinfo binary compatable (again)
-Erik
-rw-r--r--examples/kernel-patches/2.4.x-revert-sysinfo.patch77
-rw-r--r--examples/kernel-patches/WillThisGoIntoTheKernel11
2 files changed, 88 insertions, 0 deletions
diff --git a/examples/kernel-patches/2.4.x-revert-sysinfo.patch b/examples/kernel-patches/2.4.x-revert-sysinfo.patch
new file mode 100644
index 0000000..c7cd5a7
--- /dev/null
+++ b/examples/kernel-patches/2.4.x-revert-sysinfo.patch
@@ -0,0 +1,77 @@
+I have a version of free I wrote for BusyBox that uses sysinfo (rather then
+/proc) to get its information. Under 2.2.x it reports normal stuff, i.e.
+ [andersen@dillweed busybox]$ ./free
+ total used free shared buffers
+ Mem: 127800 124268 3532 16956 7544
+ Swap: 128516 13584 114932
+ Total: 256316 137852 118464
+
+while under 2.2.0-test1-ac7 it reports wierd numbers (~ #/4096)
+ [andersen@dillweed busybox]$ ./free
+ total used free shared buffers
+ Mem: 30 11 19 0 1
+ Swap: 31 0 31
+ Total: 61 11 50
+
+After investigating the problem, it turns out that somewhere during 2.3.x the
+values for memory stored in struct sysinfo changed from being stored as bytes
+to being units of PAGE_SIZE, but kernel/info.c was never updated to reflect
+this change in definition.
+
+Breaking free isn't that big of a deal, but I also use sysinfo in init to check
+that the box has enough ram from within the init process (and no, mounting
+/proc from within init and reading /proc/meminfo is not a good solution.
+BusyBox is often used in embedded systems where /proc is not compiled in).
+
+The following patch reinstates the traditional sysinfo(2) interface by
+returning bytes (not units of PAGE_SIZE) for memory values.
+
+An additional patch suggestion (not included here) would be to eliminate the
+supurfluous "mem_unit" variable from struct_sysinfo in include/linux/kernel.h
+and arch/*/mm/init.c.
+
+ -Erik
+
+--
+Erik B. Andersen Web: http://www.xmission.com/~andersen/
+ email: andersee@debian.org
+--This message was written using 73% post-consumer electrons--
+
+--- linux/kernel/info.c.orig Mon Aug 23 12:15:53 1999
++++ linux/kernel/info.c Sun Jun 4 01:13:11 2000
+@@ -2,6 +2,8 @@
+ * linux/kernel/info.c
+ *
+ * Copyright (C) 1992 Darren Senn
++ * Fixed to once again return bytes instead of page counts,
++ * June 2000, by Erik Andersen <andersee@debian.org>
+ */
+
+ /* This implements the sysinfo() system call */
+@@ -10,7 +12,6 @@
+ #include <linux/unistd.h>
+ #include <linux/swap.h>
+ #include <linux/smp_lock.h>
+-
+ #include <asm/uaccess.h>
+
+ asmlinkage long sys_sysinfo(struct sysinfo *info)
+@@ -31,6 +32,17 @@
+
+ si_meminfo(&val);
+ si_swapinfo(&val);
++
++ /* These are in units of PAGE_SIZE, but this interface
++ * has always returned bytes. Make it return bytes */
++ val.totalram*=PAGE_SIZE;
++ val.freeram*=PAGE_SIZE;
++ val.sharedram*=PAGE_SIZE;
++ val.bufferram*=PAGE_SIZE;
++ val.totalswap*=PAGE_SIZE;
++ val.freeswap*=PAGE_SIZE;
++ val.totalhigh*=PAGE_SIZE;
++ val.freehigh*=PAGE_SIZE;
+
+ if (copy_to_user(info, &val, sizeof(struct sysinfo)))
+ return -EFAULT;
+
diff --git a/examples/kernel-patches/WillThisGoIntoTheKernel b/examples/kernel-patches/WillThisGoIntoTheKernel
index f67fe4a..33ee8b4 100644
--- a/examples/kernel-patches/WillThisGoIntoTheKernel
+++ b/examples/kernel-patches/WillThisGoIntoTheKernel
@@ -1,3 +1,14 @@
+I have been asked several times whether the devps patch will go into the
+mainline Linux kernel. The following emails from Alan Cox and Linux Torvalds
+make it clear that it is not going to happen. This does not mean this patch
+had no value -- it does. It just means that those that like it get to apply it
+themselves...
+
+ -Erik
+
+
+-------------------------------
+
From alan@lxorguk.ukuu.org.uk Thu Apr 13 08:07:22 2000
Return-Path: <alan@lxorguk.ukuu.org.uk>
Delivered-To: andersen@dillweed.dsl.xmission.com