From c3e57bfccbfab78b4fce94edc8f2ffb33da69d29 Mon Sep 17 00:00:00 2001 From: Hendiadyoin1 Date: Sat, 18 Jun 2022 19:08:18 +0200 Subject: Kernel: Try to set [cm]time in Inode::did_modify_contents This indirectly resolves a fixme in sys$msync --- Kernel/FileSystem/Inode.cpp | 6 ++++++ Kernel/Syscalls/mmap.cpp | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Kernel/FileSystem/Inode.cpp b/Kernel/FileSystem/Inode.cpp index 1f59a1d967..3721ccf777 100644 --- a/Kernel/FileSystem/Inode.cpp +++ b/Kernel/FileSystem/Inode.cpp @@ -232,6 +232,12 @@ void Inode::did_remove_child(InodeIdentifier, StringView name) void Inode::did_modify_contents() { + // FIXME: What happens if this fails? + // ENOTIMPL would be a meaningless error to return here + auto time = kgettimeofday().to_truncated_seconds(); + (void)set_mtime(time); + (void)set_ctime(time); + m_watchers.for_each([&](auto& watcher) { watcher->notify_inode_event({}, identifier(), InodeWatcherEvent::Type::ContentModified); }); diff --git a/Kernel/Syscalls/mmap.cpp b/Kernel/Syscalls/mmap.cpp index 8359709bc9..eb7f9b5490 100644 --- a/Kernel/Syscalls/mmap.cpp +++ b/Kernel/Syscalls/mmap.cpp @@ -600,7 +600,6 @@ ErrorOr Process::sys$msync(Userspace address, size_t size, int f // FIXME: Handle MS_ASYNC TRY(inode_vmobject.sync(offset / PAGE_SIZE, rounded_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; } -- cgit v1.2.3