From: Helge Deller <deller@kernel.org>
To: laurent@vivier.eu, qemu-devel@nongnu.org
Cc: deller@gmx.de
Subject: [PATCH 3/4] linux-user: Add setsockopt() for SO_RCVTIMEO_NEW and SO_SNDTIMEO_NEW
Date: Fri, 24 Apr 2026 11:08:49 +0200 [thread overview]
Message-ID: <20260424091024.23495-4-deller@kernel.org> (raw)
In-Reply-To: <20260424091024.23495-1-deller@kernel.org>
From: Helge Deller <deller@gmx.de>
Add handlers for both sockopts which use 64-bit time_t from userspace.
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/885
Signed-off-by: Helge Deller <deller@gmx.de>
---
linux-user/syscall.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 077ecb7554..7bd5ad548b 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -1143,7 +1143,6 @@ static inline abi_long copy_to_user_timeval(abi_ulong target_tv_addr,
return 0;
}
-#if defined(TARGET_NR_clock_adjtime64) && defined(CONFIG_CLOCK_ADJTIME)
static inline abi_long copy_from_user_timeval64(struct timeval *tv,
abi_ulong target_tv_addr)
{
@@ -1160,7 +1159,6 @@ static inline abi_long copy_from_user_timeval64(struct timeval *tv,
return 0;
}
-#endif
static inline abi_long copy_to_user_timeval64(abi_ulong target_tv_addr,
const struct timeval *tv)
@@ -2391,6 +2389,25 @@ static abi_long do_setsockopt(int sockfd, int level, int optname,
&tv, sizeof(tv)));
return ret;
}
+ case TARGET_SO_RCVTIMEO_NEW:
+ case TARGET_SO_SNDTIMEO_NEW:
+ {
+ struct timeval tv;
+
+ if (optlen != sizeof(struct target__kernel_sock_timeval)) {
+ return -TARGET_EINVAL;
+ }
+
+ if (copy_from_user_timeval64(&tv, optval_addr)) {
+ return -TARGET_EFAULT;
+ }
+
+ ret = get_errno(setsockopt(sockfd, SOL_SOCKET,
+ optname == TARGET_SO_RCVTIMEO_NEW ?
+ SO_RCVTIMEO : SO_SNDTIMEO,
+ &tv, sizeof(tv)));
+ return ret;
+ }
case TARGET_SO_ATTACH_FILTER:
{
struct target_sock_fprog *tfprog;
--
2.53.0
next prev parent reply other threads:[~2026-04-24 9:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-24 9:08 linux-user: Add sockopts for SO_RCVTIMEO_NEW and SO_SNDTIMEO_NEW Helge Deller
2026-04-24 9:08 ` [PATCH 1/4] linux-user: Use int64_t in target__kernel_sock_timeval Helge Deller
2026-04-24 22:14 ` Richard Henderson
2026-04-24 22:37 ` Helge Deller
2026-04-24 9:08 ` [PATCH 2/4] linux-user: Define SO_TIMESTAMP*_NEW and SO_RCVTIMEIO_NEW Helge Deller
2026-04-24 9:08 ` Helge Deller [this message]
2026-04-24 9:08 ` [PATCH 4/4] linux-user: Add getsockopt() for SO_RCVTIMEO_NEW and SO_SNDTIMEO_NEW Helge Deller
2026-04-30 16:34 ` linux-user: Add sockopts " Michael Tokarev
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=20260424091024.23495-4-deller@kernel.org \
--to=deller@kernel.org \
--cc=deller@gmx.de \
--cc=laurent@vivier.eu \
--cc=qemu-devel@nongnu.org \
/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 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.