Messages in this thread Patch in this message |  | | Date | Sun, 20 Aug 2000 08:52:01 -0600 | From | Erik Andersen <> | Subject | Re: Updated Linux 2.4 issues page |
| |
On Sun Aug 20, 2000 at 04:26:58AM -0400, Theodore Ts'o wrote: > > OK, here's the latest Linux 2.4 issues/bug list, to celebrate the > rebirth of the linux-kernel list. :-) > > 9. To Do > > * Fix sysinfo interface so it is binary compatible with 2.2.x (i.e. > mem_unit=1), except when memory >= 4Gb (Erik Andersen)
Should now be "Fix Exists But Isnt Merged". Patch already sent to Linus. The patch is included here as well.
-Erik
-- Erik B. Andersen email: andersee@debian.org --This message was written using 73% post-consumer electrons--
--- linux-2.4.0-test6.virgin/kernel/info.c Mon Aug 23 12:15:53 1999 +++ linux/kernel/info.c Fri Aug 18 15:22:35 2000 @@ -32,6 +32,40 @@ si_meminfo(&val); si_swapinfo(&val); + { + /* If the sum of all the available memory (i.e. ram + swap + + * highmem) is less then can be stored in a 32 bit unsigned long + * then we can be binary compatable with 2.2.x kernels. If not, + * well, who cares since in that case 2.2.x was broken anyways... + * + * -Erik Andersen <andersee@debian.org> */ + + unsigned long mem_total = val.totalram + val.totalswap + val.totalhigh; + + /* If mem_total did not overflow. Divide all memory values by + * mem_unit and set mem_unit=1. This leaves things compatable with + * 2.2.x, and also retains compatability with earlier 2.4.x + * kernels... */ + if ( !(mem_total < val.totalram || mem_total < val.totalswap || + mem_total < val.totalhigh) ) + { + int bitcount = 0; + while (val.mem_unit > 1) + { + bitcount++; + val.mem_unit >>= 1; + } + val.totalram <<= bitcount; + val.freeram <<= bitcount; + val.sharedram <<= bitcount; + val.bufferram <<= bitcount; + val.totalswap <<= bitcount; + val.freeswap <<= bitcount; + val.totalhigh <<= bitcount; + val.freehigh <<= bitcount; + } + } + if (copy_to_user(info, &val, sizeof(struct sysinfo))) return -EFAULT; return 0;
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/
|  |