Work around a page size issue on Cygwin.
authorJay Foad <jay.foad@gmail.com>
Sat, 23 May 2009 17:57:59 +0000 (17:57 +0000)
committerJay Foad <jay.foad@gmail.com>
Sat, 23 May 2009 17:57:59 +0000 (17:57 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72332 91177308-0d34-0410-b5e6-96231b3b80d8

lib/System/Unix/Process.inc

index e4f37a1ff597057ad6795bc6a2a49cc2f40f8f60..74b9bb8b142a9d256e0994704537973cff08bbe2 100644 (file)
@@ -42,7 +42,12 @@ using namespace sys;
 unsigned 
 Process::GetPageSize() 
 {
-#if defined(HAVE_GETPAGESIZE)
+#if defined(__CYGWIN__)
+  // On Cygwin, getpagesize() returns 64k but the page size for the purposes of
+  // memory protection and mmap() is 4k.
+  // See http://www.cygwin.com/ml/cygwin/2009-01/threads.html#00492
+  static const int page_size = 0x1000;
+#elif defined(HAVE_GETPAGESIZE)
   static const int page_size = ::getpagesize();
 #elif defined(HAVE_SYSCONF)
   static long page_size = ::sysconf(_SC_PAGE_SIZE);