From f3ded36061ab50f34a3f890462a419079d0bf7e5 Mon Sep 17 00:00:00 2001 From: ston1th Date: Thu, 17 Oct 2019 22:25:51 +0200 Subject: [PATCH] Fixed mmap on OpenBSD OpenBSD's mmap does not support `MAP_HUGETLB` and `MAP_POPULATE`. --- src/virtual_memory.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/virtual_memory.cpp b/src/virtual_memory.cpp index 375ea146..fc46ae9b 100644 --- a/src/virtual_memory.cpp +++ b/src/virtual_memory.cpp @@ -141,6 +141,8 @@ void* allocLargePagesMemory(std::size_t bytes) { mem = mmap(nullptr, bytes, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, VM_FLAGS_SUPERPAGE_SIZE_2MB, 0); #elif defined(__FreeBSD__) mem = mmap(nullptr, bytes, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_ALIGNED_SUPER, -1, 0); +#elif defined(__OpenBSD__) + mem = MAP_FAILED; // OpenBSD does not support huge pages #else mem = mmap(nullptr, bytes, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB | MAP_POPULATE, -1, 0); #endif