[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 02/11] linux-user: Add support for clock_adjtime(
From: |
Aleksandar Markovic |
Subject: |
[Qemu-devel] [PATCH v4 02/11] linux-user: Add support for clock_adjtime() syscall |
Date: |
Wed, 14 Sep 2016 17:22:00 +0200 |
From: Aleksandar Markovic <address@hidden>
This patch implements Qemu user mode clock_adjtime() syscall support.
The implementation is based on invocation of host's clock_adjtime(), and is
very similar to the implementation of adjtimex() syscall support. The main
difference is the presence of "clockid_t" argument in clock_adjtime().
Signed-off-by: Aleksandar Rikalo <address@hidden>
Signed-off-by: Aleksandar Markovic <address@hidden>
---
linux-user/strace.c | 13 +++++++++++++
linux-user/strace.list | 3 +++
linux-user/syscall.c | 19 ++++++++++++++++++-
3 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/linux-user/strace.c b/linux-user/strace.c
index 7ddcaf8..4524c70 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -968,6 +968,19 @@ print_chmod(const struct syscallname *name,
}
#endif
+#ifdef TARGET_NR_clock_adjtime
+static void
+print_clock_adjtime(const struct syscallname *name,
+ abi_long arg0, abi_long arg1, abi_long arg2,
+ abi_long arg3, abi_long arg4, abi_long arg5)
+{
+ print_syscall_prologue(name);
+ print_raw_param("%d", arg0, 0);
+ print_pointer(arg1, 1);
+ print_syscall_epilogue(name);
+}
+#endif
+
#ifdef TARGET_NR_clone
static void do_print_clone(unsigned int flags, abi_ulong newsp,
abi_ulong parent_tidptr, target_ulong newtls,
diff --git a/linux-user/strace.list b/linux-user/strace.list
index 9a665a8..00b2e9b 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -72,6 +72,9 @@
#ifdef TARGET_NR_chroot
{ TARGET_NR_chroot, "chroot" , NULL, NULL, NULL },
#endif
+#ifdef TARGET_NR_clock_adjtime
+{ TARGET_NR_clock_adjtime, "clock_adjtime" , NULL, print_clock_adjtime, NULL },
+#endif
#ifdef TARGET_NR_clock_getres
{ TARGET_NR_clock_getres, "clock_getres" , NULL, NULL, NULL },
#endif
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 5643840..eab9207 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6579,7 +6579,7 @@ static inline abi_long target_ftruncate64(void *cpu_env,
abi_long arg1,
}
#endif
-#ifdef TARGET_NR_adjtimex
+#if defined(TARGET_NR_adjtimex) || defined(TARGET_NR_clock_adjtime)
static inline abi_long target_to_host_timex(struct timex *host_buf,
abi_long target_addr)
{
@@ -9509,6 +9509,23 @@ abi_long do_syscall(void *cpu_env, int num, abi_long
arg1,
}
break;
#endif
+#ifdef TARGET_NR_clock_adjtime
+ case TARGET_NR_clock_adjtime:
+ {
+ struct timex host_buf;
+
+ if (target_to_host_timex(&host_buf, arg2) != 0) {
+ goto efault;
+ }
+ ret = get_errno(clock_adjtime(arg1, &host_buf));
+ if (!is_error(ret) && arg1) {
+ if (host_to_target_timex(arg2, &host_buf) != 0) {
+ goto efault;
+ }
+ }
+ }
+ break;
+#endif
#ifdef TARGET_NR_create_module
case TARGET_NR_create_module:
#endif
--
2.9.3
- [Qemu-devel] [PATCH v4 00/11] linux user: Fix assorted Qemu user mode issues, Aleksandar Markovic, 2016/09/14
- [Qemu-devel] [PATCH v4 01/11] linux-user: Add support for adjtimex() syscall, Aleksandar Markovic, 2016/09/14
- [Qemu-devel] [PATCH v4 02/11] linux-user: Add support for clock_adjtime() syscall,
Aleksandar Markovic <=
- [Qemu-devel] [PATCH v4 03/11] linux-user: Add support for sysfs() syscall, Aleksandar Markovic, 2016/09/14
- [Qemu-devel] [PATCH v4 04/11] linux-user: Add support for ustat() syscall, Aleksandar Markovic, 2016/09/14
- [Qemu-devel] [PATCH v4 05/11] linux-user: Fix msgrcv() and msgsnd() syscalls support, Aleksandar Markovic, 2016/09/14
- [Qemu-devel] [PATCH v4 06/11] linux-user: Fix socketcall() syscall support, Aleksandar Markovic, 2016/09/14
- [Qemu-devel] [PATCH v4 07/11] linux-user: Fix syslog() syscall support, Aleksandar Markovic, 2016/09/14
- [Qemu-devel] [PATCH v4 08/11] linux-user: Remove tabs and trailing spaces from linux-user/main.c, Aleksandar Markovic, 2016/09/14
- [Qemu-devel] [PATCH v4 09/11] linux-user: Improve braces-related formatting in linux-user/main.c, Aleksandar Markovic, 2016/09/14
- [Qemu-devel] [PATCH v4 10/11] linux-user: Improve usage of spaces in linux-user/main.c, Aleksandar Markovic, 2016/09/14
- [Qemu-devel] [PATCH v4 11/11] linux-user: Remove a duplicate item from strace.list, Aleksandar Markovic, 2016/09/14
- Re: [Qemu-devel] [PATCH v4 00/11] linux user: Fix assorted Qemu user mode issues, Peter Maydell, 2016/09/14