]> sourceware.org Git - newlib-cygwin.git/commitdiff
* syscalls.cc (getpagesize): Save pagesize in global variable to
authorCorinna Vinschen <corinna@vinschen.de>
Mon, 15 Jan 2001 12:25:00 +0000 (12:25 +0000)
committerCorinna Vinschen <corinna@vinschen.de>
Mon, 15 Jan 2001 12:25:00 +0000 (12:25 +0000)
        avoid calling GetSystemInfo too often.
        * heap.cc (getpagesize): Eliminate.
        (heap_init): Use getpagesize function from syscalls.cc.

winsup/cygwin/ChangeLog
winsup/cygwin/heap.cc
winsup/cygwin/syscalls.cc

index 673cd0ae7ab0a680ddebf3aa561ed003c44297b5..f236f117cb7de01eda307c551a4d7bf733396f55 100644 (file)
@@ -1,3 +1,10 @@
+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
index db3edb00fe66d400c1d8199a29f59c6b15c1105e..d2934f2d6a1ca8274d218f7356cffa2115b6e372 100644 (file)
@@ -21,14 +21,6 @@ details. */
 
 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
@@ -37,7 +29,8 @@ heap_init ()
   /* 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 */
index 0e6b631fa34f845a6fce2ea394ff8b809fbf76c9..df51038099419cba859fef49475e6a55b3204d41 100644 (file)
@@ -1353,10 +1353,19 @@ getdtablesize ()
   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... */
This page took 0.036575 seconds and 5 git commands to generate.