diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2001-01-15 15:25:00 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2001-01-15 15:25:00 +0300 |
commit | dc3651b6cd4546c653114ef635de091a3f7e5183 (patch) | |
tree | e6307df9e244c5286055877c40eb465477ce1b7b /winsup/cygwin/syscalls.cc | |
parent | 4cf2c0e0cb47b03d1cc5a9fedb5d6a9f628cd91e (diff) |
* 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/syscalls.cc')
-rw-r--r-- | winsup/cygwin/syscalls.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 0e6b631fa..df5103809 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... */ |