Convert SCM_TIMESTAMP in recvmsg().

This commit is contained in:
dchagin 2015-05-24 18:13:21 +00:00
parent bff1d8cd6f
commit a71dbd5ba1
2 changed files with 18 additions and 1 deletions

View File

@ -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) >

View File

@ -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;