diff options
author | Andreas Kling <kling@serenityos.org> | 2020-08-04 18:02:23 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-04 18:17:16 +0200 |
commit | 7a3ab6c517649e9dfdd50085f10492212b0bcb18 (patch) | |
tree | f251cfc69ebe5f253c1e900c10b9485136b315cd /Kernel/Net/IPv4Socket.h | |
parent | 58feebeed28bab04e7b462f7cd3beb81984f116e (diff) | |
download | serenity-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/IPv4Socket.h')
-rw-r--r-- | Kernel/Net/IPv4Socket.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Kernel/Net/IPv4Socket.h b/Kernel/Net/IPv4Socket.h index 7ed9e814d4..392958311f 100644 --- a/Kernel/Net/IPv4Socket.h +++ b/Kernel/Net/IPv4Socket.h @@ -58,8 +58,8 @@ public: virtual void detach(FileDescription&) override; virtual bool can_read(const FileDescription&, size_t) const override; virtual bool can_write(const FileDescription&, size_t) const override; - virtual ssize_t sendto(FileDescription&, const void*, size_t, int, const sockaddr*, socklen_t) override; - virtual ssize_t recvfrom(FileDescription&, void*, size_t, int flags, sockaddr*, socklen_t*) override; + virtual KResultOr<size_t> sendto(FileDescription&, const void*, size_t, int, const sockaddr*, socklen_t) override; + virtual KResultOr<size_t> recvfrom(FileDescription&, void*, size_t, int flags, sockaddr*, socklen_t*) override; virtual KResult setsockopt(int level, int option, const void*, socklen_t) override; virtual KResult getsockopt(FileDescription&, int level, int option, void*, socklen_t*) override; @@ -96,8 +96,8 @@ protected: virtual KResult protocol_bind() { return KSuccess; } virtual KResult protocol_listen() { return KSuccess; } - virtual int protocol_receive(const KBuffer&, void*, size_t, int) { return -ENOTIMPL; } - virtual int protocol_send(const void*, size_t) { return -ENOTIMPL; } + virtual KResultOr<size_t> protocol_receive(const KBuffer&, void*, size_t, int) { return -ENOTIMPL; } + virtual KResultOr<size_t> protocol_send(const void*, size_t) { return -ENOTIMPL; } virtual KResult protocol_connect(FileDescription&, ShouldBlock) { return KSuccess; } virtual int protocol_allocate_local_port() { return 0; } virtual bool protocol_is_disconnected() const { return false; } @@ -110,8 +110,8 @@ protected: private: virtual bool is_ipv4() const override { return true; } - ssize_t receive_byte_buffered(FileDescription&, void* buffer, size_t buffer_length, int flags, sockaddr*, socklen_t*); - ssize_t receive_packet_buffered(FileDescription&, void* buffer, size_t buffer_length, int flags, sockaddr*, socklen_t*); + KResultOr<size_t> receive_byte_buffered(FileDescription&, void* buffer, size_t buffer_length, int flags, sockaddr*, socklen_t*); + KResultOr<size_t> receive_packet_buffered(FileDescription&, void* buffer, size_t buffer_length, int flags, sockaddr*, socklen_t*); IPv4Address m_local_address; IPv4Address m_peer_address; |