summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
authordchagin <dchagin@FreeBSD.org>2016-01-09 18:04:10 +0000
committerdchagin <dchagin@FreeBSD.org>2016-01-09 18:04:10 +0000
commit7cbbe6a948f4c6b49f665981024645ae2d8de465 (patch)
tree73c23dd8c091d0f304f44feeb9fa118b90bd4d5f /sys/compat
parentb7998c86633f09c39691f8220d67f9b9147d68f0 (diff)
downloadFreeBSD-src-7cbbe6a948f4c6b49f665981024645ae2d8de465.zip
FreeBSD-src-7cbbe6a948f4c6b49f665981024645ae2d8de465.tar.gz
MFC r283497:
Convert SCM_TIMESTAMP in recvmsg().
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/linux/linux_socket.c16
-rw-r--r--sys/compat/linux/linux_socket.h3
2 files changed, 18 insertions, 1 deletions
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 = &ltmvl;
+ 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;
OpenPOWER on IntegriCloud