diff options
author | Andreas Kling <kling@serenityos.org> | 2021-03-01 13:49:16 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-01 13:54:32 +0100 |
commit | ac71775de5a71945e004f46b184dde4f628d112b (patch) | |
tree | bac755ef16ba74bd63d3a359e6aad9e32d2734ae /Kernel/Syscalls/debug.cpp | |
parent | 9af1e1a3bf43140dee327eb4f553c56ba95ad9d9 (diff) | |
download | serenity-ac71775de5a71945e004f46b184dde4f628d112b.zip |
Kernel: Make all syscall functions return KResultOr<T>
This makes it a lot easier to return errors since we no longer have to
worry about negating EFOO errors and can just return them flat.
Diffstat (limited to 'Kernel/Syscalls/debug.cpp')
-rw-r--r-- | Kernel/Syscalls/debug.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Kernel/Syscalls/debug.cpp b/Kernel/Syscalls/debug.cpp index 2753b954e1..09d3d57830 100644 --- a/Kernel/Syscalls/debug.cpp +++ b/Kernel/Syscalls/debug.cpp @@ -31,26 +31,26 @@ namespace Kernel { -int Process::sys$dump_backtrace() +KResultOr<int> Process::sys$dump_backtrace() { dump_backtrace(); return 0; } -int Process::sys$dbgputch(u8 ch) +KResultOr<int> Process::sys$dbgputch(u8 ch) { IO::out8(0xe9, ch); return 0; } -int Process::sys$dbgputstr(Userspace<const u8*> characters, int length) +KResultOr<int> Process::sys$dbgputstr(Userspace<const u8*> characters, int length) { if (length <= 0) return 0; auto buffer = UserOrKernelBuffer::for_user_buffer(characters, length); if (!buffer.has_value()) - return -EFAULT; + return EFAULT; ssize_t nread = buffer.value().read_buffered<1024>(length, [&](const u8* buffer, size_t buffer_size) { for (size_t i = 0; i < buffer_size; ++i) IO::out8(0xe9, buffer[i]); |