qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v5 2/8] linux-user: Add support for clock_adjtim


From: Laurent Vivier
Subject: Re: [Qemu-devel] [PATCH v5 2/8] linux-user: Add support for clock_adjtime() syscall
Date: Sun, 18 Sep 2016 00:41:20 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0


Le 14/09/2016 à 22:19, Aleksandar Markovic a écrit :
> 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) {

Why do you check arg1 here ?

> +                if (host_to_target_timex(arg2, &host_buf) != 0) {
> +                    goto efault;
> +                }
> +            }
> +        }
> +        break;
> +#endif
>  #ifdef TARGET_NR_create_module
>      case TARGET_NR_create_module:
>  #endif
> 

Laurent



reply via email to

[Prev in Thread] Current Thread [Next in Thread]