[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 10/16] linux-user: support timerfd_{create, gettime,
From: |
Paul Burton |
Subject: |
[Qemu-devel] [PATCH 10/16] linux-user: support timerfd_{create, gettime, settime} syscalls |
Date: |
Sun, 15 Jun 2014 17:18:27 +0100 |
Adds support for the timerfd_create, timerfd_gettime & timerfd_settime
syscalls, allowing use of timerfds by target programs.
Signed-off-by: Paul Burton <address@hidden>
---
linux-user/strace.list | 9 +++++++++
linux-user/syscall.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 53 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 8ebb9e7..0830205 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 <sys/shm.h>
#include <sys/sem.h>
#include <sys/statfs.h>
+#include <sys/timerfd.h>
#include <utime.h>
#include <sys/sysinfo.h>
//#include <sys/user.h>
@@ -9416,6 +9417,49 @@ 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
- [Qemu-devel] [PATCH 02/16] linux-user: support SO_ACCEPTCONN getsockopt option, (continued)
- [Qemu-devel] [PATCH 02/16] linux-user: support SO_ACCEPTCONN getsockopt option, Paul Burton, 2014/06/15
- [Qemu-devel] [PATCH 03/16] linux-user: support SO_{SND, RCV}BUFFORCE setsockopt options, Paul Burton, 2014/06/15
- [Qemu-devel] [PATCH 04/16] linux-user: support SO_PASSSEC setsockopt option, Paul Burton, 2014/06/15
- [Qemu-devel] [PATCH 05/16] linux-user: allow NULL arguments to mount, Paul Burton, 2014/06/15
- [Qemu-devel] [PATCH 06/16] linux-user: support strace of epoll_create1, Paul Burton, 2014/06/15
- [Qemu-devel] [PATCH 07/16] linux-user: fix struct target_epoll_event layout for MIPS, Paul Burton, 2014/06/15
- [Qemu-devel] [PATCH 08/16] linux-user: respect timezone for settimeofday, Paul Burton, 2014/06/15
- [Qemu-devel] [PATCH 09/16] linux-user: allow NULL tv argument for settimeofday, Paul Burton, 2014/06/15
- [Qemu-devel] [PATCH 10/16] linux-user: support timerfd_{create, gettime, settime} syscalls,
Paul Burton <=
- [Qemu-devel] [PATCH 11/16] linux-user: support ioprio_{get, set} syscalls, Paul Burton, 2014/06/15
- [Qemu-devel] [PATCH 12/16] linux-user: support {name_to, open_by}_handle_at syscalls, Paul Burton, 2014/06/15
- [Qemu-devel] [PATCH 13/16] linux-user: support the setns syscall, Paul Burton, 2014/06/15
- [Qemu-devel] [PATCH 15/16] linux-user: support the KDSIGACCEPT ioctl, Paul Burton, 2014/06/15
- [Qemu-devel] [PATCH 14/16] linux-user: support the unshare syscall, Paul Burton, 2014/06/15
- [Qemu-devel] [PATCH 16/16] linux-user: support the SIOCGIFINDEX ioctl, Paul Burton, 2014/06/15
- Re: [Qemu-devel] [PATCH 00/16] linux-user fixes & improvements, Riku Voipio, 2014/06/17
- Re: [Qemu-devel] [PATCH 00/16] linux-user fixes & improvements, Riku Voipio, 2014/06/21