summaryrefslogtreecommitdiff
path: root/Kernel/Net/Socket.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel/Net/Socket.cpp')
-rw-r--r--Kernel/Net/Socket.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/Kernel/Net/Socket.cpp b/Kernel/Net/Socket.cpp
index 7fef7bde1d..c01295d7a6 100644
--- a/Kernel/Net/Socket.cpp
+++ b/Kernel/Net/Socket.cpp
@@ -1,3 +1,4 @@
+#include <Kernel/FileSystem/FileDescriptor.h>
#include <Kernel/Net/Socket.h>
#include <Kernel/Net/LocalSocket.h>
#include <Kernel/Net/IPv4Socket.h>
@@ -119,3 +120,22 @@ void Socket::load_send_deadline()
m_send_deadline.tv_sec += (m_send_timeout.tv_usec / 1000000) * 1;
m_send_deadline.tv_usec %= 1000000;
}
+
+static const char* to_string(SocketRole role)
+{
+ switch (role) {
+ case SocketRole::Listener:
+ return "Listener";
+ case SocketRole::Accepted:
+ return "Accepted";
+ case SocketRole::Connected:
+ return "Connected";
+ default:
+ return "None";
+ }
+}
+
+String Socket::absolute_path(FileDescriptor& descriptor) const
+{
+ return String::format("socket:%x (role: %s)", this, to_string(descriptor.socket_role()));
+}