1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:38:11 +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

@ -558,7 +558,7 @@ ErrorOr<BackingStore> Bitmap::allocate_backing_store(BitmapFormat format, IntSiz
map_flags |= MAP_PURGEABLE;
void* data = mmap_with_name(nullptr, data_size_in_bytes, PROT_READ | PROT_WRITE, map_flags, 0, 0, String::formatted("GraphicsBitmap [{}]", size).characters());
#else
void* data = mmap(nullptr, data_size_in_bytes, PROT_READ | PROT_WRITE, map_flags, 0, 0);
void* data = mmap(nullptr, data_size_in_bytes, PROT_READ | PROT_WRITE, map_flags, -1, 0);
#endif
if (data == MAP_FAILED)
return Error::from_errno(errno);