diff options
author | Damien George <damien.p.george@gmail.com> | 2014-09-03 22:47:23 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-09-03 22:47:23 +0100 |
commit | dda46460fff56c0756adba0d63fd72b311bdbcc9 (patch) | |
tree | a93c903fe6e5e8b5f8078fb3555fa8049c1e340c /unix/alloc.c | |
parent | a669cbc690a2540f6a4cfe453fa4b5bab074d940 (diff) |
Code style/whitespace cleanup; remove obsolete headers.
And move the MAP_ANON redefinition from py/asmx64.c to unix/alloc.c.
Diffstat (limited to 'unix/alloc.c')
-rw-r--r-- | unix/alloc.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/unix/alloc.c b/unix/alloc.c index 2c09f1846..cb866c78a 100644 --- a/unix/alloc.c +++ b/unix/alloc.c @@ -30,8 +30,11 @@ #include "mpconfigport.h" -void mp_unix_alloc_exec(mp_uint_t min_size, void** ptr, mp_uint_t *size) -{ +#if defined(__OpenBSD__) || defined(__MACH__) +#define MAP_ANONYMOUS MAP_ANON +#endif + +void mp_unix_alloc_exec(mp_uint_t min_size, void **ptr, mp_uint_t *size) { // size needs to be a multiple of the page size *size = (min_size + 0xfff) & (~0xfff); *ptr = mmap(NULL, *size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); @@ -40,7 +43,6 @@ void mp_unix_alloc_exec(mp_uint_t min_size, void** ptr, mp_uint_t *size) } } -void mp_unix_free_exec(void *ptr, mp_uint_t size) -{ +void mp_unix_free_exec(void *ptr, mp_uint_t size) { munmap(ptr, size); } |