From dc8e006e4f2bd7d8de6d1f9776539764ef1263bd Mon Sep 17 00:00:00 2001 From: Jean Guyomarc'h Date: Thu, 21 Aug 2014 11:27:14 +0200 Subject: [PATCH] eo: mmap()/unmap() are also supported on OSX Reviewers: raster, raoulh @feature Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D1240 Signed-off-by: Cedric BAIL --- src/lib/eo/eo.c | 8 ++++---- src/lib/eo/eo_ptr_indirection.x | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c index b5aaadf306..187b24052f 100644 --- a/src/lib/eo/eo.c +++ b/src/lib/eo/eo.c @@ -289,7 +289,7 @@ typedef struct _Eo_Call_Stack { static void * _eo_call_stack_mem_alloc(size_t maxsize) { -#ifdef __linux__ +#if defined (__linux__) || defined (__MacOSX__) // allocate eo call stack via mmped anon segment if on linux - more // secure and safe. also gives page aligned memory allowing madvise void *ptr; @@ -307,10 +307,10 @@ _eo_call_stack_mem_alloc(size_t maxsize) #else //in regular cases just use malloc return calloc(1, maxsize); -#endif +#endif } -#ifdef __linux__ +#if defined (__linux__) || defined (__MacOSX__) static void _eo_call_stack_mem_resize(void **ptr EINA_UNUSED, size_t newsize, size_t maxsize) { @@ -331,7 +331,7 @@ _eo_call_stack_mem_resize(void **ptr EINA_UNUSED, size_t newsize EINA_UNUSED, si #endif } -#ifdef __linux__ +#if defined (__linux__) || defined (__MacOSX__) static void _eo_call_stack_mem_free(void *ptr, size_t maxsize) { diff --git a/src/lib/eo/eo_ptr_indirection.x b/src/lib/eo/eo_ptr_indirection.x index 4efe667e3c..5bba62d866 100644 --- a/src/lib/eo/eo_ptr_indirection.x +++ b/src/lib/eo/eo_ptr_indirection.x @@ -1,5 +1,5 @@ #include -#ifdef __linux__ +#if defined (__linux__) || defined (__MacOSX__) #include #include #include @@ -119,7 +119,7 @@ typedef struct _Mem_Header static void * _eo_id_mem_alloc(size_t size) { -#ifdef __linux__ +#if defined (__linux__) || defined (__MacOSX__) void *ptr; Mem_Header *hdr; size_t newsize; @@ -154,7 +154,7 @@ _eo_id_mem_calloc(size_t num, size_t size) static void _eo_id_mem_free(void *ptr) { -#ifdef __linux__ +#if defined (__linux__) || defined (__MacOSX__) Mem_Header *hdr; if (!ptr) return; hdr = (Mem_Header *)(((unsigned char *)ptr) - MEM_HEADER_SIZE); @@ -173,7 +173,7 @@ _eo_id_mem_free(void *ptr) static void _eo_id_mem_protect(void *ptr, Eina_Bool may_not_write) { -# ifdef __linux__ +# if defined (__linux__) || defined (__MacOSX__) Mem_Header *hdr; if (!ptr) return; hdr = (Mem_Header *)(((unsigned char *)ptr) - MEM_HEADER_SIZE); -- 2.34.1