avoid calling GetSystemInfo too often.
* heap.cc (getpagesize): Eliminate.
(heap_init): Use getpagesize function from syscalls.cc.
+Mon Jan 15 12:48:00 2001 Corinna Vinschen <corinna@vinschen.de>
+
+ * syscalls.cc (getpagesize): Save pagesize in global variable to
+ avoid calling GetSystemInfo too often.
+ * heap.cc (getpagesize): Eliminate.
+ (heap_init): Use getpagesize function from syscalls.cc.
+
Mon Jan 15 11:56:00 2001 Corinna Vinschen <corinna@vinschen.de>
* sysconf.cc (sysconf): return `getpagesize ()' on _SC_PAGESIZE
static unsigned page_const = 0;
-static __inline__ int
-getpagesize(void)
-{
- SYSTEM_INFO si;
- GetSystemInfo(&si);
- return (int)si.dwPageSize;
-}
-
/* Initialize the heap at process start up. */
void
/* If we're the forkee, we must allocate the heap at exactly the same place
as our parent. If not, we don't care where it ends up. */
- page_const = getpagesize();
+ extern size_t getpagesize ();
+ page_const = getpagesize ();
if (brkbase)
{
DWORD chunk = brkchunk; /* allocation chunk */
return fdtab.size;
}
+static DWORD sys_page_size = 0;
+
extern "C" size_t
getpagesize ()
{
return sysconf (_SC_PAGESIZE);
+ if (!sys_page_size)
+ {
+ SYSTEM_INFO si;
+ GetSystemInfo(&si);
+ sys_page_size = si.dwPageSize;
+ }
+ return (int)sys_page_size;
}
/* FIXME: not all values are correct... */