qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: qemu-devel@nongnu.org
Cc: Riku Voipio <riku.voipio@iki.fi>, Laurent Vivier <laurent@vivier.eu>
Subject: [Qemu-devel] [PATCH] linux-user: correct setsockopt() SO_SNDTIMEO and SO_RCVTIMEO take a struct timeval, not an int
Date: Mon, 31 Dec 2012 20:53:30 +0100	[thread overview]
Message-ID: <1356983610-14793-1-git-send-email-laurent@vivier.eu> (raw)

From: Laurent Vivier <Laurent@Vivier.EU>

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 linux-user/syscall.c |   26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index e99adab..1530c8f 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -1491,6 +1491,25 @@ static abi_long do_setsockopt(int sockfd, int level, int optname,
         break;
     case TARGET_SOL_SOCKET:
         switch (optname) {
+        case TARGET_SO_RCVTIMEO: {
+                struct timeval tv;
+
+		optname = SO_RCVTIMEO;
+
+set_timeout:
+                if (optlen != sizeof(struct target_timeval))
+                    return -TARGET_EINVAL;
+
+                if (copy_from_user_timeval(&tv, optval_addr))
+                    return -TARGET_EFAULT;
+
+		ret = get_errno(setsockopt(sockfd, SOL_SOCKET, optname,
+                                &tv, sizeof(tv)));
+		return ret;
+        }
+        case TARGET_SO_SNDTIMEO:
+		optname = SO_SNDTIMEO;
+		goto set_timeout;
             /* Options with 'int' argument.  */
         case TARGET_SO_DEBUG:
 		optname = SO_DEBUG;
@@ -1542,13 +1561,6 @@ static abi_long do_setsockopt(int sockfd, int level, int optname,
         case TARGET_SO_RCVLOWAT:
 		optname = SO_RCVLOWAT;
 		break;
-        case TARGET_SO_RCVTIMEO:
-		optname = SO_RCVTIMEO;
-		break;
-        case TARGET_SO_SNDTIMEO:
-		optname = SO_SNDTIMEO;
-		break;
-            break;
         default:
             goto unimplemented;
         }
-- 
1.7.10.4

             reply	other threads:[~2012-12-31 19:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-31 19:53 Laurent Vivier [this message]
2012-12-31 21:40 ` [Qemu-devel] [PATCH] linux-user: correct setsockopt() SO_SNDTIMEO and SO_RCVTIMEO take a struct timeval, not an int Peter Maydell
2013-01-01 18:24 ` [Qemu-devel] [PATCH][v2] linux-user: correct setsockopt() Laurent Vivier
2013-01-19 23:32   ` Laurent Vivier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1356983610-14793-1-git-send-email-laurent@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).