forked from OSchip/llvm-project
Support: mapped_file_region: Pass MAP_NORESERVE to mmap
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. Reviewed By: clayborg Differential Revision: https://reviews.llvm.org/D96626
This commit is contained in:
parent
3344cd3a14
commit
b785e03612
|
@ -815,6 +815,9 @@ std::error_code mapped_file_region::init(int FD, uint64_t Offset,
|
|||
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue