From nobody Mon Feb 9 09:38:42 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1767949820203698.3871956377155; Fri, 9 Jan 2026 01:10:20 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ve8VC-0006tN-JW; Fri, 09 Jan 2026 04:09:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ve8V9-0006sU-5B for qemu-devel@nongnu.org; Fri, 09 Jan 2026 04:09:47 -0500 Received: from isrv.corpit.ru ([212.248.84.144]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ve8V3-0008U0-BS for qemu-devel@nongnu.org; Fri, 09 Jan 2026 04:09:44 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 2695B17C2D1 for ; Fri, 09 Jan 2026 12:08:36 +0300 (MSK) Received: from think4mjt.tls.msk.ru (mjtthink.wg.tls.msk.ru [192.168.177.146]) by tsrv.corpit.ru (Postfix) with ESMTP id B0F9B348AB3; Fri, 09 Jan 2026 12:09:37 +0300 (MSK) From: Michael Tokarev To: qemu-devel@nongnu.org Cc: Michael Tokarev Subject: [PATCH v2 1/2] linux-user: cleanup epoll_pwait ifdeff'ery Date: Fri, 9 Jan 2026 12:09:36 +0300 Message-ID: <20260109090937.599881-2-mjt@tls.msk.ru> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260109090937.599881-1-mjt@tls.msk.ru> References: <20260109090937.599881-1-mjt@tls.msk.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=212.248.84.144; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1767949830634158500 Content-Type: text/plain; charset="utf-8" All linux targets these days have epoll_pwait system call (while some miss epoll_wait, which is less generic). And all linux targets definitely has one or another epoll_*wait* system call - so whole code block dealing with this system call should always be present. Remove the now-unneeded ifdef'fery. Reviewed-by: Pierrick Bouvier Signed-off-by: Michael Tokarev --- linux-user/syscall.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 2060e561a2..d89c36382e 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -13615,13 +13615,10 @@ static abi_long do_syscall1(CPUArchState *cpu_env= , int num, abi_long arg1, } #endif =20 -#if defined(TARGET_NR_epoll_wait) || defined(TARGET_NR_epoll_pwait) #if defined(TARGET_NR_epoll_wait) case TARGET_NR_epoll_wait: #endif -#if defined(TARGET_NR_epoll_pwait) case TARGET_NR_epoll_pwait: -#endif { struct target_epoll_event *target_ep; struct epoll_event *ep; @@ -13646,7 +13643,6 @@ static abi_long do_syscall1(CPUArchState *cpu_env, = int num, abi_long arg1, } =20 switch (num) { -#if defined(TARGET_NR_epoll_pwait) case TARGET_NR_epoll_pwait: { sigset_t *set =3D NULL; @@ -13666,7 +13662,6 @@ static abi_long do_syscall1(CPUArchState *cpu_env, = int num, abi_long arg1, } break; } -#endif #if defined(TARGET_NR_epoll_wait) case TARGET_NR_epoll_wait: ret =3D get_errno(safe_epoll_pwait(epfd, ep, maxevents, timeou= t, @@ -13690,8 +13685,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, = int num, abi_long arg1, g_free(ep); return ret; } -#endif -#endif +#endif /* CONFIG_EPOLL */ #ifdef TARGET_NR_prlimit64 case TARGET_NR_prlimit64: { --=20 2.47.3 From nobody Mon Feb 9 09:38:42 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1767949840210760.8166272808136; Fri, 9 Jan 2026 01:10:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ve8VI-0006xO-D2; Fri, 09 Jan 2026 04:09:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ve8VE-0006wT-Qg for qemu-devel@nongnu.org; Fri, 09 Jan 2026 04:09:53 -0500 Received: from isrv.corpit.ru ([212.248.84.144]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ve8VB-0008Uq-In for qemu-devel@nongnu.org; Fri, 09 Jan 2026 04:09:52 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 2EF3617C2D2 for ; Fri, 09 Jan 2026 12:08:36 +0300 (MSK) Received: from think4mjt.tls.msk.ru (mjtthink.wg.tls.msk.ru [192.168.177.146]) by tsrv.corpit.ru (Postfix) with ESMTP id BDD77348AB4; Fri, 09 Jan 2026 12:09:37 +0300 (MSK) From: Michael Tokarev To: qemu-devel@nongnu.org Cc: Michael Tokarev Subject: [PATCH v2 2/2] linux-user: implement epoll_pwait2 syscall Date: Fri, 9 Jan 2026 12:09:37 +0300 Message-ID: <20260109090937.599881-3-mjt@tls.msk.ru> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260109090937.599881-1-mjt@tls.msk.ru> References: <20260109090937.599881-1-mjt@tls.msk.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=212.248.84.144; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1767949844907158500 Content-Type: text/plain; charset="utf-8" epoll_pwait2 is the same as epoll_pwait but with timeout being (a pointer to) struct timespec instead of an integer. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3210 Signed-off-by: Michael Tokarev Reviewed-by: Pierrick Bouvier --- linux-user/syscall.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index d89c36382e..8f41cdb94b 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -708,8 +708,11 @@ safe_syscall5(int, ppoll, struct pollfd *, ufds, unsig= ned int, nfds, size_t, sigsetsize) #endif safe_syscall6(int, epoll_pwait, int, epfd, struct epoll_event *, events, - int, maxevents, int, timeout, const sigset_t *, sigmask, - size_t, sigsetsize) + int, maxevents, int, timeout, + const sigset_t *, sigmask, size_t, sigsetsize) +safe_syscall6(int, epoll_pwait2, int, epfd, struct epoll_event *, events, + int, maxevents, struct timespec *, timeout_ts, + const sigset_t *, sigmask, size_t, sigsetsize) #if defined(__NR_futex) safe_syscall6(int,futex,int *,uaddr,int,op,int,val, \ const struct timespec *,timeout,int *,uaddr2,int,val3) @@ -13619,12 +13622,20 @@ static abi_long do_syscall1(CPUArchState *cpu_env= , int num, abi_long arg1, case TARGET_NR_epoll_wait: #endif case TARGET_NR_epoll_pwait: + case TARGET_NR_epoll_pwait2: { struct target_epoll_event *target_ep; struct epoll_event *ep; int epfd =3D arg1; int maxevents =3D arg3; - int timeout =3D arg4; + struct timespec ts, *timeout_ts =3D NULL; + + if (num =3D=3D TARGET_NR_epoll_pwait2 && arg4 !=3D 0) { + if (target_to_host_timespec(&ts, arg4)) { + return -TARGET_EFAULT; + } + timeout_ts =3D &ts; + } =20 if (maxevents <=3D 0 || maxevents > TARGET_EP_MAX_EVENTS) { return -TARGET_EINVAL; @@ -13644,6 +13655,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, = int num, abi_long arg1, =20 switch (num) { case TARGET_NR_epoll_pwait: + case TARGET_NR_epoll_pwait2: { sigset_t *set =3D NULL; =20 @@ -13654,8 +13666,13 @@ static abi_long do_syscall1(CPUArchState *cpu_env,= int num, abi_long arg1, } } =20 - ret =3D get_errno(safe_epoll_pwait(epfd, ep, maxevents, timeou= t, - set, SIGSET_T_SIZE)); + if (num =3D=3D TARGET_NR_epoll_pwait) { + ret =3D get_errno(safe_epoll_pwait(epfd, ep, maxevents, ar= g4, + set, SIGSET_T_SIZE)); + } else { + ret =3D get_errno(safe_epoll_pwait2(epfd, ep, maxevents, t= imeout_ts, + set, SIGSET_T_SIZE)); + } =20 if (set) { finish_sigsuspend_mask(ret); @@ -13664,7 +13681,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, = int num, abi_long arg1, } #if defined(TARGET_NR_epoll_wait) case TARGET_NR_epoll_wait: - ret =3D get_errno(safe_epoll_pwait(epfd, ep, maxevents, timeou= t, + ret =3D get_errno(safe_epoll_pwait(epfd, ep, maxevents, arg4, NULL, 0)); break; #endif --=20 2.47.3