diff options
Diffstat (limited to 'src/tramp.c')
-rw-r--r-- | src/tramp.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/tramp.c b/src/tramp.c index 265aeaa..19707fb 100644 --- a/src/tramp.c +++ b/src/tramp.c @@ -1,5 +1,6 @@ /* ----------------------------------------------------------------------- tramp.c - Copyright (c) 2020 Madhavan T. Venkataraman + Copyright (c) 2022 Anthony Green API and support functions for managing statically defined closure trampolines. @@ -34,7 +35,7 @@ * Add support for other OSes later. For now, it is just Linux. */ -#if defined __linux__ +#if defined (__linux__) || defined (__CYGWIN__) #ifdef __linux__ #define _GNU_SOURCE 1 #endif @@ -50,7 +51,10 @@ #include <linux/limits.h> #include <linux/types.h> #endif -#endif /* __linux__ */ +#ifdef __CYGWIN__ +#include <linux/limits.h> +#endif +#endif /* * Each architecture defines static code for a trampoline code table. The @@ -191,7 +195,7 @@ static struct tramp_globals tramp_globals; */ static int tramp_table_alloc (void); -#if defined __linux__ +#if defined (__linux__) || defined (__CYGWIN__) static int ffi_tramp_get_libffi (void) @@ -245,9 +249,9 @@ ffi_tramp_get_libffi (void) return 1; } -#endif /* __linux__ */ +#endif /* defined (__linux__) || defined (__CYGWIN__) */ -#if defined __linux__ +#if defined (__linux__) || defined (__CYGWIN__) #if defined HAVE_MKSTEMP @@ -294,11 +298,11 @@ ffi_tramp_get_temp_file (void) #endif /* defined HAVE_MKSTEMP */ -#endif /* __linux__ */ +#endif /* defined (__linux__) || defined (__CYGWIN__) */ /* ------------------------ OS-specific Initialization ----------------------*/ -#if defined __linux__ +#if defined (__linux__) || defined (__CYGWIN__) static int ffi_tramp_init_os (void) @@ -308,11 +312,11 @@ ffi_tramp_init_os (void) return ffi_tramp_get_temp_file (); } -#endif /* __linux__ */ +#endif /* defined (__linux__) || defined (__CYGWIN__) */ /* --------------------------- OS-specific Locking -------------------------*/ -#if defined __linux__ +#if defined (__linux__) || defined (__CYGWIN__) static pthread_mutex_t tramp_globals_mutex = PTHREAD_MUTEX_INITIALIZER; @@ -328,7 +332,7 @@ ffi_tramp_unlock() pthread_mutex_unlock (&tramp_globals_mutex); } -#endif /* __linux__ */ +#endif /* defined (__linux__) || defined (__CYGWIN__) */ /* ------------------------ OS-specific Memory Mapping ----------------------*/ @@ -347,7 +351,7 @@ ffi_tramp_unlock() * sizeof (struct tramp_parm) cannot exceed the size of a parameter block. */ -#if defined __linux__ +#if defined (__linux__) || defined (__CYGWIN__) static int tramp_table_map (struct tramp_table *table) @@ -384,7 +388,7 @@ tramp_table_unmap (struct tramp_table *table) (void) munmap (table->parm_table, tramp_globals.map_size); } -#endif /* __linux__ */ +#endif /* defined (__linux__) || defined (__CYGWIN__) */ /* ------------------------ Trampoline Initialization ----------------------*/ |