[PATCH] D96626: Support: mapped_file_region: Pass MAP_NORESERVE to mmap
Joseph Tremoulet via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 12 12:18:34 PST 2021
JosephTremoulet created this revision.
Herald added subscribers: dexonsmith, hiraditya, krytarowski, arichardson, emaste.
JosephTremoulet requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This allows mapping larger files, delaying OOM failures until too many
pages of them are accessed. This is makes the behavior of the
mapped_file_region in this regard consistent between its "Unix" and
"Windows" implementations.
Guard the code witih #if defined(MAP_NORESERVE), consistent with other
uses of MAP_NORESERVE in llvm-project, because some FreeBSD versions do
not provide this flag.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D96626
Files:
llvm/lib/Support/Unix/Path.inc
Index: llvm/lib/Support/Unix/Path.inc
===================================================================
--- llvm/lib/Support/Unix/Path.inc
+++ llvm/lib/Support/Unix/Path.inc
@@ -815,6 +815,9 @@
int flags = (Mode == readwrite) ? MAP_SHARED : MAP_PRIVATE;
int prot = (Mode == readonly) ? PROT_READ : (PROT_READ | PROT_WRITE);
+#if defined(MAP_NORESERVE)
+ flags |= MAP_NORESERVE;
+#endif
#if defined(__APPLE__)
//----------------------------------------------------------------------
// Newer versions of MacOSX have a flag that will allow us to read from
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96626.323442.patch
Type: text/x-patch
Size: 572 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210212/ca9cae0b/attachment.bin>
More information about the llvm-commits
mailing list