Commit 54a20c00 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Prefer a C++ symbol over back-defining MAP_POPULATE

Summary: [Folly] Prefer a C++ symbol over back-defining `MAP_POPULATE`.

Reviewed By: nbronson

Differential Revision: D18024313

fbshipit-source-id: 7f3b754a7911d6947e5a6f34860f9f0d3833aa51
parent 979cdf43
...@@ -55,11 +55,19 @@ DEFINE_int64( ...@@ -55,11 +55,19 @@ DEFINE_int64(
"Maximum bytes to mlock/munlock/munmap at once " "Maximum bytes to mlock/munlock/munmap at once "
"(will be rounded up to PAGESIZE). Ignored if negative."); "(will be rounded up to PAGESIZE). Ignored if negative.");
#ifndef MAP_POPULATE namespace folly {
#define MAP_POPULATE 0
namespace {
enum mmap_flags : int {
#ifdef MAP_POPULATE
populate = MAP_POPULATE,
#else
populate = 0,
#endif #endif
};
namespace folly { } // namespace
MemoryMapping::MemoryMapping(MemoryMapping&& other) noexcept { MemoryMapping::MemoryMapping(MemoryMapping&& other) noexcept {
swap(other); swap(other);
...@@ -196,7 +204,7 @@ void MemoryMapping::init(off_t offset, off_t length) { ...@@ -196,7 +204,7 @@ void MemoryMapping::init(off_t offset, off_t length) {
flags |= MAP_ANONYMOUS; flags |= MAP_ANONYMOUS;
} }
if (options_.prefault) { if (options_.prefault) {
flags |= MAP_POPULATE; flags |= mmap_flags::populate;
} }
// The standard doesn't actually require PROT_NONE to be zero... // The standard doesn't actually require PROT_NONE to be zero...
......
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