mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +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:
committed by
Andreas Kling
parent
ae5ba4074d
commit
47b3e98af8
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user