mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:58:12 +00:00
Kernel: Implement the SO_ACCEPTCONN SOL_SOCKET-level option
This commit is contained in:
parent
a0e2fedc20
commit
641498954f
2 changed files with 10 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue