1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 20:15:07 +00:00

Kernel: Stub out the SO_DEBUG SOL_SOCKET-level option

This commit is contained in:
Idan Horowitz 2021-12-02 00:48:09 +02:00 committed by Andreas Kling
parent e521ffd156
commit a0e2fedc20
3 changed files with 14 additions and 0 deletions

View file

@ -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;