Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 May 2015 18:13:21 +0000 (UTC)
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r283497 - head/sys/compat/linux
Message-ID:  <201505241813.t4OIDL3M046800@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dchagin
Date: Sun May 24 18:13:21 2015
New Revision: 283497
URL: https://svnweb.freebsd.org/changeset/base/283497

Log:
  Convert SCM_TIMESTAMP in recvmsg().

Modified:
  head/sys/compat/linux/linux_socket.c
  head/sys/compat/linux/linux_socket.h

Modified: head/sys/compat/linux/linux_socket.c
==============================================================================
--- head/sys/compat/linux/linux_socket.c	Sun May 24 18:12:04 2015	(r283496)
+++ head/sys/compat/linux/linux_socket.c	Sun May 24 18:13:21 2015	(r283497)
@@ -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, 
 	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, 
 				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) >

Modified: head/sys/compat/linux/linux_socket.h
==============================================================================
--- head/sys/compat/linux/linux_socket.h	Sun May 24 18:12:04 2015	(r283496)
+++ head/sys/compat/linux/linux_socket.h	Sun May 24 18:13:21 2015	(r283497)
@@ -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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201505241813.t4OIDL3M046800>