mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 19:45:10 +00:00
Kernel: Avoid creating a temporary String("mmap") for every mmap() call
This commit is contained in:
parent
804df54296
commit
bba24b09f7
1 changed files with 1 additions and 3 deletions
|
@ -208,13 +208,11 @@ void* Process::sys$mmap(const Syscall::SC_mmap_params* params)
|
|||
if ((u32)addr & ~PAGE_MASK)
|
||||
return (void*)-EINVAL;
|
||||
if (flags & MAP_ANONYMOUS) {
|
||||
auto* region = allocate_region(VirtualAddress((u32)addr), size, "mmap", prot, false);
|
||||
auto* region = allocate_region(VirtualAddress((u32)addr), size, name ? name : "mmap", prot, false);
|
||||
if (!region)
|
||||
return (void*)-ENOMEM;
|
||||
if (flags & MAP_SHARED)
|
||||
region->set_shared(true);
|
||||
if (name)
|
||||
region->set_name(name);
|
||||
return region->vaddr().as_ptr();
|
||||
}
|
||||
if (offset & ~PAGE_MASK)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue