From: "Carlo Marcelo Arenas Belón" <carenas@gmail.com>
To: qemu-devel@nongnu.org
Cc: riku.voipio@iki.fi, laurent@vivier.eu, peter.maydell@linaro.org,
gang.chen.5i5j@gmail.com, rth@twiddle.net,
"Carlo Marcelo Arenas Belón" <carenas@gmail.com>
Subject: [Qemu-devel] [PATCH 3/3] linux-user: add SO_LINGER to getsockopt
Date: Tue, 19 Sep 2017 16:06:43 -0700 [thread overview]
Message-ID: <20170919230643.87425-3-carenas@gmail.com> (raw)
In-Reply-To: <20170919230643.87425-1-carenas@gmail.com>
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
linux-user/syscall.c | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index ad689dad50..91bd27c63a 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -3178,7 +3178,6 @@ static abi_long do_getsockopt(int sockfd, int level, int optname,
level = SOL_SOCKET;
switch (optname) {
/* These don't just return a single integer */
- case TARGET_SO_LINGER:
case TARGET_SO_RCVTIMEO:
case TARGET_SO_SNDTIMEO:
case TARGET_SO_PEERNAME:
@@ -3216,6 +3215,39 @@ static abi_long do_getsockopt(int sockfd, int level, int optname,
}
break;
}
+ case TARGET_SO_LINGER:
+ {
+ struct linger lg;
+ socklen_t lglen;
+ struct target_linger *tlg;
+
+ if (get_user_u32(len, optlen)) {
+ return -TARGET_EFAULT;
+ }
+ if (len < 0) {
+ return -TARGET_EINVAL;
+ }
+
+ lglen = sizeof(lg);
+ ret = get_errno(getsockopt(sockfd, level, SO_LINGER,
+ &lg, &lglen));
+ if (ret < 0) {
+ return ret;
+ }
+ if (len > lglen) {
+ len = lglen;
+ }
+ if (!lock_user_struct(VERIFY_WRITE, tlg, optval_addr, 0)) {
+ return -TARGET_EFAULT;
+ }
+ __put_user(lg.l_onoff, &tlg->l_onoff);
+ __put_user(lg.l_linger, &tlg->l_linger);
+ unlock_user_struct(tlg, optval_addr, 1);
+ if (put_user_u32(len, optlen)) {
+ return -TARGET_EFAULT;
+ }
+ break;
+ }
/* Options with 'int' argument. */
case TARGET_SO_DEBUG:
optname = SO_DEBUG;
--
2.14.1
next prev parent reply other threads:[~2017-09-19 23:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-19 8:15 [Qemu-devel] [PATCH v3] linux-user: syscall: Add SO_LINGER for setsockopt Carlo Marcelo Arenas Belón
2017-09-19 11:42 ` Laurent Vivier
2017-09-19 23:06 ` [Qemu-devel] [PATCH 1/3] linux-user: fix TARGET_SO_LINGER for sparc Carlo Marcelo Arenas Belón
2017-09-19 23:06 ` [Qemu-devel] [PATCH 2/3] linux-user: add SO_LINGER to setsockopt Carlo Marcelo Arenas Belón
2017-09-20 8:39 ` Laurent Vivier
2017-09-20 17:29 ` Carlo Arenas
2017-09-20 18:53 ` Laurent Vivier
2017-09-20 23:03 ` Carlo Arenas
2017-09-19 23:06 ` Carlo Marcelo Arenas Belón [this message]
2017-09-20 9:09 ` [Qemu-devel] [PATCH 3/3] linux-user: add SO_LINGER to getsockopt Laurent Vivier
2017-09-20 8:26 ` [Qemu-devel] [PATCH 1/3] linux-user: fix TARGET_SO_LINGER for sparc 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=20170919230643.87425-3-carenas@gmail.com \
--to=carenas@gmail.com \
--cc=gang.chen.5i5j@gmail.com \
--cc=laurent@vivier.eu \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
--cc=rth@twiddle.net \
/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).