diff options
author | Wayne Meissner <wmeissner@gmail.com> | 2013-05-10 15:28:53 -0700 |
---|---|---|
committer | Wayne Meissner <wmeissner@gmail.com> | 2013-05-10 15:28:53 -0700 |
commit | 84bc9330bacf4782d7dbba7ce9ddcbf1afad8e65 (patch) | |
tree | 52db3c7433d0c26fecc8c57bee91ac6ac40fb89b | |
parent | 719f234618a7caf694b806d57c29a1062bfc9a2d (diff) | |
parent | fbffb4d15d10ae84464aecb844834fcb80be1ae3 (diff) | |
download | ffi-84bc9330bacf4782d7dbba7ce9ddcbf1afad8e65.tar.gz |
Merge pull request #265 from kuwa72/issue263_2
Fix compile error for cygwin1.7.18, add check __CYGWIN__ macro.
-rw-r--r-- | ext/ffi_c/ClosurePool.c | 12 | ||||
-rw-r--r-- | ext/ffi_c/Thread.c | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/ext/ffi_c/ClosurePool.c b/ext/ffi_c/ClosurePool.c index bcc2051..4e6637b 100644 --- a/ext/ffi_c/ClosurePool.c +++ b/ext/ffi_c/ClosurePool.c @@ -21,7 +21,7 @@ #include <sys/param.h> #endif #include <sys/types.h> -#ifndef _WIN32 +#if defined(__CYGWIN__) || !defined(_WIN32) # include <sys/mman.h> #endif #include <stdio.h> @@ -32,7 +32,7 @@ # include "win32/stdbool.h" # include "win32/stdint.h" #endif -#ifndef _WIN32 +#if defined(__CYGWIN__) || !defined(_WIN32) # include <unistd.h> #else # include <winsock2.h> @@ -225,7 +225,7 @@ rbffi_Closure_CodeAddress(Closure* handle) static long getPageSize() { -#if defined(_WIN32) || defined(__WIN32__) +#if !defined(__CYGWIN__) && (defined(_WIN32) || defined(__WIN32__)) SYSTEM_INFO si; GetSystemInfo(&si); return si.dwPageSize; @@ -237,7 +237,7 @@ getPageSize() static void* allocatePage(void) { -#if defined(_WIN32) || defined(__WIN32__) +#if !defined(__CYGWIN__) && (defined(_WIN32) || defined(__WIN32__)) return VirtualAlloc(NULL, pageSize, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); #else caddr_t page = mmap(NULL, pageSize, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0); @@ -248,7 +248,7 @@ allocatePage(void) static bool freePage(void *addr) { -#if defined(_WIN32) || defined(__WIN32__) +#if !defined(__CYGWIN__) && (defined(_WIN32) || defined(__WIN32__)) return VirtualFree(addr, 0, MEM_RELEASE); #else return munmap(addr, pageSize) == 0; @@ -258,7 +258,7 @@ freePage(void *addr) static bool protectPage(void* page) { -#if defined(_WIN32) || defined(__WIN32__) +#if !defined(__CYGWIN__) && (defined(_WIN32) || defined(__WIN32__)) DWORD oldProtect; return VirtualProtect(page, pageSize, PAGE_EXECUTE_READ, &oldProtect); #else diff --git a/ext/ffi_c/Thread.c b/ext/ffi_c/Thread.c index a67a6ed..20c8a3d 100644 --- a/ext/ffi_c/Thread.c +++ b/ext/ffi_c/Thread.c @@ -25,7 +25,7 @@ # include "win32/stdint.h" #endif -#ifndef _WIN32 +#if defined(__CYGWIN__) || !defined(_WIN32) # include <pthread.h> # include <errno.h> # include <signal.h> |