mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
Kernel: Don't rewrite the whole file on sys$msync
This commit is contained in:
parent
259f78545a
commit
c7b90fa7d3
Notes:
sideshowbarker
2024-07-17 23:15:58 +09:00
Author: https://github.com/Hendiadyoin1
Commit: c7b90fa7d3
Pull-request: https://github.com/SerenityOS/serenity/pull/10957
Reviewed-by: https://github.com/Dexesttp
3 changed files with 10 additions and 4 deletions
|
@ -616,8 +616,12 @@ ErrorOr<FlatPtr> Process::sys$msync(Userspace<void*> address, size_t size, int f
|
|||
if (!vmobject.is_shared_inode())
|
||||
return 0;
|
||||
|
||||
off_t offset = region->offset_in_vmobject() + address.ptr() - region->range().base().get();
|
||||
|
||||
auto& inode_vmobject = static_cast<Memory::SharedInodeVMObject&>(vmobject);
|
||||
TRY(inode_vmobject.sync());
|
||||
// FIXME: Handle MS_ASYNC
|
||||
TRY(inode_vmobject.sync(offset / PAGE_SIZE, size / PAGE_SIZE));
|
||||
// FIXME: Handle MS_INVALIDATE
|
||||
// FIXME: If msync() causes any write to a file, the file's st_ctime and st_mtime fields shall be marked for update.
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue