summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorRodrigo Tobar <rtobarc@gmail.com>2021-09-30 10:38:24 +0800
committerAndreas Kling <kling@serenityos.org>2021-09-30 11:45:24 +0200
commitd16131b100aaf74e2d69207aea2c8a586bec6f1e (patch)
tree57d58b8b230a2dae39ba12535da529f4393cf7d2 /Kernel
parentbc49ce72c1d6cf9473ed270e43ab789909c46da2 (diff)
downloadserenity-d16131b100aaf74e2d69207aea2c8a586bec6f1e.zip
Kernel: Implement getsockopt(SO_TYPE)
This is easy to implement, and is required by some applications like python's ssl module.
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Net/Socket.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/Kernel/Net/Socket.cpp b/Kernel/Net/Socket.cpp
index 85c358f3a2..f8a7de1275 100644
--- a/Kernel/Net/Socket.cpp
+++ b/Kernel/Net/Socket.cpp
@@ -187,6 +187,12 @@ KResult Socket::getsockopt(OpenFileDescription&, int level, int option, Userspac
TRY(copy_to_user(static_ptr_cast<int*>(value), &m_timestamp));
size = sizeof(int);
return copy_to_user(value_size, &size);
+ case SO_TYPE:
+ if (size < sizeof(int))
+ return EINVAL;
+ TRY(copy_to_user(static_ptr_cast<int*>(value), &m_type));
+ size = sizeof(int);
+ return copy_to_user(value_size, &size);
default:
dbgln("setsockopt({}) at SOL_SOCKET not implemented.", option);
return ENOPROTOOPT;