diff --git a/Userland/Libraries/LibCore/Stream.cpp b/Userland/Libraries/LibCore/Stream.cpp index 303c0e5a8f..58d99e6349 100644 --- a/Userland/Libraries/LibCore/Stream.cpp +++ b/Userland/Libraries/LibCore/Stream.cpp @@ -6,6 +6,7 @@ */ #include "Stream.h" +#include #include #include #include @@ -535,4 +536,24 @@ ErrorOr> LocalSocket::connect(String const& path) return socket; } +ErrorOr LocalSocket::receive_fd(int flags) +{ +#ifdef __serenity__ + return Core::System::recvfd(m_helper.fd(), flags); +#else + (void)flags; + return Error::from_string_literal("File descriptor passing not supported on this platform"); +#endif +} + +ErrorOr LocalSocket::send_fd(int fd) +{ +#ifdef __serenity__ + return Core::System::sendfd(m_helper.fd(), fd); +#else + (void)fd; + return Error::from_string_literal("File descriptor passing not supported on this platform"); +#endif +} + } diff --git a/Userland/Libraries/LibCore/Stream.h b/Userland/Libraries/LibCore/Stream.h index d940760da6..7999eef53c 100644 --- a/Userland/Libraries/LibCore/Stream.h +++ b/Userland/Libraries/LibCore/Stream.h @@ -410,6 +410,9 @@ public: virtual ErrorOr set_blocking(bool enabled) override { return m_helper.set_blocking(enabled); } virtual ErrorOr set_close_on_exec(bool enabled) override { return m_helper.set_close_on_exec(enabled); } + ErrorOr receive_fd(int flags); + ErrorOr send_fd(int fd); + virtual ~LocalSocket() { close(); } private: