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 <cedric@osg.samsung.com>
This commit is contained in:
Jean Guyomarc'h 2014-08-21 11:27:14 +02:00 committed by Cedric BAIL
parent f449f0ddb6
commit dc8e006e4f
2 changed files with 8 additions and 8 deletions

View File

@ -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)
{

View File

@ -1,5 +1,5 @@
#include <assert.h>
#ifdef __linux__
#if defined (__linux__) || defined (__MacOSX__)
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@ -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);