diff options
| author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2000-06-21 22:06:56 +0000 |
|---|---|---|
| committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2000-06-21 22:06:56 +0000 |
| commit | 777114d3e37eddf58bfb5dfa44a58248d8780fc7 (patch) | |
| tree | a0e161287c8d061bf0a0c7ed445a0597286b1b2f /examples | |
| parent | 41806cd9d74f7731b283a22bbfcf1541623fb98c (diff) | |
| download | busybox-w32-777114d3e37eddf58bfb5dfa44a58248d8780fc7.tar.gz busybox-w32-777114d3e37eddf58bfb5dfa44a58248d8780fc7.tar.bz2 busybox-w32-777114d3e37eddf58bfb5dfa44a58248d8780fc7.zip | |
Add in my little patch for 2.4.x to make sysinfo binary compatable (again)
-Erik
git-svn-id: svn://busybox.net/trunk/busybox@685 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/kernel-patches/2.4.x-revert-sysinfo.patch | 77 | ||||
| -rw-r--r-- | examples/kernel-patches/WillThisGoIntoTheKernel | 11 |
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 000000000..c7cd5a770 --- /dev/null +++ b/examples/kernel-patches/2.4.x-revert-sysinfo.patch | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | I 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 | |||
| 9 | while 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 | |||
| 16 | After investigating the problem, it turns out that somewhere during 2.3.x the | ||
| 17 | values for memory stored in struct sysinfo changed from being stored as bytes | ||
| 18 | to being units of PAGE_SIZE, but kernel/info.c was never updated to reflect | ||
| 19 | this change in definition. | ||
| 20 | |||
| 21 | Breaking free isn't that big of a deal, but I also use sysinfo in init to check | ||
| 22 | that 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. | ||
| 24 | BusyBox is often used in embedded systems where /proc is not compiled in). | ||
| 25 | |||
| 26 | The following patch reinstates the traditional sysinfo(2) interface by | ||
| 27 | returning bytes (not units of PAGE_SIZE) for memory values. | ||
| 28 | |||
| 29 | An additional patch suggestion (not included here) would be to eliminate the | ||
| 30 | supurfluous "mem_unit" variable from struct_sysinfo in include/linux/kernel.h | ||
| 31 | and arch/*/mm/init.c. | ||
| 32 | |||
| 33 | -Erik | ||
| 34 | |||
| 35 | -- | ||
| 36 | Erik 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 | |||
diff --git a/examples/kernel-patches/WillThisGoIntoTheKernel b/examples/kernel-patches/WillThisGoIntoTheKernel index f67fe4a75..33ee8b47e 100644 --- a/examples/kernel-patches/WillThisGoIntoTheKernel +++ b/examples/kernel-patches/WillThisGoIntoTheKernel | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | I have been asked several times whether the devps patch will go into the | ||
| 2 | mainline Linux kernel. The following emails from Alan Cox and Linux Torvalds | ||
| 3 | make it clear that it is not going to happen. This does not mean this patch | ||
| 4 | had no value -- it does. It just means that those that like it get to apply it | ||
| 5 | themselves... | ||
| 6 | |||
| 7 | -Erik | ||
| 8 | |||
| 9 | |||
| 10 | ------------------------------- | ||
| 11 | |||
| 1 | From alan@lxorguk.ukuu.org.uk Thu Apr 13 08:07:22 2000 | 12 | From alan@lxorguk.ukuu.org.uk Thu Apr 13 08:07:22 2000 |
| 2 | Return-Path: <alan@lxorguk.ukuu.org.uk> | 13 | Return-Path: <alan@lxorguk.ukuu.org.uk> |
| 3 | Delivered-To: andersen@dillweed.dsl.xmission.com | 14 | Delivered-To: andersen@dillweed.dsl.xmission.com |
