mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 01:17:36 +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
|
@ -108,6 +108,7 @@ enum {
|
||||||
SO_TIMESTAMP,
|
SO_TIMESTAMP,
|
||||||
SO_BROADCAST,
|
SO_BROADCAST,
|
||||||
SO_LINGER,
|
SO_LINGER,
|
||||||
|
SO_ACCEPTCONN,
|
||||||
};
|
};
|
||||||
#define SO_RCVTIMEO SO_RCVTIMEO
|
#define SO_RCVTIMEO SO_RCVTIMEO
|
||||||
#define SO_SNDTIMEO SO_SNDTIMEO
|
#define SO_SNDTIMEO SO_SNDTIMEO
|
||||||
|
@ -123,6 +124,7 @@ enum {
|
||||||
#define SO_SNDBUF SO_SNDBUF
|
#define SO_SNDBUF SO_SNDBUF
|
||||||
#define SO_RCVBUF SO_RCVBUF
|
#define SO_RCVBUF SO_RCVBUF
|
||||||
#define SO_LINGER SO_LINGER
|
#define SO_LINGER SO_LINGER
|
||||||
|
#define SO_ACCEPTCONN SO_ACCEPTCONN
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
SCM_TIMESTAMP,
|
SCM_TIMESTAMP,
|
||||||
|
|
|
@ -208,6 +208,14 @@ ErrorOr<void> Socket::getsockopt(OpenFileDescription&, int level, int option, Us
|
||||||
TRY(memset_user(value.unsafe_userspace_ptr(), 0, sizeof(int)));
|
TRY(memset_user(value.unsafe_userspace_ptr(), 0, sizeof(int)));
|
||||||
size = sizeof(int);
|
size = sizeof(int);
|
||||||
return copy_to_user(value_size, &size);
|
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:
|
default:
|
||||||
dbgln("setsockopt({}) at SOL_SOCKET not implemented.", option);
|
dbgln("setsockopt({}) at SOL_SOCKET not implemented.", option);
|
||||||
return ENOPROTOOPT;
|
return ENOPROTOOPT;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue