ladybird/LibC/mman.cpp
Andreas Kling 1d5afbdffc Add sys$set_mmap_name and use it from LibC's malloc.
It's nice to be able to identify mmap's in /proc/PID/vm.
2018-10-28 09:57:22 +01:00

26 lines
600 B
C++

#include "mman.h"
#include "errno.h"
#include <Kernel/Syscall.h>
extern "C" {
void* mmap(void* addr, size_t size)
{
int rc = Syscall::invoke(Syscall::PosixMmap, (dword)addr, (dword)size);
__RETURN_WITH_ERRNO(rc, (void*)rc, (void*)-1);
}
int munmap(void* addr, size_t size)
{
int rc = Syscall::invoke(Syscall::PosixMunmap, (dword)addr, (dword)size);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
int set_mmap_name(void* addr, size_t size, const char* name)
{
int rc = Syscall::invoke(Syscall::SetMmapName, (dword)addr, (dword)size, (dword)name);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
}