mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-08 17:47:18 +00:00
Kernel: Implement the SO_ACCEPTCONN SOL_SOCKET-level option
This commit is contained in:
committed by
Andreas Kling
parent
a0e2fedc20
commit
641498954f
@@ -208,6 +208,14 @@ ErrorOr<void> Socket::getsockopt(OpenFileDescription&, int level, int option, Us
|
||||
TRY(memset_user(value.unsafe_userspace_ptr(), 0, sizeof(int)));
|
||||
size = sizeof(int);
|
||||
return copy_to_user(value_size, &size);
|
||||
case SO_ACCEPTCONN: {
|
||||
int accepting_connections = (m_role == Role::Listener) ? 1 : 0;
|
||||
if (size < sizeof(accepting_connections))
|
||||
return EINVAL;
|
||||
TRY(copy_to_user(static_ptr_cast<int*>(value), &accepting_connections));
|
||||
size = sizeof(accepting_connections);
|
||||
return copy_to_user(value_size, &size);
|
||||
}
|
||||
default:
|
||||
dbgln("setsockopt({}) at SOL_SOCKET not implemented.", option);
|
||||
return ENOPROTOOPT;
|
||||
|
||||
Reference in New Issue
Block a user