Avoid magic numbers
This commit is contained in:
parent
ce6ec3585c
commit
1235ce8b32
@ -7,6 +7,8 @@ typedef unsigned long off_t;
|
|||||||
|
|
||||||
#define MAP_FAILED (void*)-1
|
#define MAP_FAILED (void*)-1
|
||||||
|
|
||||||
|
#define PROT_READ_WRITE 1
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,7 @@ int liballoc_unlock()
|
|||||||
|
|
||||||
void* liballoc_alloc(size_t size)
|
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;
|
if (result == MAP_FAILED) return 0;
|
||||||
return (void*)result;
|
return (void*)result;
|
||||||
}
|
}
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
// FIXME: Implement a POSIX-compliant mmap.
|
// 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)
|
int munmap(void* addr, size_t len)
|
||||||
|
Loading…
Reference in New Issue
Block a user