From nobody Tue Feb 10 09:10:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1768168834; cv=none; d=zohomail.com; s=zohoarc; b=LO19wLUloLJq/GkScq9KfYxj/TEpNgD0eWY/I0Kaw/0IzJwFwbK0Pwvn09Mnpt69N1IT/gx0c0eLs9XM6YYpxVxzgiLabowuoTbdB1b3U+jhFD56X/5SmnFxLoWbKThg0NiE13DlSfioNoU8OB7xsirpls3GtxYJiagrkHf5lf8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768168834; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=gAbrBW43TSmdFxMsFe0oqQvzIcATowrJezfs7xJvcpM=; b=lB61fKoUcYvhx9CTdXQcTLrqFZKgODppR0doFAnwIMvPL/DezQYdp6VLcRlHvK0p6A9aE8fJClqhqHGd6UN/ZVWjWAu6YPhogIOCwbNKwKN8hEpAfAjQJcfePsCXOyKA22Guw6J68NUGPpILauyH21UPLmcddaZ+iwOQrm/6cJY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1768168834961364.70540378448584; Sun, 11 Jan 2026 14:00:34 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vf3Sf-0005ST-L5; Sun, 11 Jan 2026 16:59:01 -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 1vf3Se-0005Rw-E6 for qemu-devel@nongnu.org; Sun, 11 Jan 2026 16:59:00 -0500 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vf3Sc-0003uZ-Pc for qemu-devel@nongnu.org; Sun, 11 Jan 2026 16:59:00 -0500 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-2a0d06ffa2aso42936105ad.3 for ; Sun, 11 Jan 2026 13:58:58 -0800 (PST) Received: from stoup.. ([202.86.209.61]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a3e3c3a31dsm155272365ad.9.2026.01.11.13.58.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Jan 2026 13:58:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1768168737; x=1768773537; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gAbrBW43TSmdFxMsFe0oqQvzIcATowrJezfs7xJvcpM=; b=hO7Z2WQtQHmumGYzYo4nTDKTxzrxLg8NZLw2mfMjytf8eb6ikB0RGczog5kIoq2H00 AVRNxt+ut3S/+VL9003ZRooLVxZl65zKSruKRWrADBdfL7BXJfQ60yO5UwYyUW7ExN5N hSt5pG3R/0sKnXCsv2HZ5adc1JKXfVjxk7T9wSEgrfuhovDJejzDWB4IoNKi6ce+7vQg dxJJydbaATV0vzIDpx8tp2bUSQZLblHPsGYrzURkB31lAeakavpuKlnICDE0IrB6geoR pheAr+p+JrprYtS+or4TmtAzSjjUkiDbPcijy1wBnze3cZZINveTlnB5Lego1oygeMbD 6ShQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768168737; x=1768773537; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=gAbrBW43TSmdFxMsFe0oqQvzIcATowrJezfs7xJvcpM=; b=ZcfxsQlLwaYu6Hek30DV9+ouCbhZyAXkER0UbBUjgrcdymdw9HY6wG3Jy8yA7pT5u4 j4OLbR1mDhWLVDo+7xT0omAhH0ttYqtg+t9BW/V0Y/gjnk7I+6k4Xi3Bh8nJUImdrsou IEORh3SXe58yC1Rz88DJ7QBMTOplw0R42Ecuaz3mEAFBoTzgAF+Y1gTxfuSEQNARr/RQ sFIadfBi51LWPHEyavhCWcwjkS53lHkUz5K+CaxJRxmRAiQ53y/v2CkK9W8tMCp+Q9ei 7nxhIMk8itAd8r2oSTfqpA9N8iEqcSzZs0PelT6BtEiRlMcPPYZGEM1QK378LZzGnnVY XbbQ== X-Gm-Message-State: AOJu0YwhzsD2eetLU6UZG3xTG2GAphJC65j3uz/KT/9Dq/p4YDmi++Za rPMnPQpHL91d5PrXTF+LySW+gqt5thAryjECTL72o7did2M2udA0gL9pFoldncjPdJb0HaMGDtz 7PE0gUWk= X-Gm-Gg: AY/fxX7AhbEpghEHGDQhPpwIEoS0L+pZuQujnxXqf2ldoMZzhnYDeRo06uzLT59p8Z3 T2Lm4vDQRtW1BnLly6O9EHDh6i5PYgnzEz9C5HhPJebljqMP3w+tOrOm8ER04Rn0SOjMEFHBUDq o+Ez/CVW7VUdrR9PywrkMGwp8Iw0igp7AyViGynlDfWsLim2Apy+Ytxu0xAVcNBrE76CkMA82IL P82+YLnW288hvLyEmWDxlY7R6byugpGQqhcKeVBzp1ouQDdc8N4G24QpVdV6PG/F4njn3Y4PlDK VvVRlSe+O/GD4u0mpCp+j+EiPslDvbhBUx2Ox1/eMgJ6E2dgV1M05uMbH2gyaBhI9z8dqUOPbME 837blbf9c64K+MyB0efitx1gxCJwbYDs/4PEk/VltIIFXERKyAUwPNdDp3CkYgd+ZDEnRmnLbBt fPazjax/tjLz9SF4U= X-Google-Smtp-Source: AGHT+IH1Z1uPxFEsP6S2TCuDvgVH2JD08gvE2cd4dXJhYGC6Y/jlHt8agLvhRRWbBdacZT47fl82Pw== X-Received: by 2002:a17:903:3c2f:b0:295:586d:677f with SMTP id d9443c01a7336-2a3ee4139acmr162412705ad.10.1768168737292; Sun, 11 Jan 2026 13:58:57 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Michael Tokarev , Pierrick Bouvier Subject: [PULL 12/13] linux-user: implement epoll_pwait2 syscall Date: Mon, 12 Jan 2026 08:58:17 +1100 Message-ID: <20260111215819.569209-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260111215819.569209-1-richard.henderson@linaro.org> References: <20260111215819.569209-1-richard.henderson@linaro.org> 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=2607:f8b0:4864:20::632; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x632.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: qemu development 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-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1768168836457158500 Content-Type: text/plain; charset="utf-8" From: Michael Tokarev 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 Signed-off-by: Richard Henderson Message-ID: <20260109090937.599881-3-mjt@tls.msk.ru> --- 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 2c7e1eb5b2..67ad681098 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) @@ -13623,12 +13626,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; @@ -13648,6 +13659,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 @@ -13658,8 +13670,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); @@ -13668,7 +13685,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.43.0