From: Riku Voipio <riku.voipio@iki.fi>
To: Aleksandar Markovic <aleksandar.markovic@rt-rk.com>
Cc: qemu-devel@nongnu.org, laurent@vivier.eu,
peter.maydell@linaro.org, petar.jovanovic@imgtec.com,
miodrag.dinic@imgtec.com, aleksandar.rikalo@imgtec.com,
aleksandar.markovic@imgtec.com
Subject: Re: [Qemu-devel] [PATCH v7 02/10] linux-user: Add support for clock_adjtime() syscall
Date: Fri, 7 Oct 2016 13:03:24 +0000 [thread overview]
Message-ID: <20161007130324.GD28620@kos.to> (raw)
In-Reply-To: <20160922165712.79809-3-aleksandar.markovic@rt-rk.com>
On Thu, Sep 22, 2016 at 06:56:51PM +0200, Aleksandar Markovic wrote:
> From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
>
> 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 <aleksandar.rikalo@imgtec.com>
> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
> ---
> linux-user/strace.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++
> linux-user/strace.list | 3 ++
> linux-user/syscall.c | 17 +++++++++++
> 3 files changed, 96 insertions(+)
>
> diff --git a/linux-user/strace.c b/linux-user/strace.c
> index f37b386..a61717d 100644
> --- a/linux-user/strace.c
> +++ b/linux-user/strace.c
> @@ -435,6 +435,69 @@ print_fdset(int n, abi_ulong target_fds_addr)
> }
> #endif
>
> +#ifdef TARGET_NR_clock_adjtime
> +/* IDs of the various system clocks */
> +#define TARGET_CLOCK_REALTIME 0
> +#define TARGET_CLOCK_MONOTONIC 1
> +#define TARGET_CLOCK_PROCESS_CPUTIME_ID 2
> +#define TARGET_CLOCK_THREAD_CPUTIME_ID 3
> +#define TARGET_CLOCK_MONOTONIC_RAW 4
> +#define TARGET_CLOCK_REALTIME_COARSE 5
> +#define TARGET_CLOCK_MONOTONIC_COARSE 6
> +#define TARGET_CLOCK_BOOTTIME 7
> +#define TARGET_CLOCK_REALTIME_ALARM 8
> +#define TARGET_CLOCK_BOOTTIME_ALARM 9
> +#define TARGET_CLOCK_SGI_CYCLE 10
> +#define TARGET_CLOCK_TAI 11
> +
> +static void
> +print_clockid(int clockid, int last)
> +{
> + switch (clockid) {
> + case TARGET_CLOCK_REALTIME:
> + gemu_log("CLOCK_REALTIME");
> + break;
> + case TARGET_CLOCK_MONOTONIC:
> + gemu_log("CLOCK_MONOTONIC");
> + break;
> + case TARGET_CLOCK_PROCESS_CPUTIME_ID:
> + gemu_log("CLOCK_PROCESS_CPUTIME_ID");
> + break;
> + case TARGET_CLOCK_THREAD_CPUTIME_ID:
> + gemu_log("CLOCK_THREAD_CPUTIME_ID");
> + break;
> + case TARGET_CLOCK_MONOTONIC_RAW:
> + gemu_log("CLOCK_MONOTONIC_RAW");
> + break;
> + case TARGET_CLOCK_REALTIME_COARSE:
> + gemu_log("CLOCK_REALTIME_COARSE");
> + break;
> + case TARGET_CLOCK_MONOTONIC_COARSE:
> + gemu_log("CLOCK_MONOTONIC_COARSE");
> + break;
> + case TARGET_CLOCK_BOOTTIME:
> + gemu_log("CLOCK_BOOTTIME");
> + break;
> + case TARGET_CLOCK_REALTIME_ALARM:
> + gemu_log("CLOCK_REALTIME_ALARM");
> + break;
> + case TARGET_CLOCK_BOOTTIME_ALARM:
> + gemu_log("CLOCK_BOOTTIME_ALARM");
> + break;
> + case TARGET_CLOCK_SGI_CYCLE:
> + gemu_log("CLOCK_SGI_CYCLE");
> + break;
> + case TARGET_CLOCK_TAI:
> + gemu_log("CLOCK_TAI");
> + break;
> + default:
> + gemu_log("%d", clockid);
> + break;
> + }
> + gemu_log("%s", get_comma(last));
> +}
> +#endif
> +
> /*
> * Sysycall specific output functions
> */
> @@ -1096,6 +1159,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_clockid(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 44e8322..01aecfc 100644
> --- a/linux-user/strace.list
> +++ b/linux-user/strace.list
> @@ -73,6 +73,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 7ad5b96..9f11ca2 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -9623,6 +9623,23 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
> }
> }
> break;
> +#if defined(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));
When compiling on SuSe11:
linux-user/syscall.o: In function `do_syscall':
/work/linux-user/syscall.c:9710: undefined reference to `clock_adjtime'
The syscall is new enough that it needs a CONFIG_CLOCK_ADJTIME test in configure.
> + if (!is_error(ret)) {
> + 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
>
>
next prev parent reply other threads:[~2016-10-07 13:03 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-22 16:56 [Qemu-devel] [PATCH v7 00/10] linux-user: Fix assorted Qemu user mode issues Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 01/10] linux-user: Add support for adjtimex() syscall Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 02/10] linux-user: Add support for clock_adjtime() syscall Aleksandar Markovic
2016-10-07 13:03 ` Riku Voipio [this message]
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 03/10] linux-user: Add support for syncfs() syscall Aleksandar Markovic
2016-10-07 13:06 ` Riku Voipio
2016-10-07 14:48 ` Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 04/10] linux-user: Add support for sysfs() syscall Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 05/10] linux-user: Add support for ustat() syscall Aleksandar Markovic
2016-10-21 17:04 ` Riku Voipio
2016-10-21 18:01 ` [Qemu-devel] ?==?utf-8?q? " Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 06/10] linux-user: Fix mq_open() syscall support Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 07/10] linux-user: Fix msgrcv() and msgsnd() syscalls support Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 08/10] linux-user: Fix socketcall() syscall support Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 09/10] linux-user: Fix syslog() " Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 10/10] linux-user: Remove a duplicate item from strace.list Aleksandar Markovic
2016-09-22 18:43 ` [Qemu-devel] [PATCH v7 00/10] linux-user: Fix assorted Qemu user mode issues Laurent Vivier
2016-09-23 8:43 ` Aleksandar Markovic
2016-09-23 9:03 ` Laurent Vivier
2016-09-24 10:19 ` Riku Voipio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161007130324.GD28620@kos.to \
--to=riku.voipio@iki.fi \
--cc=aleksandar.markovic@imgtec.com \
--cc=aleksandar.markovic@rt-rk.com \
--cc=aleksandar.rikalo@imgtec.com \
--cc=laurent@vivier.eu \
--cc=miodrag.dinic@imgtec.com \
--cc=petar.jovanovic@imgtec.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.