mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-17 00:23:00 +00:00
Kernel+LibC+UserspaceEmulator: Add SO_TIMESTAMP, and cmsg definitions
When SO_TIMESTAMP is set as an option on a SOCK_DGRAM socket, then recvmsg() will return a SCM_TIMESTAMP control message that contains a struct timeval with the system time that was current when the socket was received.
This commit is contained in:
parent
ae5ba4074d
commit
47b3e98af8
Notes:
sideshowbarker
2024-07-19 02:21:45 +09:00
Author: https://github.com/nico
Commit: 47b3e98af8
Pull-request: https://github.com/SerenityOS/serenity/pull/3510
Reviewed-by: https://github.com/bugaevc
6 changed files with 94 additions and 2 deletions
|
@ -490,10 +490,10 @@ int Emulator::virt$setsockopt(FlatPtr params_addr)
|
|||
Syscall::SC_setsockopt_params params;
|
||||
mmu().copy_from_vm(¶ms, params_addr, sizeof(params));
|
||||
|
||||
if (params.option == SO_RCVTIMEO) {
|
||||
if (params.option == SO_RCVTIMEO || params.option == SO_TIMESTAMP) {
|
||||
auto host_value_buffer = ByteBuffer::create_zeroed(params.value_size);
|
||||
mmu().copy_from_vm(host_value_buffer.data(), (FlatPtr)params.value, params.value_size);
|
||||
int rc = setsockopt(params.sockfd, params.level, SO_RCVTIMEO, host_value_buffer.data(), host_value_buffer.size());
|
||||
int rc = setsockopt(params.sockfd, params.level, params.option, host_value_buffer.data(), host_value_buffer.size());
|
||||
if (rc < 0)
|
||||
return -errno;
|
||||
return rc;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue