[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 37/44] linux-user: Use safe_syscall wrapper for epoll
From: |
riku . voipio |
Subject: |
[Qemu-devel] [PULL 37/44] linux-user: Use safe_syscall wrapper for epoll_wait syscalls |
Date: |
Wed, 8 Jun 2016 16:30:18 +0300 |
From: Peter Maydell <address@hidden>
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 <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
---
configure | 21 ++-------------------
linux-user/syscall.c | 18 ++++++++++--------
2 files changed, 12 insertions(+), 27 deletions(-)
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 <sys/epoll.h>
@@ -3821,20 +3821,6 @@ if compile_prog "" "" ; then
epoll_create1=yes
fi
-epoll_pwait=no
-cat > $TMPC << EOF
-#include <sys/epoll.h>
-
-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:
--
2.1.4
- [Qemu-devel] [PULL 19/44] linux-user: Restart exit() if signal pending, (continued)
- [Qemu-devel] [PULL 19/44] linux-user: Restart exit() if signal pending, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 20/44] linux-user: Use safe_syscall for kill, tkill and tgkill syscalls, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 25/44] linux-user: Fix handling of arm_fadvise64_64 syscall, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 21/44] linux-user: Restart fork() if signals pending, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 28/44] linux-user: Use safe_syscall wrapper for readv and writev syscalls, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 22/44] linux-user: Use both si_code and si_signo when converting siginfo_t, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 26/44] linux-user: Fix NR_fadvise64 and NR_fadvise64_64 for 32-bit guests, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 33/44] linux-user: Use safe_syscall wrapper for flock, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 30/44] linux-user: Use safe_syscall wrapper for send* and recv* syscalls, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 29/44] linux-user: Use safe_syscall wrapper for connect syscall, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 37/44] linux-user: Use safe_syscall wrapper for epoll_wait syscalls,
riku . voipio <=
- [Qemu-devel] [PULL 27/44] linux-user: Fix error conversion in 64-bit fadvise syscall, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 36/44] linux-user: Use safe_syscall wrapper for poll and ppoll syscalls, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 32/44] linux-user: Use safe_syscall wrapper for mq_timedsend and mq_timedreceive, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 35/44] linux-user: Use safe_syscall wrapper for sleep syscalls, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 31/44] linux-user: Use safe_syscall wrapper for msgsnd and msgrcv, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 38/44] linux-user: Use safe_syscall wrapper for semop, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 39/44] linux-user: Use safe_syscall wrapper for accept and accept4 syscalls, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 41/44] linux-user: Correct signedness of target_flock l_start and l_len fields, riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 43/44] linux-user: Special-case ERESTARTSYS in target_strerror(), riku . voipio, 2016/06/08
- [Qemu-devel] [PULL 34/44] linux-user: Use safe_syscall wrapper for rt_sigtimedwait syscall, riku . voipio, 2016/06/08