Received: from eggs.gnu.org ([208.118.235.92]:35177) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SsH3a-0007wg-LI for qemu-devel@nongnu.org; Fri, 20 Jul 2012 13:33:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SsH1p-0006tA-Aa for qemu-devel@nongnu.org; Fri, 20 Jul 2012 13:32:02 -0400 Received: from mail-gg0-f173.google.com ([209.85.161.173]:48695) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SsH1p-0006t6-66 for qemu-devel@nongnu.org; Fri, 20 Jul 2012 13:30:13 -0400 Received: by ggnp1 with SMTP id p1so4325852ggn.4 for ; Fri, 20 Jul 2012 10:30:12 -0700 (PDT) From: Jing Huang Date: Sat, 21 Jul 2012 01:30:54 +0000 Message-Id: <1342834254-2751-1-git-send-email-jing.huang.pku@gmail.com> In-Reply-To: References: Subject: [Qemu-devel] [PATCH V3 3/3] linux-user: make host_to_target_cmsg support SO_TIMESTAMP cmsg_type List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, riku.voipio@iki.fi, jing.huang.pku@gmail.com Signed-off-by: Jing Huang --- linux-user/syscall.c | 15 +++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 2228b1f..7521746 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -1350,8 +1350,17 @@ static inline abi_long host_to_target_cmsg(struct target_msghdr *target_msgh, target_cmsg->cmsg_len = tswapal(TARGET_CMSG_LEN(len)); if (cmsg->cmsg_level != TARGET_SOL_SOCKET || cmsg->cmsg_type != SCM_RIGHTS) { - gemu_log("Unsupported ancillary data: %d/%d\n", cmsg->cmsg_level, cmsg->cmsg_type); - memcpy(target_data, data, len); + if ((cmsg->cmsg_type == SO_TIMESTAMP) && + (len == sizeof(struct timeval))) { + /* copy struct timeval to target */ + struct timeval *tv = (struct timeval *)data; + struct timeval *target_tv = (struct timeval *)target_data; + + tv->tv_sec = tswap32(target_tv->tv_sec); + tv->tv_usec = tswap32(target_tv->tv_usec); + } else { + gemu_log("Unsupported ancillary data: %d/%d\n", + cmsg->cmsg_level, cmsg->cmsg_type); + memcpy(target_data, data, len); + } } else { int *fd = (int *)data; int *target_fd = (int *)target_data; -- 1.7.8.6