Magellan Linux

Contents of /trunk/coreutils/patches-6.10/coreutils-5.3.0-mem.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 536 - (show annotations) (download)
Tue Mar 25 13:54:58 2008 UTC (16 years, 1 month ago) by niro
File size: 870 byte(s)
-coreutils-6.10

1 --- textutils-2.0.17/lib/physmem.c.cap Sun Apr 8 13:31:12 2001
2 +++ textutils-2.0.17/lib/physmem.c Sun Apr 8 13:41:37 2001
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 = 1L << (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 @@ -52,7 +60,7 @@
19 double pages = pss.physical_memory;
20 double pagesize = pss.page_size;
21 if (0 <= pages && 0 <= pagesize)
22 - return pages * pagesize;
23 + return physmem_cap(pages * pagesize);
24 }
25 }
26 #endif
27 @@ -84,7 +92,7 @@
28 double pages = psd.psd_free;
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