From patchwork Mon Jun 6 18:58:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 9159063 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 89D9360759 for ; Mon, 6 Jun 2016 19:36:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7910328354 for ; Mon, 6 Jun 2016 19:36:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C5302835C; Mon, 6 Jun 2016 19:36:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D5F6628354 for ; Mon, 6 Jun 2016 19:35:59 +0000 (UTC) Received: from localhost ([::1]:45230 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bA0Ja-00031X-Rr for patchwork-qemu-devel@patchwork.kernel.org; Mon, 06 Jun 2016 15:35:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47245) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bA08u-0002Kb-Ih for qemu-devel@nongnu.org; Mon, 06 Jun 2016 15:24:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bA08s-0004Rv-GH for qemu-devel@nongnu.org; Mon, 06 Jun 2016 15:24:55 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:57582) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bA08s-0004Rk-8Z for qemu-devel@nongnu.org; Mon, 06 Jun 2016 15:24:54 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.84_2) (envelope-from ) id 1b9zjF-0008RG-To; Mon, 06 Jun 2016 19:58:25 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 6 Jun 2016 19:58:11 +0100 Message-Id: <1465239499-5048-11-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1465239499-5048-1-git-send-email-peter.maydell@linaro.org> References: <1465239499-5048-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PATCH 10/18] 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: Riku Voipio , Laurent Vivier , patches@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- configure | 21 ++------------------- linux-user/syscall.c | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 27 deletions(-) diff --git a/configure b/configure index b5aab72..93f8739 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 @@ -5114,9 +5100,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 f1cf809..d40d1a7 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -686,6 +686,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) @@ -10194,14 +10197,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 { @@ -10220,7 +10220,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; @@ -10239,13 +10239,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: