mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:57:35 +00:00
LibC: Add mmap_with_name() that names the allocation immediately.
This allows us to skip the separate call to set_mmap_name() in code that we control, e.g malloc() and GraphicsBitmap.
This commit is contained in:
parent
5f26f83451
commit
189b342e6f
8 changed files with 28 additions and 13 deletions
|
@ -7,7 +7,18 @@ extern "C" {
|
|||
|
||||
void* mmap(void* addr, size_t size, int prot, int flags, int fd, off_t offset)
|
||||
{
|
||||
Syscall::SC_mmap_params params { (dword)addr, size, prot, flags, fd, offset };
|
||||
Syscall::SC_mmap_params params { (dword)addr, size, prot, flags, fd, offset, nullptr };
|
||||
int rc = syscall(SC_mmap, ¶ms);
|
||||
if (rc < 0 && -rc < EMAXERRNO) {
|
||||
errno = -rc;
|
||||
return (void*)-1;
|
||||
}
|
||||
return (void*)rc;
|
||||
}
|
||||
|
||||
void* mmap_with_name(void* addr, size_t size, int prot, int flags, int fd, off_t offset, const char* name)
|
||||
{
|
||||
Syscall::SC_mmap_params params { (dword)addr, size, prot, flags, fd, offset, name };
|
||||
int rc = syscall(SC_mmap, ¶ms);
|
||||
if (rc < 0 && -rc < EMAXERRNO) {
|
||||
errno = -rc;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue