diff --git a/libs/libc/include/sys/mman.h b/libs/libc/include/sys/mman.h index 3843a85d..e3d858cd 100644 --- a/libs/libc/include/sys/mman.h +++ b/libs/libc/include/sys/mman.h @@ -7,6 +7,8 @@ typedef unsigned long off_t; #define MAP_FAILED (void*)-1 +#define PROT_READ_WRITE 1 + #ifdef __cplusplus extern "C" { diff --git a/libs/libc/src/bits/bindings.c b/libs/libc/src/bits/bindings.c index 75b85898..a9932bd7 100644 --- a/libs/libc/src/bits/bindings.c +++ b/libs/libc/src/bits/bindings.c @@ -13,7 +13,7 @@ int liballoc_unlock() void* liballoc_alloc(size_t size) { - void* result = mmap(NULL, size * 4096, 0, 1, 0, 0); + void* result = mmap(NULL, size * 4096, PROT_READ_WRITE, 0, 0, 0); if (result == MAP_FAILED) return 0; return (void*)result; } diff --git a/libs/libc/src/sys/mman.cpp b/libs/libc/src/sys/mman.cpp index 7b2a747f..c0f68ff0 100644 --- a/libs/libc/src/sys/mman.cpp +++ b/libs/libc/src/sys/mman.cpp @@ -5,9 +5,9 @@ extern "C" { // FIXME: Implement a POSIX-compliant mmap. - void* mmap(void* addr, size_t len, int, int flags, int, off_t) + void* mmap(void* addr, size_t len, int prot, int, int, off_t) { - return (void*)syscall(SYS_mmap, addr, len, flags); + return (void*)syscall(SYS_mmap, addr, len, prot); } int munmap(void* addr, size_t len)