summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2014-05-28 15:46:26 +0200
committerMike Pall <mike>2014-05-28 15:46:26 +0200
commit7fb503dc8682c97f3922f88494b0e4e5c9b9398e (patch)
tree39f97dfedb348053e502885cc8fa9ad9d0bf97ac
parent49d3157e146bc33b5b7c3a82ce00a8f824f6fa49 (diff)
downloadluajit2-7fb503dc8682c97f3922f88494b0e4e5c9b9398e.tar.gz
Fix compatibility issues with Illumos.
Thanks to Theo Schlossnagle.
-rw-r--r--src/lj_alloc.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lj_alloc.c b/src/lj_alloc.c
index f856a7a0..facccee5 100644
--- a/src/lj_alloc.c
+++ b/src/lj_alloc.c
@@ -179,11 +179,17 @@ static LJ_AINLINE int CALL_MUNMAP(void *ptr, size_t size)
#if defined(MAP_32BIT)
+#if defined(__sun__)
+#define MMAP_REGION_START ((uintptr_t)0x1000)
+#else
/* Actually this only gives us max. 1GB in current Linux kernels. */
+#define MMAP_REGION_START ((uintptr_t)0)
+#endif
+
static LJ_AINLINE void *CALL_MMAP(size_t size)
{
int olderr = errno;
- void *ptr = mmap(NULL, size, MMAP_PROT, MAP_32BIT|MMAP_FLAGS, -1, 0);
+ void *ptr = mmap((void *)MMAP_REGION_START, size, MMAP_PROT, MAP_32BIT|MMAP_FLAGS, -1, 0);
errno = olderr;
return ptr;
}