qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: Helge Deller <deller@gmx.de>,
	Stefan Hajnoczi <stefanha@gmail.com>,
	Richard Henderson <richard.henderson@linaro.org>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH v3 02/12] linux-user: Add missing clock_gettime64() syscall strace
Date: Sun, 25 Sep 2022 17:09:05 +0200	[thread overview]
Message-ID: <5499dddd-4e60-ae0c-eaf4-ad56561f3585@vivier.eu> (raw)
In-Reply-To: <20220918194555.83535-3-deller@gmx.de>

Le 18/09/2022 à 21:45, Helge Deller a écrit :
> Allow linux-user to strace the clock_gettime64() syscall.
> This syscall is used a lot on 32-bit guest architectures which use newer
> glibc versions.
> 
> Signed-off-by: Helge Deller <deller@gmx.de>
> ---
>   linux-user/strace.c    | 53 ++++++++++++++++++++++++++++++++++++++++++
>   linux-user/strace.list |  4 ++++
>   2 files changed, 57 insertions(+)
> 
> diff --git a/linux-user/strace.c b/linux-user/strace.c
> index a4eeef7ae1..816e679995 100644
> --- a/linux-user/strace.c
> +++ b/linux-user/strace.c
> @@ -82,6 +82,7 @@ UNUSED static void print_buf(abi_long addr, abi_long len, int last);
>   UNUSED static void print_raw_param(const char *, abi_long, int);
>   UNUSED static void print_timeval(abi_ulong, int);
>   UNUSED static void print_timespec(abi_ulong, int);
> +UNUSED static void print_timespec64(abi_ulong, int);
>   UNUSED static void print_timezone(abi_ulong, int);
>   UNUSED static void print_itimerval(abi_ulong, int);
>   UNUSED static void print_number(abi_long, int);
> @@ -795,6 +796,24 @@ print_syscall_ret_clock_gettime(CPUArchState *cpu_env, const struct syscallname
>   #define print_syscall_ret_clock_getres     print_syscall_ret_clock_gettime
>   #endif
> 
> +#if defined(TARGET_NR_clock_gettime64)
> +static void
> +print_syscall_ret_clock_gettime64(CPUArchState *cpu_env, const struct syscallname *name,
> +                                abi_long ret, abi_long arg0, abi_long arg1,
> +                                abi_long arg2, abi_long arg3, abi_long arg4,
> +                                abi_long arg5)
> +{
> +    if (!print_syscall_err(ret)) {
> +        qemu_log(TARGET_ABI_FMT_ld, ret);
> +        qemu_log(" (");
> +        print_timespec64(arg1, 1);
> +        qemu_log(")");
> +    }
> +
> +    qemu_log("\n");
> +}
> +#endif
> +
>   #ifdef TARGET_NR_gettimeofday
>   static void
>   print_syscall_ret_gettimeofday(CPUArchState *cpu_env, const struct syscallname *name,
> @@ -1652,6 +1671,27 @@ print_timespec(abi_ulong ts_addr, int last)
>       }
>   }
> 
> +static void
> +print_timespec64(abi_ulong ts_addr, int last)
> +{
> +    if (ts_addr) {
> +        struct target__kernel_timespec *ts;
> +
> +        ts = lock_user(VERIFY_READ, ts_addr, sizeof(*ts), 1);
> +        if (!ts) {
> +            print_pointer(ts_addr, last);
> +            return;
> +        }
> +        qemu_log("{tv_sec = %lld"
> +                 ",tv_nsec = %lld}%s",
> +                 (long long)tswap64(ts->tv_sec), (long long)tswap64(ts->tv_nsec),
> +                 get_comma(last));
> +        unlock_user(ts, ts_addr, 0);
> +    } else {
> +        qemu_log("NULL%s", get_comma(last));
> +    }
> +}
> +
>   static void
>   print_timezone(abi_ulong tz_addr, int last)
>   {
> @@ -2267,6 +2307,19 @@ print_clock_gettime(CPUArchState *cpu_env, const struct syscallname *name,
>   #define print_clock_getres     print_clock_gettime
>   #endif
> 
> +#if defined(TARGET_NR_clock_gettime64)
> +static void
> +print_clock_gettime64(CPUArchState *cpu_env, 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_enums(clockids, arg0, 0);
> +    print_pointer(arg1, 1);
> +    print_syscall_epilogue(name);
> +}
> +#endif

I think it could be simply:

#define print_clock_gettime64 print_clock_gettime where print_clock_gettime() is defined.

except that:

Reviewed-by: Laurent Vivier <laurent@vivier.eu>



  reply	other threads:[~2022-09-25 15:09 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-18 19:45 [PATCH v3 00/12] linux-user: Add more syscalls, enhance tracing & logging enhancements Helge Deller
2022-09-18 19:45 ` [PATCH v3 01/12] linux-user: Add missing signals in strace output Helge Deller
2022-09-25 15:00   ` Laurent Vivier
2022-09-18 19:45 ` [PATCH v3 02/12] linux-user: Add missing clock_gettime64() syscall strace Helge Deller
2022-09-25 15:09   ` Laurent Vivier [this message]
2022-09-25 15:27     ` Helge Deller
2022-09-25 15:47       ` Laurent Vivier
2022-09-25 15:53         ` Helge Deller
2022-09-25 15:58           ` Laurent Vivier
2022-09-25 16:09             ` Helge Deller
2022-09-18 19:45 ` [PATCH v3 03/12] linux-user: Add pidfd_open(), pidfd_send_signal() and pidfd_getfd() syscalls Helge Deller
2022-09-25 15:25   ` Laurent Vivier
2022-09-18 19:45 ` [PATCH v3 04/12] linux-user: Log failing executable in EXCP_DUMP() Helge Deller
2022-09-18 20:37   ` Philippe Mathieu-Daudé via
2022-09-25 15:26   ` Laurent Vivier
2022-09-18 19:45 ` [PATCH v3 05/12] linux-user/hppa: Use EXCP_DUMP() to show enhanced debug info Helge Deller
2022-09-25 15:26   ` Laurent Vivier
2022-09-18 19:45 ` [PATCH v3 06/12] linux-user/hppa: Dump IIR on register dump Helge Deller
2022-09-18 20:38   ` Philippe Mathieu-Daudé via
2022-09-25 15:27   ` Laurent Vivier
2022-09-18 19:45 ` [PATCH v3 07/12] linux-user: Fix strace of chmod() if mode == 0 Helge Deller
2022-09-18 20:46   ` Philippe Mathieu-Daudé via
2022-09-25 15:29   ` Laurent Vivier
2022-09-18 19:45 ` [PATCH v3 08/12] linux-user/hppa: Set TASK_UNMAPPED_BASE to 0xfa000000 for hppa arch Helge Deller
2022-09-18 19:45 ` [PATCH v3 09/12] linux-user: Add strace for clock_nanosleep() Helge Deller
2022-09-25 15:36   ` Laurent Vivier
2022-09-18 19:45 ` [PATCH v3 10/12] linux-user: Show timespec on strace for futex() Helge Deller
2022-09-25 15:38   ` Laurent Vivier
2022-09-18 19:45 ` [PATCH v3 11/12] linux-user: Add close_range() syscall Helge Deller
2022-09-25 15:42   ` Laurent Vivier
2022-09-18 19:45 ` [PATCH v3 12/12] linux-user: Add parameters of getrandom() syscall for strace Helge Deller
2022-09-18 20:49   ` Philippe Mathieu-Daudé via
2022-09-27  7:32 ` [PATCH v3 00/12] linux-user: Add more syscalls, enhance tracing & logging enhancements Laurent Vivier
2022-09-27  8:56   ` Helge Deller
2022-09-27  9:12     ` Laurent Vivier

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=5499dddd-4e60-ae0c-eaf4-ad56561f3585@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=deller@gmx.de \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=stefanha@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).