diff --git a/repos/libports/src/lib/libc/file_operations.cc b/repos/libports/src/lib/libc/file_operations.cc index e892dab551..6e61039f91 100644 --- a/repos/libports/src/lib/libc/file_operations.cc +++ b/repos/libports/src/lib/libc/file_operations.cc @@ -413,9 +413,15 @@ __SYS_(void *, mmap, (void *addr, ::size_t length, int prot, int flags, int libc_fd, ::off_t offset), { - /* handle requests for anonymous memory */ - if (!addr && libc_fd == -1) { + if ((flags & MAP_ANONYMOUS) || (flags & MAP_ANON)) { + + if (flags & MAP_FIXED) { + Genode::error("mmap for fixed predefined address not supported yet"); + errno = EINVAL; + return MAP_FAILED; + } + bool const executable = prot & PROT_EXEC; void *start = mem_alloc(executable)->alloc(length, PAGE_SHIFT); if (!start) { diff --git a/repos/libports/src/lib/libc/vfs_plugin.cc b/repos/libports/src/lib/libc/vfs_plugin.cc index 02d193efbb..fef94b38bb 100644 --- a/repos/libports/src/lib/libc/vfs_plugin.cc +++ b/repos/libports/src/lib/libc/vfs_plugin.cc @@ -1640,8 +1640,8 @@ void *Libc::Vfs_plugin::mmap(void *addr_in, ::size_t length, int prot, int flags return (void *)-1; } - if (addr_in != 0) { - error("mmap for predefined address not supported"); + if (flags & MAP_FIXED) { + error("mmap for fixed predefined address not supported yet"); errno = EINVAL; return (void *)-1; }