diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2021-12-02 00:48:09 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-12-05 12:53:29 +0100 |
commit | a0e2fedc20da72930e68f4304d829594269b04f9 (patch) | |
tree | e081c3639a57e01bc67e1e6384e9e4dc7af0955e | |
parent | e521ffd1566656c2d65a9db4be9a3827e64d276c (diff) | |
download | serenity-a0e2fedc20da72930e68f4304d829594269b04f9.zip |
Kernel: Stub out the SO_DEBUG SOL_SOCKET-level option
-rw-r--r-- | Kernel/API/POSIX/sys/socket.h | 2 | ||||
-rw-r--r-- | Kernel/Net/Socket.cpp | 10 | ||||
-rw-r--r-- | Meta/CMake/all_the_debug_macros.cmake | 2 |
3 files changed, 14 insertions, 0 deletions
diff --git a/Kernel/API/POSIX/sys/socket.h b/Kernel/API/POSIX/sys/socket.h index c7d22e008e..ce0efe8a58 100644 --- a/Kernel/API/POSIX/sys/socket.h +++ b/Kernel/API/POSIX/sys/socket.h @@ -101,6 +101,7 @@ enum { SO_PEERCRED, SO_RCVBUF, SO_SNDBUF, + SO_DEBUG, SO_REUSEADDR, SO_BINDTODEVICE, SO_KEEPALIVE, @@ -113,6 +114,7 @@ enum { #define SO_TYPE SO_TYPE #define SO_ERROR SO_ERROR #define SO_PEERCRED SO_PEERCRED +#define SO_DEBUG SO_DEBUG #define SO_REUSEADDR SO_REUSEADDR #define SO_BINDTODEVICE SO_BINDTODEVICE #define SO_KEEPALIVE SO_KEEPALIVE diff --git a/Kernel/Net/Socket.cpp b/Kernel/Net/Socket.cpp index 69c4c0dfd9..6b0f753ca1 100644 --- a/Kernel/Net/Socket.cpp +++ b/Kernel/Net/Socket.cpp @@ -103,6 +103,9 @@ ErrorOr<void> Socket::setsockopt(int level, int option, Userspace<const void*> u m_bound_interface = move(device); return {}; } + case SO_DEBUG: + // NOTE: This is supposed to toggle collection of debugging information on/off, we don't have any right now, so this is a no-op. + return {}; case SO_KEEPALIVE: // FIXME: Obviously, this is not a real keepalive. return {}; @@ -198,6 +201,13 @@ ErrorOr<void> Socket::getsockopt(OpenFileDescription&, int level, int option, Us TRY(copy_to_user(static_ptr_cast<int*>(value), &m_type)); size = sizeof(int); return copy_to_user(value_size, &size); + case SO_DEBUG: + // NOTE: This is supposed to toggle collection of debugging information on/off, we don't have any right now, so we just claim it's always off. + if (size < sizeof(int)) + return EINVAL; + TRY(memset_user(value.unsafe_userspace_ptr(), 0, sizeof(int))); + size = sizeof(int); + return copy_to_user(value_size, &size); default: dbgln("setsockopt({}) at SOL_SOCKET not implemented.", option); return ENOPROTOOPT; diff --git a/Meta/CMake/all_the_debug_macros.cmake b/Meta/CMake/all_the_debug_macros.cmake index 999d02e032..f26686ffec 100644 --- a/Meta/CMake/all_the_debug_macros.cmake +++ b/Meta/CMake/all_the_debug_macros.cmake @@ -231,3 +231,5 @@ set(WSSCREEN_DEBUG ON) # set(BOCHS_DEBUG_PORT) # False positive: IFF_DEBUG is an ioctl flag # set(IFF_DEBUG) +# False positive: SO_DEBUG is a socket option +# set(SO_DEBUG) |