summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2017-07-12 10:04:48 +0200
committerEugen Wissner <belka@caraus.de>2017-07-12 10:04:48 +0200
commit839c740cb1896fd3715cd271068ac1f8a286a2dd (patch)
treed286036f16748b12bedb06f7933b7304e7700454
parent2bd612fd197232645e5617d8041949912e3e7918 (diff)
downloadtanya-839c740cb1896fd3715cd271068ac1f8a286a2dd.tar.gz
Fix mmap flags on linux
-rw-r--r--source/tanya/memory/mmappool.d10
1 files changed, 6 insertions, 4 deletions
diff --git a/source/tanya/memory/mmappool.d b/source/tanya/memory/mmappool.d
index 7e8dac9..9f59afc 100644
--- a/source/tanya/memory/mmappool.d
+++ b/source/tanya/memory/mmappool.d
@@ -18,6 +18,8 @@ import tanya.memory.allocator;
version (Posix)
{
+ import core.sys.posix.sys.mman : PROT_READ, PROT_WRITE, MAP_PRIVATE,
+ MAP_ANON, MAP_FAILED;
import core.sys.posix.unistd;
extern (C)
@@ -35,11 +37,11 @@ version (Posix)
{
void* p = mmap(null,
len,
- 0x01 | 0x02, // PROT_READ | PROT_WRITE
- 0x0002 | 0x1000, // MAP_PRIVATE | MAP_ANON
+ PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANON,
-1,
0);
- return p is (cast(void*) -1) ? null : p;
+ return p is MAP_FAILED ? null : p;
}
private bool unmapMemory(shared void* addr, const size_t len)
@@ -311,7 +313,7 @@ final class MmapPool : Allocator
* Returns: $(D_KEYWORD true) if successful, $(D_KEYWORD false) otherwise.
*/
bool reallocateInPlace(ref void[] p, const size_t size)
- pure shared nothrow @nogc
+ shared pure nothrow @nogc
{
if (p is null || size == 0)
{