Переглянути джерело

Kernel: Implement getsockopt(SO_TYPE)

This is easy to implement, and is required by some applications like
python's ssl module.
Rodrigo Tobar 3 роки тому
батько
коміт
d16131b100
1 змінених файлів з 6 додано та 0 видалено
  1. 6 0
      Kernel/Net/Socket.cpp

+ 6 - 0
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;