1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 04:58:13 +00:00

Kernel+LibC: Add a very limited sys$mremap() implementation

This syscall can currently only remap a shared file-backed mapping into
a private file-backed mapping.
This commit is contained in:
Andreas Kling 2020-12-29 02:11:47 +01:00
parent c1360ef22e
commit 30dbe9c78a
6 changed files with 71 additions and 1 deletions

View file

@ -53,6 +53,17 @@ void* mmap_with_name(void* addr, size_t size, int prot, int flags, int fd, off_t
return serenity_mmap(addr, size, prot, flags, fd, offset, PAGE_SIZE, name);
}
void* mremap(void* old_address, size_t old_size, size_t new_size, int flags)
{
Syscall::SC_mremap_params params { (uintptr_t)old_address, old_size, new_size, flags };
ssize_t rc = syscall(SC_mremap, &params);
if (rc < 0 && -rc < EMAXERRNO) {
errno = -rc;
return MAP_FAILED;
}
return (void*)rc;
}
int munmap(void* addr, size_t size)
{
int rc = syscall(SC_munmap, addr, size);