1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 17:38:12 +00:00

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.
This commit is contained in:
Andreas Kling 2019-02-25 20:47:56 +01:00
parent 901b7d5d91
commit 5af4e622b9
12 changed files with 162 additions and 118 deletions

View file

@ -311,8 +311,7 @@ size_t SynthFSInode::directory_entry_count() const
return m_children.size() + 2;
}
bool SynthFSInode::chmod(mode_t, int& error)
KResult SynthFSInode::chmod(mode_t)
{
error = -EPERM;
return false;
return KResult(-EPERM);
}