All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH V6 3/3] linux-user: make host_to_target_cmsg support SO_TIMESTAMP cmsg_type
@ 2012-07-25  0:01 Jing Huang
  2012-07-25  9:37 ` Peter Maydell
  0 siblings, 1 reply; 2+ messages in thread
From: Jing Huang @ 2012-07-25  0:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, riku.voipio


Signed-off-by: Jing Huang <jing.huang.pku@gmail.com>
---
 linux-user/syscall.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 362e478..356801a 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -1347,16 +1347,28 @@ static inline abi_long host_to_target_cmsg(struct target_msghdr *target_msgh,
         target_cmsg->cmsg_type = tswap32(cmsg->cmsg_type);
         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);
-        } else {
+        if ((cmsg->cmsg_level == TARGET_SOL_SOCKET) &&
+                                (cmsg->cmsg_type == SCM_RIGHTS)) {
             int *fd = (int *)data;
             int *target_fd = (int *)target_data;
             int i, numfds = len / sizeof(int);
 
             for (i = 0; i < numfds; i++)
                 target_fd[i] = tswap32(fd[i]);
+        } else if ((cmsg->cmsg_level == TARGET_SOL_SOCKET) &&
+                                (cmsg->cmsg_type == SO_TIMESTAMP) &&
+                                (len == sizeof(struct timeval))) {
+            /* copy struct timeval to target */
+            struct timeval *tv = (struct timeval *)data;
+            struct target_timeval *target_tv =
+                                        (struct target_timeval *)target_data;
+
+            target_tv->tv_sec = tswapal(tv->tv_sec);
+            target_tv->tv_usec = tswapal(tv->tv_usec);
+        } else {
+            gemu_log("Unsupported ancillary data: %d/%d\n",
+                                        cmsg->cmsg_level, cmsg->cmsg_type);
+            memcpy(target_data, data, len);
         }
 
         cmsg = CMSG_NXTHDR(msgh, cmsg);
-- 
1.7.8.6

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH V6 3/3] linux-user: make host_to_target_cmsg support SO_TIMESTAMP cmsg_type
  2012-07-25  0:01 [Qemu-devel] [PATCH V6 3/3] linux-user: make host_to_target_cmsg support SO_TIMESTAMP cmsg_type Jing Huang
@ 2012-07-25  9:37 ` Peter Maydell
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2012-07-25  9:37 UTC (permalink / raw)
  To: Jing Huang; +Cc: riku.voipio, qemu-devel

On 25 July 2012 01:01, Jing Huang <jing.huang.pku@gmail.com> wrote:
>
> Signed-off-by: Jing Huang <jing.huang.pku@gmail.com>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

-- PMM

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-25  9:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-25  0:01 [Qemu-devel] [PATCH V6 3/3] linux-user: make host_to_target_cmsg support SO_TIMESTAMP cmsg_type Jing Huang
2012-07-25  9:37 ` Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.