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:
Nico Weber 2020-09-16 12:32:45 -04:00 committed by Andreas Kling
commit 47b3e98af8
Notes: sideshowbarker 2024-07-19 02:21:45 +09:00
6 changed files with 94 additions and 2 deletions

View file

@ -458,6 +458,7 @@ struct pollfd {
#define SHUT_RDWR 3
#define MSG_TRUNC 0x1
#define MSG_CTRUNC 0x2
#define MSG_DONTWAIT 0x40
#define SOL_SOCKET 1
@ -471,6 +472,11 @@ enum {
SO_REUSEADDR,
SO_BINDTODEVICE,
SO_KEEPALIVE,
SO_TIMESTAMP,
};
enum {
SCM_TIMESTAMP,
};
#define IPPROTO_IP 0
@ -556,6 +562,12 @@ struct iovec {
size_t iov_len;
};
struct cmsghdr {
socklen_t cmsg_len;
int cmsg_level;
int cmsg_type;
};
struct msghdr {
void* msg_name;
socklen_t msg_namelen;