diff --git a/Kernel/Net/LocalSocket.cpp b/Kernel/Net/LocalSocket.cpp index c7eb24dba1..d9453c5e1f 100644 --- a/Kernel/Net/LocalSocket.cpp +++ b/Kernel/Net/LocalSocket.cpp @@ -227,3 +227,9 @@ ssize_t LocalSocket::recvfrom(FileDescription& description, void* buffer, size_t } ASSERT_NOT_REACHED(); } + +StringView LocalSocket::socket_path() const +{ + int len = strnlen(m_address.sun_path, sizeof(m_address.sun_path)); + return { m_address.sun_path, len }; +} diff --git a/Kernel/Net/LocalSocket.h b/Kernel/Net/LocalSocket.h index b764a6a117..84c470173d 100644 --- a/Kernel/Net/LocalSocket.h +++ b/Kernel/Net/LocalSocket.h @@ -10,6 +10,8 @@ public: static NonnullRefPtr create(int type); virtual ~LocalSocket() override; + + StringView socket_path() const; // ^Socket virtual KResult bind(const sockaddr*, socklen_t) override; virtual KResult connect(FileDescription&, const sockaddr*, socklen_t, ShouldBlock = ShouldBlock::Yes) override;