summaryrefslogtreecommitdiff
path: root/Kernel/Net/Socket.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-08-04 18:02:23 +0200
committerAndreas Kling <kling@serenityos.org>2020-08-04 18:17:16 +0200
commit7a3ab6c517649e9dfdd50085f10492212b0bcb18 (patch)
treef251cfc69ebe5f253c1e900c10b9485136b315cd /Kernel/Net/Socket.cpp
parent58feebeed28bab04e7b462f7cd3beb81984f116e (diff)
downloadserenity-7a3ab6c517649e9dfdd50085f10492212b0bcb18.zip
Kernel: Make File::write() and File::read() return KResultOr<size_t>
Instead of returning a ssize_t where negative values mean error, we now return KResultOr<size_t> and use the error state to report errors exclusively.
Diffstat (limited to 'Kernel/Net/Socket.cpp')
-rw-r--r--Kernel/Net/Socket.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Kernel/Net/Socket.cpp b/Kernel/Net/Socket.cpp
index 22c2022fb9..7cb4f6cdab 100644
--- a/Kernel/Net/Socket.cpp
+++ b/Kernel/Net/Socket.cpp
@@ -178,14 +178,14 @@ KResult Socket::getsockopt(FileDescription&, int level, int option, void* value,
}
}
-ssize_t Socket::read(FileDescription& description, size_t, u8* buffer, ssize_t size)
+KResultOr<size_t> Socket::read(FileDescription& description, size_t, u8* buffer, size_t size)
{
if (is_shut_down_for_reading())
return 0;
return recvfrom(description, buffer, size, 0, nullptr, 0);
}
-ssize_t Socket::write(FileDescription& description, size_t, const u8* data, ssize_t size)
+KResultOr<size_t> Socket::write(FileDescription& description, size_t, const u8* data, size_t size)
{
if (is_shut_down_for_writing())
return -EPIPE;