Received: from [140.186.70.92] (port=50658 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ph62e-00078T-Bk for qemu-devel@nongnu.org; Sun, 23 Jan 2011 14:56:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ph62d-0005fd-0B for qemu-devel@nongnu.org; Sun, 23 Jan 2011 14:56:04 -0500 Received: from smtp.gentoo.org ([140.211.166.183]:48236) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ph62c-0005fX-QO for qemu-devel@nongnu.org; Sun, 23 Jan 2011 14:56:02 -0500 From: Mike Frysinger Date: Sun, 23 Jan 2011 14:56:03 -0500 Message-Id: <1295812563-7163-1-git-send-email-vapier@gentoo.org> Subject: [Qemu-devel] [PATCH] linux-user: add ppoll syscall support List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Riku Voipio Some architectures (like Blackfin) only implement ppoll (and skip poll). So add support for it using existing poll code. Signed-off-by: Mike Frysinger --- linux-user/syscall.c | 29 ++++++++++++++++++++++++++++- 1 files changed, 28 insertions(+), 1 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 6116ab5..5382662 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6230,18 +6230,42 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, ret = do_select(arg1, arg2, arg3, arg4, arg5); break; #endif -#ifdef TARGET_NR_poll +#if defined(TARGET_NR_poll) || defined(TARGET_NR_ppoll) +# ifdef TARGET_NR_poll case TARGET_NR_poll: +# endif +# ifdef TARGET_NR_ppoll + case TARGET_NR_ppoll: +# endif { struct target_pollfd *target_pfd; unsigned int nfds = arg2; int timeout = arg3; struct pollfd *pfd; unsigned int i; + sigset_t origmask; target_pfd = lock_user(VERIFY_WRITE, arg1, sizeof(struct target_pollfd) * nfds, 1); if (!target_pfd) goto efault; + + if (num == TARGET_NR_ppoll) { + sigset_t set; + abi_ulong mask; + + if (arg3) { + struct timespec timeout_ts; + target_to_host_timespec(&timeout_ts, arg3); + timeout = timeout_ts.tv_sec * 1000 + + timeout_ts.tv_nsec / 1000000; + } else + timeout = -1; + + mask = arg4; + target_to_host_old_sigset(&set, &mask); + sigprocmask(SIG_SETMASK, &set, &origmask); + } + pfd = alloca(sizeof(struct pollfd) * nfds); for(i = 0; i < nfds; i++) { pfd[i].fd = tswap32(target_pfd[i].fd); @@ -6256,6 +6280,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, - sizeof(struct pollfd)); } unlock_user(target_pfd, arg1, ret); + + if (num == TARGET_NR_ppoll) + sigprocmask(SIG_SETMASK, &origmask, NULL); } break; #endif -- 1.7.4.rc2