mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
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
0533f9d3ae
commit
c47e6e9e06
@ -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
Block a user