Userland+Tests: Don't use MAP_FILE when mmap-ing

MAP_FILE is not in POSIX, and is simply in most LibCs as a "default"
mode. Our own LibC defines it as 0, meaning "no flags". It is also not
defined in some OS's, such as Haiku. Let's be more portable and not use
the unnecessary flag.
This commit is contained in:
Andrew Kaster 2023-09-01 09:53:12 +02:00 committed by Jelle Raaijmakers
commit 1cd3826ad6
Notes: sideshowbarker 2024-07-16 21:39:23 +09:00
9 changed files with 9 additions and 9 deletions

View file

@ -21,7 +21,7 @@ ErrorOr<AnonymousBuffer> AnonymousBuffer::create_with_size(size_t size)
ErrorOr<NonnullRefPtr<AnonymousBufferImpl>> AnonymousBufferImpl::create(int fd, size_t size)
{
auto* data = mmap(nullptr, round_up_to_power_of_two(size, PAGE_SIZE), PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED, fd, 0);
auto* data = mmap(nullptr, round_up_to_power_of_two(size, PAGE_SIZE), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (data == MAP_FAILED)
return Error::from_errno(errno);
return AK::adopt_nonnull_ref_or_enomem(new (nothrow) AnonymousBufferImpl(fd, size, data));