1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:27:46 +00:00

AK+LibGfx+LibJS: Pass -1 as the file descriptor to anonymous mmap

Serenity/Linux/macOS ignore the file descriptor when an anonymous
mapping is requested. However, BSDs require the fd to be -1.
This commit is contained in:
Daniel Bertalan 2022-07-10 15:30:08 +02:00 committed by Andreas Kling
parent 4bed2ef66b
commit 42e22f89a4
3 changed files with 3 additions and 3 deletions

View file

@ -106,7 +106,7 @@ protected:
#ifdef __serenity__
new_chunk = serenity_mmap(nullptr, m_chunk_size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_RANDOMIZED | MAP_PRIVATE, 0, 0, m_chunk_size, "BumpAllocator Chunk");
#else
new_chunk = mmap(nullptr, m_chunk_size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
new_chunk = mmap(nullptr, m_chunk_size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
#endif
if (new_chunk == MAP_FAILED)
return false;