mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-04 23:29:52 +00:00
UserspaceEmulator: Support the name argument in mmap for file backed mappings
This commit is contained in:
parent
d2262b8f6d
commit
28cda567c1
Notes:
sideshowbarker
2024-07-19 00:50:11 +09:00
Author: https://github.com/itamar8910
Commit: 28cda567c1
Pull-request: https://github.com/SerenityOS/serenity/pull/3738
Reviewed-by: https://github.com/ADKaster
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/awesomekling
3 changed files with 27 additions and 5 deletions
|
@ -39,11 +39,16 @@ NonnullOwnPtr<MmapRegion> MmapRegion::create_anonymous(u32 base, u32 size, u32 p
|
|||
return region;
|
||||
}
|
||||
|
||||
NonnullOwnPtr<MmapRegion> MmapRegion::create_file_backed(u32 base, u32 size, u32 prot, int flags, int fd, off_t offset)
|
||||
NonnullOwnPtr<MmapRegion> MmapRegion::create_file_backed(u32 base, u32 size, u32 prot, int flags, int fd, off_t offset, String name)
|
||||
{
|
||||
auto region = adopt_own(*new MmapRegion(base, size, prot));
|
||||
region->m_file_backed = true;
|
||||
region->m_data = (u8*)mmap(nullptr, size, prot, flags, fd, offset);
|
||||
if (!name.is_empty()) {
|
||||
dbgln("name is not empty");
|
||||
name = String::format("%s (Emulated)", name.characters());
|
||||
region->m_name = name;
|
||||
}
|
||||
region->m_data = (u8*)mmap_with_name(nullptr, size, prot, flags, fd, offset, name.is_empty() ? nullptr : name.characters());
|
||||
ASSERT(region->m_data != MAP_FAILED);
|
||||
return region;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue