Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Mar 2015 18:24:30 +0000 (UTC)
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r279818 - user/dchagin/lemul/sys/compat/linux
Message-ID:  <201503091824.t29IOUZw058544@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dchagin
Date: Mon Mar  9 18:24:29 2015
New Revision: 279818
URL: https://svnweb.freebsd.org/changeset/base/279818

Log:
  Convert SCM_TIMESTAMP in recvmsg().

Modified:
  user/dchagin/lemul/sys/compat/linux/linux_socket.c
  user/dchagin/lemul/sys/compat/linux/linux_socket.h

Modified: user/dchagin/lemul/sys/compat/linux/linux_socket.c
==============================================================================
--- user/dchagin/lemul/sys/compat/linux/linux_socket.c	Mon Mar  9 16:19:44 2015	(r279817)
+++ user/dchagin/lemul/sys/compat/linux/linux_socket.c	Mon Mar  9 18:24:29 2015	(r279818)
@@ -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);
 }
@@ -1216,6 +1218,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;
@@ -1326,6 +1330,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: user/dchagin/lemul/sys/compat/linux/linux_socket.h
==============================================================================
--- user/dchagin/lemul/sys/compat/linux/linux_socket.h	Mon Mar  9 16:19:44 2015	(r279817)
+++ user/dchagin/lemul/sys/compat/linux/linux_socket.h	Mon Mar  9 18:24:29 2015	(r279818)
@@ -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?201503091824.t29IOUZw058544>