1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 04:38:11 +00:00

Kernel: Implement getsockopt(SO_TYPE)

This is easy to implement, and is required by some applications like
python's ssl module.
This commit is contained in:
Rodrigo Tobar 2021-09-30 10:38:24 +08:00 committed by Andreas Kling
parent bc49ce72c1
commit d16131b100

View file

@ -187,6 +187,12 @@ KResult Socket::getsockopt(OpenFileDescription&, int level, int option, Userspac
TRY(copy_to_user(static_ptr_cast<int*>(value), &m_timestamp));
size = sizeof(int);
return copy_to_user(value_size, &size);
case SO_TYPE:
if (size < sizeof(int))
return EINVAL;
TRY(copy_to_user(static_ptr_cast<int*>(value), &m_type));
size = sizeof(int);
return copy_to_user(value_size, &size);
default:
dbgln("setsockopt({}) at SOL_SOCKET not implemented.", option);
return ENOPROTOOPT;