mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 16:17:36 +00:00
LibC: Add POSIX spec comments for memory management APIs
This commit is contained in:
parent
4484634d8a
commit
5568aee35f
1 changed files with 5 additions and 0 deletions
|
@ -24,6 +24,7 @@ void* serenity_mmap(void* addr, size_t size, int prot, int flags, int fd, off_t
|
||||||
return (void*)rc;
|
return (void*)rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/mmap.html
|
||||||
void* mmap(void* addr, size_t size, int prot, int flags, int fd, off_t offset)
|
void* mmap(void* addr, size_t size, int prot, int flags, int fd, off_t offset)
|
||||||
{
|
{
|
||||||
return serenity_mmap(addr, size, prot, flags, fd, offset, PAGE_SIZE, nullptr);
|
return serenity_mmap(addr, size, prot, flags, fd, offset, PAGE_SIZE, nullptr);
|
||||||
|
@ -45,12 +46,14 @@ void* mremap(void* old_address, size_t old_size, size_t new_size, int flags)
|
||||||
return (void*)rc;
|
return (void*)rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/munmap.html
|
||||||
int munmap(void* addr, size_t size)
|
int munmap(void* addr, size_t size)
|
||||||
{
|
{
|
||||||
int rc = syscall(SC_munmap, addr, size);
|
int rc = syscall(SC_munmap, addr, size);
|
||||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/mprotect.html
|
||||||
int mprotect(void* addr, size_t size, int prot)
|
int mprotect(void* addr, size_t size, int prot)
|
||||||
{
|
{
|
||||||
int rc = syscall(SC_mprotect, addr, size, prot);
|
int rc = syscall(SC_mprotect, addr, size, prot);
|
||||||
|
@ -84,12 +87,14 @@ void* allocate_tls(const char* initial_data, size_t size)
|
||||||
return (void*)rc;
|
return (void*)rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/mlock.html
|
||||||
int mlock(const void*, size_t)
|
int mlock(const void*, size_t)
|
||||||
{
|
{
|
||||||
dbgln("FIXME: Implement mlock()");
|
dbgln("FIXME: Implement mlock()");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/msync.html
|
||||||
int msync(void* address, size_t size, int flags)
|
int msync(void* address, size_t size, int flags)
|
||||||
{
|
{
|
||||||
int rc = syscall(SC_msync, address, size, flags);
|
int rc = syscall(SC_msync, address, size, flags);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue