mirror of
https://github.com/janet-lang/janet
synced 2024-11-25 01:37:19 +00:00
Add MAP_ANON instead of MAP_ANONYMOUS for mac
This commit is contained in:
parent
7a3d055012
commit
9ba2b40e87
@ -1292,8 +1292,11 @@ JANET_CORE_FN(cfun_ffi_jitfn,
|
||||
fn->size = 0;
|
||||
#ifdef JANET_WINDOWS
|
||||
void *ptr = VirtualAlloc(NULL, bytes.len, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
|
||||
#else
|
||||
#elif defined(MAP_ANONYMOUS)
|
||||
void *ptr = mmap(0, bytes.len, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
#else
|
||||
/* macos doesn't have MAP_ANONYMOUS */
|
||||
void *ptr = mmap(0, bytes.len, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
|
||||
#endif
|
||||
if (!ptr) {
|
||||
janet_panic("failed to memory map writable memory");
|
||||
|
Loading…
Reference in New Issue
Block a user