From 7cbbe6a948f4c6b49f665981024645ae2d8de465 Mon Sep 17 00:00:00 2001 From: dchagin Date: Sat, 9 Jan 2016 18:04:10 +0000 Subject: MFC r283497: Convert SCM_TIMESTAMP in recvmsg(). --- sys/compat/linux/linux_socket.c | 16 ++++++++++++++++ sys/compat/linux/linux_socket.h | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'sys/compat') diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index 08a287b..ef3b2c1 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -483,6 +483,8 @@ bsd_to_linux_cmsg_type(int cmsg_type) return (LINUX_SCM_RIGHTS); case SCM_CREDS: return (LINUX_SCM_CREDENTIALS); + case SCM_TIMESTAMP: + return (LINUX_SCM_TIMESTAMP); } return (-1); } @@ -1221,6 +1223,8 @@ linux_recvmsg_common(struct thread *td, l_int s, struct l_msghdr *msghdr, struct iovec *iov, *uiov; struct mbuf *control = NULL; struct mbuf **controlp; + struct timeval *ftmvl; + l_timeval ltmvl; caddr_t outbuf; void *data; int error, i, fd, fds, *fdp; @@ -1331,6 +1335,18 @@ linux_recvmsg_common(struct thread *td, l_int s, struct l_msghdr *msghdr, data = &linux_ucred; datalen = sizeof(linux_ucred); break; + + case SCM_TIMESTAMP: + if (datalen != sizeof(struct timeval)) { + error = EMSGSIZE; + goto bad; + } + ftmvl = (struct timeval *)data; + ltmvl.tv_sec = ftmvl->tv_sec; + ltmvl.tv_usec = ftmvl->tv_usec; + data = <mvl; + datalen = sizeof(ltmvl); + break; } if (outlen + LINUX_CMSG_LEN(datalen) > diff --git a/sys/compat/linux/linux_socket.h b/sys/compat/linux/linux_socket.h index 9d13991..b32a969 100644 --- a/sys/compat/linux/linux_socket.h +++ b/sys/compat/linux/linux_socket.h @@ -54,7 +54,8 @@ /* Socket-level control message types */ #define LINUX_SCM_RIGHTS 0x01 -#define LINUX_SCM_CREDENTIALS 0x02 +#define LINUX_SCM_CREDENTIALS 0x02 +#define LINUX_SCM_TIMESTAMP 0x1D struct l_msghdr { l_uintptr_t msg_name; -- cgit v1.1