Luna/libs/libc/src/bits/bindings.c

24 lines
405 B
C

#include <stddef.h>
#include <sys/mman.h>
int liballoc_lock()
{
return 0;
}
int liballoc_unlock()
{
return 0;
}
void* liballoc_alloc(size_t size)
{
void* result = mmap(NULL, size * PAGE_SIZE, PROT_READ | PROT_WRITE, 0, 0, 0);
if (result == MAP_FAILED) return 0;
return (void*)result;
}
int liballoc_free(void* address, size_t size)
{
return munmap(address, size * PAGE_SIZE);
}