Commit 84e863f6 authored by Wez Furlong's avatar Wez Furlong Committed by Facebook Github Bot 9

folly: fix AtomicUnorderedMap compilation on macOS

Summary:
MAP_POPULATE is not defined on this system.  Instead we will `madvise` the kernel
that we will need it so that it will populate the mapping.

Reviewed By: yfeldblum

Differential Revision: D3584325

fbshipit-source-id: ece52f3d55c475bcd41367f4e9744d6f41001cd5
parent 369761f0
......@@ -28,12 +28,20 @@ class MMapAlloc {
nullptr,
len,
PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE,
MAP_PRIVATE | MAP_ANONYMOUS
#ifdef MAP_POPULATE
|
MAP_POPULATE
#endif
,
-1,
0));
if (mem == reinterpret_cast<void*>(-1)) {
throw std::system_error(errno, std::system_category());
}
#if !defined(MAP_POPULATE) && defined(MADV_WILLNEED)
madvise(mem, size, MADV_WILLNEED);
#endif
return mem;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment