aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2001-01-15 12:25:00 +0000
committerCorinna Vinschen <corinna@vinschen.de>2001-01-15 12:25:00 +0000
commitdc3651b6cd4546c653114ef635de091a3f7e5183 (patch)
treee6307df9e244c5286055877c40eb465477ce1b7b /winsup/cygwin
parent4cf2c0e0cb47b03d1cc5a9fedb5d6a9f628cd91e (diff)
downloadnewlib-dc3651b6cd4546c653114ef635de091a3f7e5183.zip
newlib-dc3651b6cd4546c653114ef635de091a3f7e5183.tar.gz
newlib-dc3651b6cd4546c653114ef635de091a3f7e5183.tar.bz2
* 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.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/ChangeLog7
-rw-r--r--winsup/cygwin/heap.cc11
-rw-r--r--winsup/cygwin/syscalls.cc9
3 files changed, 18 insertions, 9 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 673cd0a..f236f11 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -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
diff --git a/winsup/cygwin/heap.cc b/winsup/cygwin/heap.cc
index db3edb0..d2934f2 100644
--- a/winsup/cygwin/heap.cc
+++ b/winsup/cygwin/heap.cc
@@ -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 */
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 0e6b631..df51038 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -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... */