From patchwork Wed Jun 8 13:30:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 69665 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp2524822qgf; Wed, 8 Jun 2016 07:25:15 -0700 (PDT) X-Received: by 10.200.40.181 with SMTP id i50mr5085332qti.30.1465395915237; Wed, 08 Jun 2016 07:25:15 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id t15si790655qkt.147.2016.06.08.07.25.15 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 08 Jun 2016 07:25:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:57309 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAePy-00043D-N9 for patch@linaro.org; Wed, 08 Jun 2016 10:25:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37282) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdZm-0004dg-8X for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:31:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAdZh-0005s7-6s for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:31:18 -0400 Received: from mail-lf0-x232.google.com ([2a00:1450:4010:c07::232]:36348) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdZg-0005rt-Qp for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:31:13 -0400 Received: by mail-lf0-x232.google.com with SMTP id j5so5845547lfb.3 for ; Wed, 08 Jun 2016 06:31:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hJKFzzRYRBX8Qe3Mo82KwkDY8IQXh0RWjLWglCrIIqE=; b=SKEA23kJBjV/YDy7fO/2LggqmDYQUGp/Wex1VE56blQgs45oeu2Prgzo5R2hcnnbZe fHh/iQpCsyl0HqmWr1fiNM36tw5LtEinszf5BkQ1EgiOxvAOi+Zetn4KI5E5EXupGRVY iyds6/kn0zval6W5J7GSWBB5AcJzrrJO0fnyw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hJKFzzRYRBX8Qe3Mo82KwkDY8IQXh0RWjLWglCrIIqE=; b=OutW1IzIXzzHB4aq4lXcCvg+G6s3uwLbQa63ODZOAI61cJMweDTaa/m4SDFnpdJBCD fvPEbXvEAtIgQDPFrVMFnt3nPBDsisVBEmnLRz0BdGXbIyMtiXD+l0hlLXxPkMNd61dp ZOu59qFzDOIhVmYu8H/oL3U07ycubxowRLfdEPMUpw8LF+2zCYq99ly7OI7E20pCJE9R /OalLHEAdf7OCqYUioE6hz7Mw7E48zkQM+NhDLm6el3BgV2OYYUKd3vEfToXoey9Odcv d2g3o/NNLtk3V5rv/8AcGTXPbd0HHI0zmABKUnze+YcOdksfKuSuSmDFvNez5VdgY48A RxVg== X-Gm-Message-State: ALyK8tIsj0i6SyV9SSU5Fe+oJV6pwrrobmxZsEutiukMKLKU/mMhRPJDzcLYam000EbpjiXz X-Received: by 10.25.159.70 with SMTP id i67mr3888363lfe.225.1465392672082; Wed, 08 Jun 2016 06:31:12 -0700 (PDT) Received: from beaming.home (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id 2sm139854lja.37.2016.06.08.06.31.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Jun 2016 06:31:11 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 8 Jun 2016 16:30:18 +0300 Message-Id: <227f02143f269493543faf6908318c17abd725cd.1465392531.git.riku.voipio@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::232 Subject: [Qemu-devel] [PULL 37/44] linux-user: Use safe_syscall wrapper for epoll_wait syscalls X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell Use the safe_syscall wrapper for epoll_wait and epoll_pwait syscalls. Since we now directly use the host epoll_pwait syscall for both epoll_wait and epoll_pwait, we don't need the configure machinery to check whether glibc supports epoll_pwait(). (The kernel has supported the syscall since 2.6.19 so we can assume it's always there.) Signed-off-by: Peter Maydell Signed-off-by: Riku Voipio --- configure | 21 ++------------------- linux-user/syscall.c | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 27 deletions(-) -- 2.1.4 diff --git a/configure b/configure index d1dbc4b..e995ddd 100755 --- a/configure +++ b/configure @@ -3798,8 +3798,8 @@ if compile_prog "" "" ; then epoll=yes fi -# epoll_create1 and epoll_pwait are later additions -# so we must check separately for their presence +# epoll_create1 is a later addition +# so we must check separately for its presence epoll_create1=no cat > $TMPC << EOF #include @@ -3821,20 +3821,6 @@ if compile_prog "" "" ; then epoll_create1=yes fi -epoll_pwait=no -cat > $TMPC << EOF -#include - -int main(void) -{ - epoll_pwait(0, 0, 0, 0, 0); - return 0; -} -EOF -if compile_prog "" "" ; then - epoll_pwait=yes -fi - # check for sendfile support sendfile=no cat > $TMPC << EOF @@ -5125,9 +5111,6 @@ fi if test "$epoll_create1" = "yes" ; then echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak fi -if test "$epoll_pwait" = "yes" ; then - echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak -fi if test "$sendfile" = "yes" ; then echo "CONFIG_SENDFILE=y" >> $config_host_mak fi diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 8bb9adf..a193849 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -699,6 +699,9 @@ safe_syscall6(int, pselect6, int, nfds, fd_set *, readfds, fd_set *, writefds, \ safe_syscall5(int, ppoll, struct pollfd *, ufds, unsigned int, nfds, struct timespec *, tsp, const sigset_t *, sigmask, size_t, sigsetsize) +safe_syscall6(int, epoll_pwait, int, epfd, struct epoll_event *, events, + int, maxevents, int, timeout, const sigset_t *, sigmask, + size_t, sigsetsize) safe_syscall6(int,futex,int *,uaddr,int,op,int,val, \ const struct timespec *,timeout,int *,uaddr2,int,val3) safe_syscall2(int, rt_sigsuspend, sigset_t *, newset, size_t, sigsetsize) @@ -10835,14 +10838,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, } #endif -#if defined(TARGET_NR_epoll_pwait) && defined(CONFIG_EPOLL_PWAIT) -#define IMPLEMENT_EPOLL_PWAIT -#endif -#if defined(TARGET_NR_epoll_wait) || defined(IMPLEMENT_EPOLL_PWAIT) +#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(IMPLEMENT_EPOLL_PWAIT) +#if defined(TARGET_NR_epoll_pwait) case TARGET_NR_epoll_pwait: #endif { @@ -10861,7 +10861,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, ep = alloca(maxevents * sizeof(struct epoll_event)); switch (num) { -#if defined(IMPLEMENT_EPOLL_PWAIT) +#if defined(TARGET_NR_epoll_pwait) case TARGET_NR_epoll_pwait: { target_sigset_t *target_set; @@ -10880,13 +10880,15 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, set = NULL; } - ret = get_errno(epoll_pwait(epfd, ep, maxevents, timeout, set)); + ret = get_errno(safe_epoll_pwait(epfd, ep, maxevents, timeout, + set, SIGSET_T_SIZE)); break; } #endif #if defined(TARGET_NR_epoll_wait) case TARGET_NR_epoll_wait: - ret = get_errno(epoll_wait(epfd, ep, maxevents, timeout)); + ret = get_errno(safe_epoll_pwait(epfd, ep, maxevents, timeout, + NULL, 0)); break; #endif default: