mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-08 20:32:56 +03:00
Kernel/ProcFS: Tighten modified time value across the filesystem objects
It didn't make any sense to hardcode the modified time of all created inodes with "mepoch", so we should query the procfs "backend" to get the modified time value. Since ProcFS is dynamically changed all the time, the modified time equals to the querying time. This could be changed if desired, by making the modified_time() method virtual and overriding it in different procfs-backed objects :)
This commit is contained in:
parent
d79d9e833e
commit
1f98d7d638
Notes:
sideshowbarker
2024-07-18 11:16:20 +09:00
Author: https://github.com/supercomputer7 Commit: https://github.com/SerenityOS/serenity/commit/1f98d7d6387 Pull-request: https://github.com/SerenityOS/serenity/pull/7509 Reviewed-by: https://github.com/BertalanD Reviewed-by: https://github.com/awesomekling
@ -145,7 +145,7 @@ InodeMetadata ProcFSInode::metadata() const
|
||||
metadata.uid = m_associated_component->owner_user();
|
||||
metadata.gid = m_associated_component->owner_group();
|
||||
metadata.size = m_associated_component->size();
|
||||
metadata.mtime = mepoch;
|
||||
metadata.mtime = m_associated_component->modified_time();
|
||||
return metadata;
|
||||
}
|
||||
|
||||
@ -216,7 +216,7 @@ InodeMetadata ProcFSDirectoryInode::metadata() const
|
||||
metadata.uid = m_associated_component->owner_user();
|
||||
metadata.gid = m_associated_component->owner_group();
|
||||
metadata.size = 0;
|
||||
metadata.mtime = mepoch;
|
||||
metadata.mtime = m_associated_component->modified_time();
|
||||
return metadata;
|
||||
}
|
||||
KResult ProcFSDirectoryInode::traverse_as_directory(Function<bool(const FS::DirectoryEntryView&)> callback) const
|
||||
@ -258,7 +258,7 @@ InodeMetadata ProcFSLinkInode::metadata() const
|
||||
metadata.uid = m_associated_component->owner_user();
|
||||
metadata.gid = m_associated_component->owner_group();
|
||||
metadata.size = 0;
|
||||
metadata.mtime = mepoch;
|
||||
metadata.mtime = m_associated_component->modified_time();
|
||||
return metadata;
|
||||
}
|
||||
|
||||
|
@ -69,6 +69,7 @@ public:
|
||||
virtual mode_t required_mode() const { return 0444; }
|
||||
virtual uid_t owner_user() const { return 0; }
|
||||
virtual gid_t owner_group() const { return 0; }
|
||||
time_t modified_time() const { return TimeManagement::now().to_timeval().tv_sec; }
|
||||
|
||||
virtual void prepare_for_deletion() { }
|
||||
virtual KResult refresh_data(FileDescription&) const
|
||||
|
Loading…
Reference in New Issue
Block a user