summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem/ProcFS.cpp
diff options
context:
space:
mode:
authorSeekingBlues <seekingblues@gmail.com>2021-10-16 17:35:59 -0400
committerAndreas Kling <kling@serenityos.org>2021-10-17 14:46:59 +0200
commit3d174e3ad204c4d32459ceb8717b855435a32311 (patch)
tree95d6505591f18c579b30eede2d3670b83807943f /Kernel/FileSystem/ProcFS.cpp
parentf8e89306e06e7d65c95f3d47193e4b174b4326af (diff)
downloadserenity-3d174e3ad204c4d32459ceb8717b855435a32311.zip
Kernel/ProcFS: Provide a way to write to ProcFS inodes
ProcFSGlobalInode now calls `write_bytes()`, `truncate()` and `set_mtime()` on its associated component. This allows us to write 0 or 1 to a ProcFSSystemBoolean component to toggle a boolean value.
Diffstat (limited to 'Kernel/FileSystem/ProcFS.cpp')
-rw-r--r--Kernel/FileSystem/ProcFS.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp
index e6a034e8a6..fd88f671a4 100644
--- a/Kernel/FileSystem/ProcFS.cpp
+++ b/Kernel/FileSystem/ProcFS.cpp
@@ -99,11 +99,6 @@ KResult ProcFSInode::chown(UserID, GroupID)
return EPERM;
}
-KResult ProcFSInode::truncate(u64)
-{
- return EPERM;
-}
-
KResultOr<NonnullRefPtr<ProcFSGlobalInode>> ProcFSGlobalInode::try_create(const ProcFS& fs, const ProcFSExposedComponent& component)
{
return adopt_nonnull_ref_or_enomem(new (nothrow) ProcFSGlobalInode(fs, component));
@@ -151,6 +146,16 @@ KResultOr<NonnullRefPtr<Inode>> ProcFSGlobalInode::lookup(StringView)
VERIFY_NOT_REACHED();
}
+KResult ProcFSGlobalInode::truncate(u64 size)
+{
+ return m_associated_component->truncate(size);
+}
+
+KResult ProcFSGlobalInode::set_mtime(time_t time)
+{
+ return m_associated_component->set_mtime(time);
+}
+
InodeMetadata ProcFSGlobalInode::metadata() const
{
MutexLocker locker(m_inode_lock);