]> git.pld-linux.org Git - packages/coreutils.git/blame - coreutils-mem.patch
- partially update from fedora, fixes test suite
[packages/coreutils.git] / coreutils-mem.patch
CommitLineData
40ce7301
JB
1--- coreutils-4.5.3/lib/physmem.c.orig Fri Nov 16 10:20:25 2001
2+++ coreutils-4.5.3/lib/physmem.c Sun Oct 27 22:35:25 2002
3@@ -31,6 +31,14 @@
4 # include <sys/pstat.h>
5 #endif
6
7+/* Cap physical memory to something sane */
8+static double
9+physmem_cap (double mem)
10+{
11+ double max = 1 << (sizeof(void *)*8 - 4);
12+ return mem > max ? max : mem;
13+}
14+
15 /* Return the total amount of physical memory. */
16 double
17 physmem_total (void)
18@@ -40,7 +48,7 @@
19 double pages = sysconf (_SC_PHYS_PAGES);
20 double pagesize = sysconf (_SC_PAGESIZE);
21 if (0 <= pages && 0 <= pagesize)
22- return pages * pagesize;
23+ return physmem_cap(pages * pagesize);
24 }
25 #endif
26
d25e16ee
AM
27@@ -106,7 +106,7 @@
28 double pages = pss.physical_memory;
29 double pagesize = pss.page_size;
30 if (0 <= pages && 0 <= pagesize)
31- return pages * pagesize;
32+ return physmem_cap(pages * pagesize);
40ce7301
JB
33 }
34 }
35 #endif
d25e16ee 36
This page took 0.070756 seconds and 4 git commands to generate.