mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 14:58:46 +00:00
Kernel: Memory-mapped files now have the absolute path as their name.
It's generated when the mapping is first created, so it won't update if the file moves. Maybe that's something we should support, too.
This commit is contained in:
parent
4320c5fd58
commit
5e1c7cb32c
Notes:
sideshowbarker
2024-07-19 13:47:51 +09:00
Author: https://github.com/awesomekling
Commit: 5e1c7cb32c
9 changed files with 10 additions and 17 deletions
|
@ -23,19 +23,12 @@ ssize_t InodeFile::write(FileDescriptor& descriptor, const byte* data, ssize_t c
|
|||
return m_inode->write_bytes(descriptor.offset(), count, data, &descriptor);
|
||||
}
|
||||
|
||||
KResultOr<Region*> InodeFile::mmap(Process& process, LinearAddress preferred_laddr, size_t offset, size_t size, int prot)
|
||||
KResultOr<Region*> InodeFile::mmap(Process& process, FileDescriptor& descriptor, LinearAddress preferred_laddr, size_t offset, size_t size, int prot)
|
||||
{
|
||||
ASSERT(offset == 0);
|
||||
// FIXME: If PROT_EXEC, check that the underlying file system isn't mounted noexec.
|
||||
String region_name;
|
||||
#if 0
|
||||
// FIXME: I would like to do this, but it would instantiate all the damn inodes.
|
||||
region_name = absolute_path();
|
||||
#else
|
||||
region_name = "Memory-mapped file";
|
||||
#endif
|
||||
InterruptDisabler disabler;
|
||||
auto* region = process.allocate_file_backed_region(preferred_laddr, size, inode(), move(region_name), prot);
|
||||
auto* region = process.allocate_file_backed_region(preferred_laddr, size, inode(), descriptor.absolute_path(), prot);
|
||||
if (!region)
|
||||
return KResult(-ENOMEM);
|
||||
return region;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue