/[packages]/cauldron/coreutils/current/SOURCES/coreutils-8.3-mem.patch
ViewVC logotype

Contents of /cauldron/coreutils/current/SOURCES/coreutils-8.3-mem.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 128 - (show annotations) (download)
Tue Jan 4 18:25:29 2011 UTC (13 years, 3 months ago) by tmb
File size: 968 byte(s)
imported package coreutils
1 --- coreutils-8.3/lib/physmem.c.orig 2010-01-04 17:19:05.000000000 +0100
2 +++ coreutils-8.3/lib/physmem.c 2010-01-11 07:05:15.000000000 +0100
3 @@ -77,6 +77,14 @@
4
5 #define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
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 @@ -86,7 +94,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
27 @@ -98,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);
33 }
34 }
35 #endif

  ViewVC Help
Powered by ViewVC 1.1.30