]> granicus.if.org Git - gc/commitdiff
Fix 'un-mprotect failed' gctest error on Cygwin
authorIvan Maidanski <ivmai@mail.ru>
Wed, 10 Apr 2019 20:25:50 +0000 (23:25 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 10 Apr 2019 20:25:50 +0000 (23:25 +0300)
(fix of commit fa7f7a72b)

Issue #272 (bdwgc).

* include/private/gcconfig.h [(I386 || X86_64) && CYGWIN32]
(MPROTECT_VDB): Do not define if USE_WINALLOC.
* os_dep.c [CYGWIN32 && MPROTECT_VDB] (GC_setpagesize): Set
GC_page_size to dwAllocationGranularity.

include/private/gcconfig.h
os_dep.c

index 0c0aa825a441bedbce98a1ab38f39fc8c1c8dc1d..9b5e8b1d2efbc21df2b84b06b62efabd9f8dec2b 100644 (file)
@@ -1542,12 +1542,14 @@ EXTERN_C_BEGIN
 #       define OS_TYPE "CYGWIN32"
 #       define DATASTART ((ptr_t)GC_DATASTART)  /* From gc.h */
 #       define DATAEND   ((ptr_t)GC_DATAEND)
-#       define MPROTECT_VDB
 #       ifdef USE_WINALLOC
 #         define GWW_VDB
-#       elif defined(USE_MMAP)
-#         define NEED_FIND_LIMIT
-#         define USE_MMAP_ANON
+#       else
+#         define MPROTECT_VDB
+#         ifdef USE_MMAP
+#           define NEED_FIND_LIMIT
+#           define USE_MMAP_ANON
+#         endif
 #       endif
 #   endif
 #   ifdef INTERIX
@@ -2771,11 +2773,13 @@ EXTERN_C_BEGIN
 #   endif
 #   ifdef CYGWIN32
 #       define OS_TYPE "CYGWIN32"
-#       define MPROTECT_VDB
 #       ifdef USE_WINALLOC
 #         define GWW_VDB
-#       elif defined(USE_MMAP)
-#         define USE_MMAP_ANON
+#       else
+#         define MPROTECT_VDB
+#         ifdef USE_MMAP
+#           define USE_MMAP_ANON
+#         endif
 #       endif
 #   endif
 #   ifdef MSWIN_XBOX1
index 49f6a019094d2ce19a647bd958ca4569b40df27f..23a83e45ffcfab48ec43f5bfbb195eb1b75c4671 100644 (file)
--- a/os_dep.c
+++ b/os_dep.c
@@ -710,7 +710,7 @@ GC_INNER size_t GC_page_size = 0;
   GC_INNER void GC_setpagesize(void)
   {
     GetSystemInfo(&GC_sysinfo);
-#   if defined(CYGWIN32) && defined(USE_MUNMAP)
+#   if defined(CYGWIN32) && (defined(MPROTECT_VDB) || defined(USE_MUNMAP))
       /* Allocations made with mmap() are aligned to the allocation     */
       /* granularity, which (at least on 64-bit Windows OS) is not the  */
       /* same as the page size.  Probably a separate variable could     */