From: Laurent Vivier <laurent@vivier.eu>
To: Aleksandar Markovic <aleksandar.markovic@rt-rk.com>,
qemu-devel@nongnu.org
Cc: amarkovic@wavecomp.com, Jim Wilson <jimw@sifive.com>
Subject: Re: [Qemu-devel] [PATCH v16 2/5] linux-user: Add support for strace for statx() syscall
Date: Mon, 1 Jul 2019 10:42:31 +0200 [thread overview]
Message-ID: <9aaae9ca-39d8-39f8-9cb0-516c62eb1d25@vivier.eu> (raw)
In-Reply-To: <1561718618-20218-3-git-send-email-aleksandar.markovic@rt-rk.com>
Le 28/06/2019 à 12:43, Aleksandar Markovic a écrit :
> From: Jim Wilson <jimw@sifive.com>
>
> All of the flags need to be conditional as old systems don't have
> statx support. Otherwise it works the same as other stat family
> syscalls. This requires the pending patch to add statx support.
>
> Tested on Ubuntu 16.04 (no host statx) and Ubuntu 19.04 (with host
> statx) using a riscv32-linux toolchain.
>
> Signed-off-by: Jim Wilson <jimw@sifive.com>
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> Reviewed-by: Laurent Vivier <laurent@vivier.eu>
> ---
> linux-user/strace.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++
> linux-user/strace.list | 3 ++
> 2 files changed, 89 insertions(+)
>
> diff --git a/linux-user/strace.c b/linux-user/strace.c
> index 6f72a74..c80e93b 100644
> --- a/linux-user/strace.c
> +++ b/linux-user/strace.c
> @@ -976,6 +976,76 @@ UNUSED static struct flags msg_flags[] = {
> FLAG_END,
> };
>
> +UNUSED static struct flags statx_flags[] = {
> +#ifdef AT_EMPTY_PATH
> + FLAG_GENERIC(AT_EMPTY_PATH),
> +#endif
> +#ifdef AT_NO_AUTOMOUNT
> + FLAG_GENERIC(AT_NO_AUTOMOUNT),
> +#endif
> +#ifdef AT_SYMLINK_NOFOLLOW
> + FLAG_GENERIC(AT_SYMLINK_NOFOLLOW),
> +#endif
> +#ifdef AT_STATX_SYNC_AS_STAT
> + FLAG_GENERIC(AT_STATX_SYNC_AS_STAT),
> +#endif
> +#ifdef AT_STATX_FORCE_SYNC
> + FLAG_GENERIC(AT_STATX_FORCE_SYNC),
> +#endif
> +#ifdef AT_STATX_DONT_SYNC
> + FLAG_GENERIC(AT_STATX_DONT_SYNC),
> +#endif
> + FLAG_END,
> +};
> +
> +UNUSED static struct flags statx_mask[] = {
> +/* This must come first, because it includes everything. */
> +#ifdef STATX_ALL
> + FLAG_GENERIC(STATX_ALL),
> +#endif
> +/* This must come second; it includes everything except STATX_BTIME. */
> +#ifdef STATX_BASIC_STATS
> + FLAG_GENERIC(STATX_BASIC_STATS),
> +#endif
> +#ifdef STATX_TYPE
> + FLAG_GENERIC(STATX_TYPE),
> +#endif
> +#ifdef STATX_MODE
> + FLAG_GENERIC(STATX_MODE),
> +#endif
> +#ifdef STATX_NLINK
> + FLAG_GENERIC(STATX_NLINK),
> +#endif
> +#ifdef STATX_UID
> + FLAG_GENERIC(STATX_UID),
> +#endif
> +#ifdef STATX_GID
> + FLAG_GENERIC(STATX_GID),
> +#endif
> +#ifdef STATX_ATIME
> + FLAG_GENERIC(STATX_ATIME),
> +#endif
> +#ifdef STATX_MTIME
> + FLAG_GENERIC(STATX_MTIME),
> +#endif
> +#ifdef STATX_CTIME
> + FLAG_GENERIC(STATX_CTIME),
> +#endif
> +#ifdef STATX_INO
> + FLAG_GENERIC(STATX_INO),
> +#endif
> +#ifdef STATX_SIZE
> + FLAG_GENERIC(STATX_SIZE),
> +#endif
> +#ifdef STATX_BLOCKS
> + FLAG_GENERIC(STATX_BLOCKS),
> +#endif
> +#ifdef STATX_BTIME
> + FLAG_GENERIC(STATX_BTIME),
> +#endif
> + FLAG_END,
> +};
> +
> /*
> * print_xxx utility functions. These are used to print syscall
> * parameters in certain format. All of these have parameter
> @@ -2611,6 +2681,22 @@ print_tgkill(const struct syscallname *name,
> }
> #endif
>
> +#ifdef TARGET_NR_statx
> +static void
> +print_statx(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_at_dirfd(arg0, 0);
> + print_string(arg1, 0);
> + print_flags(statx_flags, arg2, 0);
> + print_flags(statx_mask, arg3, 0);
> + print_pointer(arg4, 1);
> + print_syscall_epilogue(name);
> +}
> +#endif
> +
> /*
> * An array of all of the syscalls we know about
> */
> diff --git a/linux-user/strace.list b/linux-user/strace.list
> index db21ce4..63a9466 100644
> --- a/linux-user/strace.list
> +++ b/linux-user/strace.list
> @@ -1650,3 +1650,6 @@
> #ifdef TARGET_NR_atomic_barrier
> { TARGET_NR_atomic_barrier, "atomic_barrier", NULL, NULL, NULL },
> #endif
> +#ifdef TARGET_NR_statx
> +{ TARGET_NR_statx, "statx", NULL, print_statx, NULL },
> +#endif
>
Applied to my linux-user branch.
Thanks,
Laurent
next prev parent reply other threads:[~2019-07-01 8:44 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-28 10:43 [Qemu-devel] [PATCH v16 0/5] linux-user: A set of miscellaneous patches Aleksandar Markovic
2019-06-28 10:43 ` [Qemu-devel] [PATCH v16 1/5] linux-user: Add support for translation of statx() syscall Aleksandar Markovic
2019-06-29 0:53 ` Aleksandar Markovic
2019-06-29 4:06 ` Jim Wilson
2019-06-30 15:44 ` Aleksandar Markovic
2019-07-01 8:40 ` Laurent Vivier
2019-06-28 10:43 ` [Qemu-devel] [PATCH v16 2/5] linux-user: Add support for strace for " Aleksandar Markovic
2019-07-01 8:42 ` Laurent Vivier [this message]
2019-06-28 10:43 ` [Qemu-devel] [PATCH v16 3/5] linux-user: Fix target_flock structure for MIPS O64 ABI Aleksandar Markovic
2019-07-01 8:42 ` Laurent Vivier
2019-06-28 10:43 ` [Qemu-devel] [PATCH v16 4/5] linux-user: Introduce TARGET_HAVE_ARCH_STRUCT_FLOCK Aleksandar Markovic
2019-07-01 8:43 ` Laurent Vivier
2019-06-28 10:43 ` [Qemu-devel] [PATCH v16 5/5] linux-user: Handle EXCP_FPE properly for MIPS Aleksandar Markovic
2019-07-01 8:44 ` Laurent Vivier
2019-07-01 8:46 ` Laurent Vivier
2019-06-28 11:30 ` [Qemu-devel] [PATCH v16 0/5] linux-user: A set of miscellaneous patches no-reply
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=9aaae9ca-39d8-39f8-9cb0-516c62eb1d25@vivier.eu \
--to=laurent@vivier.eu \
--cc=aleksandar.markovic@rt-rk.com \
--cc=amarkovic@wavecomp.com \
--cc=jimw@sifive.com \
--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 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).