summaryrefslogtreecommitdiff
path: root/Kernel/ProcFS.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-02-25 20:47:56 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-02-25 20:50:22 +0100
commit5af4e622b94a194e3feaea1b3b09229d7a93578b (patch)
tree1d814ef3b92989e464e4409dfabfed9324c00773 /Kernel/ProcFS.cpp
parent901b7d5d91b3eacda12dad01211b84a28e1a39a6 (diff)
downloadserenity-5af4e622b94a194e3feaea1b3b09229d7a93578b.zip
Kernel: Add KResult and KResultOr<T> classes.
The idea here is to combine a potential syscall error code with an arbitrary type in the case of success. I feel like this will end up much less error prone than returning some arbitrary type that kinda sorta has bool semantics (but sometimes not really) and passing the error through an out-param. This patch only converts a few syscalls to using it. More to come.
Diffstat (limited to 'Kernel/ProcFS.cpp')
-rw-r--r--Kernel/ProcFS.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/Kernel/ProcFS.cpp b/Kernel/ProcFS.cpp
index 680c46b187..0b26b30102 100644
--- a/Kernel/ProcFS.cpp
+++ b/Kernel/ProcFS.cpp
@@ -1049,12 +1049,16 @@ ssize_t ProcFSInode::write_bytes(off_t offset, size_t size, const byte* buffer,
bool ProcFSInode::add_child(InodeIdentifier child_id, const String& name, byte file_type, int& error)
{
+ (void)child_id;
+ (void)name;
+ (void)file_type;
error = -EPERM;
return false;
}
bool ProcFSInode::remove_child(const String& name, int& error)
{
+ (void)name;
error = -EPERM;
return false;
}
@@ -1074,10 +1078,9 @@ size_t ProcFSInode::directory_entry_count() const
return count;
}
-bool ProcFSInode::chmod(mode_t, int& error)
+KResult ProcFSInode::chmod(mode_t)
{
- error = -EPERM;
- return false;
+ return KResult(-EPERM);
}
ProcFS::ProcFS()