summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2000-06-27 06:22:09 +0000
committerEric Andersen <andersen@codepoet.org>2000-06-27 06:22:09 +0000
commitcb1d841f0943fc1550a5f93be62d5cedab95ecfc (patch)
tree80d6108f49cd9fcbb2e9a87e0f1ec84b1ab7ecaf /examples
parent27b5924b96fc71a6f70ea1a13a5232fca2439e7d (diff)
downloadbusybox-w32-cb1d841f0943fc1550a5f93be62d5cedab95ecfc.tar.gz
busybox-w32-cb1d841f0943fc1550a5f93be62d5cedab95ecfc.tar.bz2
busybox-w32-cb1d841f0943fc1550a5f93be62d5cedab95ecfc.zip
This kernel patch is no longer needed, with the change I made to init
and free... -Erik
Diffstat (limited to 'examples')
-rw-r--r--examples/kernel-patches/2.4.x-revert-sysinfo.patch77
1 files changed, 0 insertions, 77 deletions
diff --git a/examples/kernel-patches/2.4.x-revert-sysinfo.patch b/examples/kernel-patches/2.4.x-revert-sysinfo.patch
deleted file mode 100644
index c7cd5a770..000000000
--- a/examples/kernel-patches/2.4.x-revert-sysinfo.patch
+++ /dev/null
@@ -1,77 +0,0 @@
1I have a version of free I wrote for BusyBox that uses sysinfo (rather then
2/proc) to get its information. Under 2.2.x it reports normal stuff, i.e.
3 [andersen@dillweed busybox]$ ./free
4 total used free shared buffers
5 Mem: 127800 124268 3532 16956 7544
6 Swap: 128516 13584 114932
7 Total: 256316 137852 118464
8
9while under 2.2.0-test1-ac7 it reports wierd numbers (~ #/4096)
10 [andersen@dillweed busybox]$ ./free
11 total used free shared buffers
12 Mem: 30 11 19 0 1
13 Swap: 31 0 31
14 Total: 61 11 50
15
16After investigating the problem, it turns out that somewhere during 2.3.x the
17values for memory stored in struct sysinfo changed from being stored as bytes
18to being units of PAGE_SIZE, but kernel/info.c was never updated to reflect
19this change in definition.
20
21Breaking free isn't that big of a deal, but I also use sysinfo in init to check
22that the box has enough ram from within the init process (and no, mounting
23/proc from within init and reading /proc/meminfo is not a good solution.
24BusyBox is often used in embedded systems where /proc is not compiled in).
25
26The following patch reinstates the traditional sysinfo(2) interface by
27returning bytes (not units of PAGE_SIZE) for memory values.
28
29An additional patch suggestion (not included here) would be to eliminate the
30supurfluous "mem_unit" variable from struct_sysinfo in include/linux/kernel.h
31and arch/*/mm/init.c.
32
33 -Erik
34
35--
36Erik B. Andersen Web: http://www.xmission.com/~andersen/
37 email: andersee@debian.org
38--This message was written using 73% post-consumer electrons--
39
40--- linux/kernel/info.c.orig Mon Aug 23 12:15:53 1999
41+++ linux/kernel/info.c Sun Jun 4 01:13:11 2000
42@@ -2,6 +2,8 @@
43 * linux/kernel/info.c
44 *
45 * Copyright (C) 1992 Darren Senn
46+ * Fixed to once again return bytes instead of page counts,
47+ * June 2000, by Erik Andersen <andersee@debian.org>
48 */
49
50 /* This implements the sysinfo() system call */
51@@ -10,7 +12,6 @@
52 #include <linux/unistd.h>
53 #include <linux/swap.h>
54 #include <linux/smp_lock.h>
55-
56 #include <asm/uaccess.h>
57
58 asmlinkage long sys_sysinfo(struct sysinfo *info)
59@@ -31,6 +32,17 @@
60
61 si_meminfo(&val);
62 si_swapinfo(&val);
63+
64+ /* These are in units of PAGE_SIZE, but this interface
65+ * has always returned bytes. Make it return bytes */
66+ val.totalram*=PAGE_SIZE;
67+ val.freeram*=PAGE_SIZE;
68+ val.sharedram*=PAGE_SIZE;
69+ val.bufferram*=PAGE_SIZE;
70+ val.totalswap*=PAGE_SIZE;
71+ val.freeswap*=PAGE_SIZE;
72+ val.totalhigh*=PAGE_SIZE;
73+ val.freehigh*=PAGE_SIZE;
74
75 if (copy_to_user(info, &val, sizeof(struct sysinfo)))
76 return -EFAULT;
77