diff --git a/headers/posix/sys/mman.h b/headers/posix/sys/mman.h index a69991ac05..40c49c7b5d 100644 --- a/headers/posix/sys/mman.h +++ b/headers/posix/sys/mman.h @@ -23,6 +23,7 @@ #define MAP_FIXED 0x04 /* require mapping to specified addr */ #define MAP_ANONYMOUS 0x08 /* no underlying object */ #define MAP_ANON MAP_ANONYMOUS +#define MAP_NORESERVE 0x10 /* don't commit memory */ /* mmap() error return code */ #define MAP_FAILED ((void*)-1) diff --git a/src/system/libroot/posix/sys/mman.cpp b/src/system/libroot/posix/sys/mman.cpp index 8de57a3dd7..3944538ef9 100644 --- a/src/system/libroot/posix/sys/mman.cpp +++ b/src/system/libroot/posix/sys/mman.cpp @@ -131,8 +131,9 @@ mmap(void* address, size_t length, int protection, int flags, int fd, areaProtection |= B_WRITE_AREA; if ((protection & PROT_EXEC) != 0) areaProtection |= B_EXECUTE_AREA; - if (protection == PROT_NONE) - areaProtection = B_OVERCOMMITTING_AREA; + + if ((flags & MAP_NORESERVE) != 0) + areaProtection |= B_OVERCOMMITTING_AREA; // create a name for this area based on calling image void* addr = __builtin_return_address(0);