summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls/read.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-11-08 00:51:39 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-08 01:10:53 +0100
commit79fa9765ca89869d19364143989436d117974c21 (patch)
tree3af62f70127d9217d841047f6b7461351800d1ae /Kernel/Syscalls/read.cpp
parent7ee10c69264cb278845a1e1b06d5acf2e5e7ddf0 (diff)
downloadserenity-79fa9765ca89869d19364143989436d117974c21.zip
Kernel: Replace KResult and KResultOr<T> with Error and ErrorOr<T>
We now use AK::Error and AK::ErrorOr<T> in both kernel and userspace! This was a slightly tedious refactoring that took a long time, so it's not unlikely that some bugs crept in. Nevertheless, it does pass basic functionality testing, and it's just real nice to finally see the same pattern in all contexts. :^)
Diffstat (limited to 'Kernel/Syscalls/read.cpp')
-rw-r--r--Kernel/Syscalls/read.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/Kernel/Syscalls/read.cpp b/Kernel/Syscalls/read.cpp
index 444c3daa02..c3e8700aa7 100644
--- a/Kernel/Syscalls/read.cpp
+++ b/Kernel/Syscalls/read.cpp
@@ -12,7 +12,7 @@ namespace Kernel {
using BlockFlags = Thread::FileBlocker::BlockFlags;
-static KResultOr<OpenFileDescription*> open_readable_file_description(Process::OpenFileDescriptions const& fds, int fd)
+static ErrorOr<OpenFileDescription*> open_readable_file_description(Process::OpenFileDescriptions const& fds, int fd)
{
auto description = TRY(fds.open_file_description(fd));
if (!description->is_readable())
@@ -22,7 +22,7 @@ static KResultOr<OpenFileDescription*> open_readable_file_description(Process::O
return description;
}
-static KResult check_blocked_read(OpenFileDescription* description)
+static ErrorOr<void> check_blocked_read(OpenFileDescription* description)
{
if (description->is_blocking()) {
if (!description->can_read()) {
@@ -34,10 +34,10 @@ static KResult check_blocked_read(OpenFileDescription* description)
// TODO: handle exceptions in unblock_flags
}
}
- return KSuccess;
+ return {};
}
-KResultOr<FlatPtr> Process::sys$readv(int fd, Userspace<const struct iovec*> iov, int iov_count)
+ErrorOr<FlatPtr> Process::sys$readv(int fd, Userspace<const struct iovec*> iov, int iov_count)
{
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
REQUIRE_PROMISE(stdio);
@@ -74,7 +74,7 @@ KResultOr<FlatPtr> Process::sys$readv(int fd, Userspace<const struct iovec*> iov
return nread;
}
-KResultOr<FlatPtr> Process::sys$read(int fd, Userspace<u8*> buffer, size_t size)
+ErrorOr<FlatPtr> Process::sys$read(int fd, Userspace<u8*> buffer, size_t size)
{
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
REQUIRE_PROMISE(stdio);
@@ -91,7 +91,7 @@ KResultOr<FlatPtr> Process::sys$read(int fd, Userspace<u8*> buffer, size_t size)
return TRY(description->read(user_buffer.value(), size));
}
-KResultOr<FlatPtr> Process::sys$pread(int fd, Userspace<u8*> buffer, size_t size, off_t offset)
+ErrorOr<FlatPtr> Process::sys$pread(int fd, Userspace<u8*> buffer, size_t size, off_t offset)
{
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
REQUIRE_PROMISE(stdio);