mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-14 15:18:56 +00:00
Make platform-specific mmap flags the exception. (#1929)
MAP_POPULATE is a Linux mmap flag that optionally assists read-ahead on the mapping. It is nonstandard and omission does not affect the underlying mapping, so fall back to not including the flag, rather than the reverse.
This commit is contained in:
1 parent
21d39ef4f9
commit
7147ea0144
1 file changed
+3
-3
@@ -79,10 +79,10 @@ auto SourceBuffer::CreateFromFile(llvm::StringRef filename)
|
||||
|
||||
errno = 0;
|
||||
void* mapped_text = mmap(nullptr, size, PROT_READ,
|
||||
#ifdef __APPLE__
|
||||
MAP_PRIVATE,
|
||||
#else
|
||||
#if defined(__linux__)
|
||||
MAP_PRIVATE | MAP_POPULATE,
|
||||
#else
|
||||
MAP_PRIVATE,
|
||||
#endif
|
||||
file_descriptor, /*offset=*/0);
|
||||
// The `MAP_FAILED` macro may expand to a cast to pointer that `clang-tidy`
|
||||
|
||||
Reference in new issue
Block a user