From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44954) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wyeyp-0000j0-12 for qemu-devel@nongnu.org; Sun, 22 Jun 2014 06:26:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wyeyj-0005Lm-Cf for qemu-devel@nongnu.org; Sun, 22 Jun 2014 06:26:34 -0400 Received: from mail-we0-x22a.google.com ([2a00:1450:400c:c03::22a]:58268) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wyeyj-0005LR-6N for qemu-devel@nongnu.org; Sun, 22 Jun 2014 06:26:29 -0400 Received: by mail-we0-f170.google.com with SMTP id w61so5609875wes.29 for ; Sun, 22 Jun 2014 03:26:28 -0700 (PDT) Sender: Paul Burton From: Paul Burton Date: Sun, 22 Jun 2014 11:25:42 +0100 Message-Id: <1403432748-4679-11-git-send-email-paul@archlinuxmips.org> In-Reply-To: <1403432748-4679-1-git-send-email-paul@archlinuxmips.org> References: <1403432748-4679-1-git-send-email-paul@archlinuxmips.org> Subject: [Qemu-devel] [PATCH v3 10/16] linux-user: support timerfd_{create, gettime, settime} syscalls List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Riku Voipio , Paul Burton Adds support for the timerfd_create, timerfd_gettime & timerfd_settime syscalls, allowing use of timerfds by target programs. Signed-off-by: Paul Burton --- Changes in v3: - Fix coding style, checkpatch clean. Changes in v2: - None. --- linux-user/strace.list | 9 +++++++++ linux-user/syscall.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/linux-user/strace.list b/linux-user/strace.list index fcb258d..8de972a 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -1404,6 +1404,15 @@ #ifdef TARGET_NR_timer_settime { TARGET_NR_timer_settime, "timer_settime" , NULL, NULL, NULL }, #endif +#ifdef TARGET_NR_timerfd_create +{ TARGET_NR_timerfd_create, "timerfd_create" , NULL, NULL, NULL }, +#endif +#ifdef TARGET_NR_timerfd_gettime +{ TARGET_NR_timerfd_gettime, "timerfd_gettime" , NULL, NULL, NULL }, +#endif +#ifdef TARGET_NR_timerfd_settime +{ TARGET_NR_timerfd_settime, "timerfd_settime" , NULL, NULL, NULL }, +#endif #ifdef TARGET_NR_times { TARGET_NR_times, "times" , NULL, NULL, NULL }, #endif diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 700cfec..0d8cd0b 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -58,6 +58,7 @@ int __clone2(int (*fn)(void *), void *child_stack_base, #include #include #include +#include #include #include //#include @@ -9443,6 +9444,50 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, } #endif +#ifdef TARGET_NR_timerfd_create + case TARGET_NR_timerfd_create: + ret = get_errno(timerfd_create(arg1, + target_to_host_bitmask(arg2, fcntl_flags_tbl))); + break; +#endif + +#ifdef TARGET_NR_timerfd_gettime + case TARGET_NR_timerfd_gettime: + { + struct itimerspec its_curr; + + ret = get_errno(timerfd_gettime(arg1, &its_curr)); + + if (arg2 && host_to_target_itimerspec(arg2, &its_curr)) { + goto efault; + } + } + break; +#endif + +#ifdef TARGET_NR_timerfd_settime + case TARGET_NR_timerfd_settime: + { + struct itimerspec its_new, its_old, *p_new; + + if (arg3) { + if (target_to_host_itimerspec(&its_new, arg3)) { + goto efault; + } + p_new = &its_new; + } else { + p_new = NULL; + } + + ret = get_errno(timerfd_settime(arg1, arg2, p_new, &its_old)); + + if (arg4 && host_to_target_itimerspec(arg4, &its_old)) { + goto efault; + } + } + break; +#endif + default: unimplemented: gemu_log("qemu: Unsupported syscall: %d\n", num); -- 2.0.0