Avoid magic numbers

This commit is contained in:
apio 2022-10-08 14:44:48 +02:00
parent ce6ec3585c
commit 1235ce8b32
3 changed files with 5 additions and 3 deletions

View File

@ -7,6 +7,8 @@ typedef unsigned long off_t;
#define MAP_FAILED (void*)-1
#define PROT_READ_WRITE 1
#ifdef __cplusplus
extern "C"
{

View File

@ -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;
}

View File

@ -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)