* [PATCH v2 0/4] Add strace support for printing arguments for a group of selected syscalls
@ 2020-07-13 9:50 Filip Bozuta
2020-07-13 9:50 ` [PATCH v2 1/4] linux-user: Make cpu_env accessible in strace.c Filip Bozuta
` (4 more replies)
0 siblings, 5 replies; 10+ messages in thread
From: Filip Bozuta @ 2020-07-13 9:50 UTC (permalink / raw)
To: qemu-devel; +Cc: Laurent Vivier, Filip Bozuta
This series covers strace support for following syscalls:
*truncate() *munlock() *clock_gettimeofday()
*ftruncate() *munlockall() *clock_getitimer()
*getsid() *clock_getres() *clock_setitimer()
*mlock() *clock_gettime()
*mlockall() *clock_settime()
Testing method:
Mini test programs were written that run these syscalls for different arguments.
Those programs were compiled (sometimes using cross-compilers) for the following
architectures:
* Intel 64-bit (little endian) (gcc)
* Power pc 32-bit (big endian) (powerpc-linux-gnu-gcc)
* Power pc 64-bit (big endian) (powerpc64-linux-gnu-gcc)
The corresponding native programs were executed with strace, without using
QEMU, on intel (x86_64) host.
All applicable compiled programs were in turn executed with "-strace"
through QEMU and the strace printing results obtained were the same
ones gotten for native execution.
v2:
* added patch that enables 'cpu_env' to be accessible from "strace.c"
* cut and pasted "regpairs_aligned" from 'syscall.c' to 'qemu.h' so
that it can be used for "print_truncate64" and "print_ftruncate64"
* changed flag names from 'TARGET_MLOCKALL_MCL_*' to 'TARGET_MCL_*'
* added target flag value 'TARGET_MCL_ONFAULT' for 'MCL_ONFAULT'
* added 'print_syscall_ret_setitimer' for old value of the interval
timer
* added a function 'print_itimer_type' that prints the interval timer
type
Filip Bozuta (4):
linux-user: Make cpu_env accessible in strace.c
linux-user: Add strace support for printing arguments of
truncate()/ftruncate() and getsid()
linux-user: Add strace support for printing arguments of syscalls used
to lock and unlock memory
linux-user: Add strace support for printing arguments of some clock
and time functions
linux-user/aarch64/target_syscall.h | 5 +-
linux-user/alpha/target_syscall.h | 5 +-
linux-user/arm/target_syscall.h | 6 +-
linux-user/cris/target_syscall.h | 5 +-
linux-user/hppa/target_syscall.h | 5 +-
linux-user/i386/target_syscall.h | 5 +-
linux-user/m68k/target_syscall.h | 6 +-
linux-user/microblaze/target_syscall.h | 5 +-
linux-user/mips/target_syscall.h | 5 +-
linux-user/mips64/target_syscall.h | 5 +-
linux-user/nios2/target_syscall.h | 5 +-
linux-user/openrisc/target_syscall.h | 5 +-
linux-user/ppc/target_syscall.h | 5 +-
linux-user/qemu.h | 39 +-
linux-user/riscv/target_syscall.h | 5 +-
linux-user/s390x/target_syscall.h | 5 +-
linux-user/sh4/target_syscall.h | 5 +-
linux-user/sparc/target_syscall.h | 5 +-
linux-user/sparc64/target_syscall.h | 5 +-
linux-user/strace.c | 755 +++++++++++++++++--------
linux-user/strace.list | 35 +-
linux-user/syscall.c | 47 +-
linux-user/tilegx/target_syscall.h | 5 +-
linux-user/x86_64/target_syscall.h | 5 +-
linux-user/xtensa/target_syscall.h | 5 +-
25 files changed, 648 insertions(+), 335 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 1/4] linux-user: Make cpu_env accessible in strace.c
2020-07-13 9:50 [PATCH v2 0/4] Add strace support for printing arguments for a group of selected syscalls Filip Bozuta
@ 2020-07-13 9:50 ` Filip Bozuta
2020-07-21 14:22 ` Laurent Vivier
2020-07-13 9:50 ` [PATCH v2 2/4] linux-user: Add strace support for printing arguments of truncate()/ftruncate() and getsid() Filip Bozuta
` (3 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Filip Bozuta @ 2020-07-13 9:50 UTC (permalink / raw)
To: qemu-devel; +Cc: Laurent Vivier, Filip Bozuta
Variable "cpu_env" is used in file "syscall.c" to store
the information about the cpu environment. This variable
is used because values of some syscalls can vary between
cpu architectures. This patch makes the "cpu_env" accessible
in "strace.c" so it can enable aproppriate "-strace" argument
printing for these syscalls. This will be a useful addition
for future "-strace" implementation in QEMU.
Implementation notes:
Functions "print_syscall()" and "print_syscall_ret()" which
are stated and defined in "qemu.h" and "strace.c" respectively
are used to print syscall arguments before and after syscall
execution. These functions were changed with addition of a
new argument "void *cpu_env". Strucute "struct syscallname"
in "strace.c" is used to store the information about syscalls.
Fields "call" and "result" represent pointers to functions which
are used to print syscall arguments before and after execution.
These fields were also changed with addition of a new "void *"
argumetn.
Also, all defined "print_*" and "print_syscall_ret*" functions
in "strace.c" were changed to have the new "void *cpu_env".
This was done to not cause build errors (even though none of
these functions use this argument).
Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
---
linux-user/qemu.h | 4 +-
linux-user/strace.c | 479 ++++++++++++++++++++++---------------------
linux-user/syscall.c | 5 +-
3 files changed, 247 insertions(+), 241 deletions(-)
diff --git a/linux-user/qemu.h b/linux-user/qemu.h
index 5c964389c1..63ddfe86fd 100644
--- a/linux-user/qemu.h
+++ b/linux-user/qemu.h
@@ -400,10 +400,10 @@ extern long safe_syscall_base(int *pending, long number, ...);
int host_to_target_waitstatus(int status);
/* strace.c */
-void print_syscall(int num,
+void print_syscall(void *cpu_env, int num,
abi_long arg1, abi_long arg2, abi_long arg3,
abi_long arg4, abi_long arg5, abi_long arg6);
-void print_syscall_ret(int num, abi_long ret,
+void print_syscall_ret(void *cpu_env, int num, abi_long ret,
abi_long arg1, abi_long arg2, abi_long arg3,
abi_long arg4, abi_long arg5, abi_long arg6);
/**
diff --git a/linux-user/strace.c b/linux-user/strace.c
index 5235b2260c..ff3d584ccc 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -16,10 +16,10 @@ struct syscallname {
int nr;
const char *name;
const char *format;
- void (*call)(const struct syscallname *,
+ void (*call)(void *, const struct syscallname *,
abi_long, abi_long, abi_long,
abi_long, abi_long, abi_long);
- void (*result)(const struct syscallname *, abi_long,
+ void (*result)(void *, const struct syscallname *, abi_long,
abi_long, abi_long, abi_long,
abi_long, abi_long, abi_long);
};
@@ -634,7 +634,7 @@ print_clockid(int clockid, int last)
/* select */
#ifdef TARGET_NR__newselect
static void
-print_newselect(const struct syscallname *name,
+print_newselect(void *cpu_env, const struct syscallname *name,
abi_long arg1, abi_long arg2, abi_long arg3,
abi_long arg4, abi_long arg5, abi_long arg6)
{
@@ -652,7 +652,7 @@ print_newselect(const struct syscallname *name,
#ifdef TARGET_NR_semctl
static void
-print_semctl(const struct syscallname *name,
+print_semctl(void *cpu_env, const struct syscallname *name,
abi_long arg1, abi_long arg2, abi_long arg3,
abi_long arg4, abi_long arg5, abi_long arg6)
{
@@ -664,7 +664,7 @@ print_semctl(const struct syscallname *name,
#endif
static void
-print_execve(const struct syscallname *name,
+print_execve(void *cpu_env, const struct syscallname *name,
abi_long arg1, abi_long arg2, abi_long arg3,
abi_long arg4, abi_long arg5, abi_long arg6)
{
@@ -697,7 +697,7 @@ print_execve(const struct syscallname *name,
#ifdef TARGET_NR_ipc
static void
-print_ipc(const struct syscallname *name,
+print_ipc(void *cpu_env, const struct syscallname *name,
abi_long arg1, abi_long arg2, abi_long arg3,
abi_long arg4, abi_long arg5, abi_long arg6)
{
@@ -740,9 +740,10 @@ print_syscall_err(abi_long ret)
}
static void
-print_syscall_ret_addr(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)
+print_syscall_ret_addr(void *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)
{
print_syscall_err(ret);
@@ -761,9 +762,10 @@ print_syscall_ret_raw(struct syscallname *name, abi_long ret)
#ifdef TARGET_NR__newselect
static void
-print_syscall_ret_newselect(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)
+print_syscall_ret_newselect(void *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)
{
print_syscall_err(ret);
@@ -792,9 +794,10 @@ print_syscall_ret_newselect(const struct syscallname *name, abi_long ret,
#define TARGET_TIME_ERROR 5 /* clock not synchronized */
#ifdef TARGET_NR_adjtimex
static void
-print_syscall_ret_adjtimex(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)
+print_syscall_ret_adjtimex(void *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)
{
print_syscall_err(ret);
@@ -829,9 +832,10 @@ print_syscall_ret_adjtimex(const struct syscallname *name, abi_long ret,
#if defined(TARGET_NR_listxattr) || defined(TARGET_NR_llistxattr) \
|| defined(TARGGET_NR_flistxattr)
static void
-print_syscall_ret_listxattr(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)
+print_syscall_ret_listxattr(void *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)
{
print_syscall_err(ret);
@@ -862,9 +866,10 @@ print_syscall_ret_listxattr(const struct syscallname *name, abi_long ret,
#ifdef TARGET_NR_ioctl
static void
-print_syscall_ret_ioctl(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)
+print_syscall_ret_ioctl(void *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)
{
print_syscall_err(ret);
@@ -1424,9 +1429,9 @@ print_timezone(abi_ulong tz_addr, int last)
#ifdef TARGET_NR_accept
static void
-print_accept(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_accept(void *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_raw_param("%d", arg0, 0);
@@ -1438,9 +1443,9 @@ print_accept(const struct syscallname *name,
#ifdef TARGET_NR_access
static void
-print_access(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_access(void *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_string(arg0, 0);
@@ -1451,9 +1456,9 @@ print_access(const struct syscallname *name,
#ifdef TARGET_NR_acct
static void
-print_acct(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_acct(void *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_string(arg0, 1);
@@ -1463,9 +1468,9 @@ print_acct(const struct syscallname *name,
#ifdef TARGET_NR_brk
static void
-print_brk(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_brk(void *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_pointer(arg0, 1);
@@ -1475,9 +1480,9 @@ print_brk(const struct syscallname *name,
#ifdef TARGET_NR_chdir
static void
-print_chdir(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_chdir(void *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_string(arg0, 1);
@@ -1487,9 +1492,9 @@ print_chdir(const struct syscallname *name,
#ifdef TARGET_NR_chroot
static void
-print_chroot(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_chroot(void *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_string(arg0, 1);
@@ -1499,9 +1504,9 @@ print_chroot(const struct syscallname *name,
#ifdef TARGET_NR_chmod
static void
-print_chmod(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_chmod(void *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_string(arg0, 0);
@@ -1512,9 +1517,9 @@ print_chmod(const struct syscallname *name,
#if defined(TARGET_NR_chown) || defined(TARGET_NR_lchown)
static void
-print_chown(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_chown(void *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_string(arg0, 0);
@@ -1527,9 +1532,9 @@ print_chown(const struct syscallname *name,
#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_clock_adjtime(void *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_clockid(arg0, 0);
@@ -1551,9 +1556,9 @@ static void do_print_clone(unsigned int flags, abi_ulong newsp,
}
static void
-print_clone(const struct syscallname *name,
- abi_long arg1, abi_long arg2, abi_long arg3,
- abi_long arg4, abi_long arg5, abi_long arg6)
+print_clone(void *cpu_env, const struct syscallname *name,
+ abi_long arg1, abi_long arg2, abi_long arg3,
+ abi_long arg4, abi_long arg5, abi_long arg6)
{
print_syscall_prologue(name);
#if defined(TARGET_MICROBLAZE)
@@ -1571,9 +1576,9 @@ print_clone(const struct syscallname *name,
#ifdef TARGET_NR_creat
static void
-print_creat(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_creat(void *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_string(arg0, 0);
@@ -1584,9 +1589,9 @@ print_creat(const struct syscallname *name,
#ifdef TARGET_NR_execv
static void
-print_execv(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_execv(void *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_string(arg0, 0);
@@ -1597,9 +1602,9 @@ print_execv(const struct syscallname *name,
#ifdef TARGET_NR_faccessat
static void
-print_faccessat(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_faccessat(void *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_at_dirfd(arg0, 0);
@@ -1612,9 +1617,9 @@ print_faccessat(const struct syscallname *name,
#ifdef TARGET_NR_fallocate
static void
-print_fallocate(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_fallocate(void *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_raw_param("%d", arg0, 0);
@@ -1632,9 +1637,9 @@ print_fallocate(const struct syscallname *name,
#ifdef TARGET_NR_fchmodat
static void
-print_fchmodat(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_fchmodat(void *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_at_dirfd(arg0, 0);
@@ -1647,9 +1652,9 @@ print_fchmodat(const struct syscallname *name,
#ifdef TARGET_NR_fchownat
static void
-print_fchownat(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_fchownat(void *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_at_dirfd(arg0, 0);
@@ -1663,9 +1668,9 @@ print_fchownat(const struct syscallname *name,
#if defined(TARGET_NR_fcntl) || defined(TARGET_NR_fcntl64)
static void
-print_fcntl(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_fcntl(void *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_raw_param("%d", arg0, 0);
@@ -1762,9 +1767,9 @@ print_fcntl(const struct syscallname *name,
#ifdef TARGET_NR_fgetxattr
static void
-print_fgetxattr(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_fgetxattr(void *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_raw_param("%d", arg0, 0);
@@ -1777,9 +1782,9 @@ print_fgetxattr(const struct syscallname *name,
#ifdef TARGET_NR_flistxattr
static void
-print_flistxattr(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_flistxattr(void *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_raw_param("%d", arg0, 0);
@@ -1791,9 +1796,9 @@ print_flistxattr(const struct syscallname *name,
#if defined(TARGET_NR_getxattr) || defined(TARGET_NR_lgetxattr)
static void
-print_getxattr(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_getxattr(void *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_string(arg0, 0);
@@ -1807,9 +1812,9 @@ print_getxattr(const struct syscallname *name,
#if defined(TARGET_NR_listxattr) || defined(TARGET_NR_llistxattr)
static void
-print_listxattr(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_listxattr(void *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_string(arg0, 0);
@@ -1822,9 +1827,9 @@ print_listxattr(const struct syscallname *name,
#if defined(TARGET_NR_fremovexattr)
static void
-print_fremovexattr(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_fremovexattr(void *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_raw_param("%d", arg0, 0);
@@ -1835,9 +1840,9 @@ print_fremovexattr(const struct syscallname *name,
#if defined(TARGET_NR_removexattr) || defined(TARGET_NR_lremovexattr)
static void
-print_removexattr(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_removexattr(void *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_string(arg0, 0);
@@ -1849,9 +1854,9 @@ print_removexattr(const struct syscallname *name,
#ifdef TARGET_NR_futimesat
static void
-print_futimesat(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_futimesat(void *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_at_dirfd(arg0, 0);
@@ -1864,9 +1869,9 @@ print_futimesat(const struct syscallname *name,
#ifdef TARGET_NR_settimeofday
static void
-print_settimeofday(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_settimeofday(void *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_timeval(arg0, 0);
@@ -1877,9 +1882,9 @@ print_settimeofday(const struct syscallname *name,
#ifdef TARGET_NR_link
static void
-print_link(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_link(void *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_string(arg0, 0);
@@ -1890,9 +1895,9 @@ print_link(const struct syscallname *name,
#ifdef TARGET_NR_linkat
static void
-print_linkat(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_linkat(void *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_at_dirfd(arg0, 0);
@@ -1906,9 +1911,9 @@ print_linkat(const struct syscallname *name,
#ifdef TARGET_NR__llseek
static void
-print__llseek(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print__llseek(void *cpu_env, const struct syscallname *name,
+ abi_long arg0, abi_long arg1, abi_long arg2,
+ abi_long arg3, abi_long arg4, abi_long arg5)
{
const char *whence = "UNKNOWN";
print_syscall_prologue(name);
@@ -1928,9 +1933,9 @@ print__llseek(const struct syscallname *name,
#ifdef TARGET_NR_lseek
static void
-print_lseek(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_lseek(void *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_raw_param("%d", arg0, 0);
@@ -1959,7 +1964,7 @@ print_lseek(const struct syscallname *name,
#if defined(TARGET_NR_socket)
static void
-print_socket(const struct syscallname *name,
+print_socket(void *cpu_env, const struct syscallname *name,
abi_long arg0, abi_long arg1, abi_long arg2,
abi_long arg3, abi_long arg4, abi_long arg5)
{
@@ -2308,7 +2313,7 @@ static struct {
};
static void
-print_socketcall(const struct syscallname *name,
+print_socketcall(void *cpu_env, const struct syscallname *name,
abi_long arg0, abi_long arg1, abi_long arg2,
abi_long arg3, abi_long arg4, abi_long arg5)
{
@@ -2329,7 +2334,7 @@ print_socketcall(const struct syscallname *name,
#if defined(TARGET_NR_bind)
static void
-print_bind(const struct syscallname *name,
+print_bind(void *cpu_env, const struct syscallname *name,
abi_long arg0, abi_long arg1, abi_long arg2,
abi_long arg3, abi_long arg4, abi_long arg5)
{
@@ -2343,9 +2348,9 @@ print_bind(const struct syscallname *name,
#if defined(TARGET_NR_stat) || defined(TARGET_NR_stat64) || \
defined(TARGET_NR_lstat) || defined(TARGET_NR_lstat64)
static void
-print_stat(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_stat(void *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_string(arg0, 0);
@@ -2359,9 +2364,9 @@ print_stat(const struct syscallname *name,
#if defined(TARGET_NR_fstat) || defined(TARGET_NR_fstat64)
static void
-print_fstat(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_fstat(void *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_raw_param("%d", arg0, 0);
@@ -2373,9 +2378,9 @@ print_fstat(const struct syscallname *name,
#ifdef TARGET_NR_mkdir
static void
-print_mkdir(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_mkdir(void *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_string(arg0, 0);
@@ -2386,9 +2391,9 @@ print_mkdir(const struct syscallname *name,
#ifdef TARGET_NR_mkdirat
static void
-print_mkdirat(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_mkdirat(void *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_at_dirfd(arg0, 0);
@@ -2400,9 +2405,9 @@ print_mkdirat(const struct syscallname *name,
#ifdef TARGET_NR_rmdir
static void
-print_rmdir(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_rmdir(void *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_string(arg0, 0);
@@ -2412,9 +2417,9 @@ print_rmdir(const struct syscallname *name,
#ifdef TARGET_NR_rt_sigaction
static void
-print_rt_sigaction(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_rt_sigaction(void *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_signal(arg0, 0);
@@ -2426,9 +2431,9 @@ print_rt_sigaction(const struct syscallname *name,
#ifdef TARGET_NR_rt_sigprocmask
static void
-print_rt_sigprocmask(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_rt_sigprocmask(void *cpu_env, const struct syscallname *name,
+ abi_long arg0, abi_long arg1, abi_long arg2,
+ abi_long arg3, abi_long arg4, abi_long arg5)
{
const char *how = "UNKNOWN";
print_syscall_prologue(name);
@@ -2446,9 +2451,9 @@ print_rt_sigprocmask(const struct syscallname *name,
#ifdef TARGET_NR_rt_sigqueueinfo
static void
-print_rt_sigqueueinfo(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_rt_sigqueueinfo(void *cpu_env, const struct syscallname *name,
+ abi_long arg0, abi_long arg1, abi_long arg2,
+ abi_long arg3, abi_long arg4, abi_long arg5)
{
void *p;
target_siginfo_t uinfo;
@@ -2471,9 +2476,9 @@ print_rt_sigqueueinfo(const struct syscallname *name,
#ifdef TARGET_NR_rt_tgsigqueueinfo
static void
-print_rt_tgsigqueueinfo(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_rt_tgsigqueueinfo(void *cpu_env, const struct syscallname *name,
+ abi_long arg0, abi_long arg1, abi_long arg2,
+ abi_long arg3, abi_long arg4, abi_long arg5)
{
void *p;
target_siginfo_t uinfo;
@@ -2555,9 +2560,9 @@ print_syslog_action(abi_ulong arg, int last)
}
static void
-print_syslog(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_syslog(void *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_syslog_action(arg0, 0);
@@ -2569,9 +2574,9 @@ print_syslog(const struct syscallname *name,
#ifdef TARGET_NR_mknod
static void
-print_mknod(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_mknod(void *cpu_env, const struct syscallname *name,
+ abi_long arg0, abi_long arg1, abi_long arg2,
+ abi_long arg3, abi_long arg4, abi_long arg5)
{
int hasdev = (arg1 & (S_IFCHR|S_IFBLK));
@@ -2588,9 +2593,9 @@ print_mknod(const struct syscallname *name,
#ifdef TARGET_NR_mknodat
static void
-print_mknodat(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_mknodat(void *cpu_env, const struct syscallname *name,
+ abi_long arg0, abi_long arg1, abi_long arg2,
+ abi_long arg3, abi_long arg4, abi_long arg5)
{
int hasdev = (arg2 & (S_IFCHR|S_IFBLK));
@@ -2608,9 +2613,9 @@ print_mknodat(const struct syscallname *name,
#ifdef TARGET_NR_mq_open
static void
-print_mq_open(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_mq_open(void *cpu_env, const struct syscallname *name,
+ abi_long arg0, abi_long arg1, abi_long arg2,
+ abi_long arg3, abi_long arg4, abi_long arg5)
{
int is_creat = (arg1 & TARGET_O_CREAT);
@@ -2627,9 +2632,9 @@ print_mq_open(const struct syscallname *name,
#ifdef TARGET_NR_open
static void
-print_open(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_open(void *cpu_env, const struct syscallname *name,
+ abi_long arg0, abi_long arg1, abi_long arg2,
+ abi_long arg3, abi_long arg4, abi_long arg5)
{
int is_creat = (arg1 & TARGET_O_CREAT);
@@ -2644,9 +2649,9 @@ print_open(const struct syscallname *name,
#ifdef TARGET_NR_openat
static void
-print_openat(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_openat(void *cpu_env, const struct syscallname *name,
+ abi_long arg0, abi_long arg1, abi_long arg2,
+ abi_long arg3, abi_long arg4, abi_long arg5)
{
int is_creat = (arg2 & TARGET_O_CREAT);
@@ -2662,9 +2667,9 @@ print_openat(const struct syscallname *name,
#ifdef TARGET_NR_mq_unlink
static void
-print_mq_unlink(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_mq_unlink(void *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_string(arg0, 1);
@@ -2674,9 +2679,9 @@ print_mq_unlink(const struct syscallname *name,
#if defined(TARGET_NR_fstatat64) || defined(TARGET_NR_newfstatat)
static void
-print_fstatat64(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_fstatat64(void *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_at_dirfd(arg0, 0);
@@ -2690,9 +2695,9 @@ print_fstatat64(const struct syscallname *name,
#ifdef TARGET_NR_readlink
static void
-print_readlink(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_readlink(void *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_string(arg0, 0);
@@ -2704,9 +2709,9 @@ print_readlink(const struct syscallname *name,
#ifdef TARGET_NR_readlinkat
static void
-print_readlinkat(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_readlinkat(void *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_at_dirfd(arg0, 0);
@@ -2719,9 +2724,9 @@ print_readlinkat(const struct syscallname *name,
#ifdef TARGET_NR_rename
static void
-print_rename(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_rename(void *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_string(arg0, 0);
@@ -2732,9 +2737,9 @@ print_rename(const struct syscallname *name,
#ifdef TARGET_NR_renameat
static void
-print_renameat(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_renameat(void *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_at_dirfd(arg0, 0);
@@ -2747,9 +2752,9 @@ print_renameat(const struct syscallname *name,
#ifdef TARGET_NR_statfs
static void
-print_statfs(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_statfs(void *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_string(arg0, 0);
@@ -2760,9 +2765,9 @@ print_statfs(const struct syscallname *name,
#ifdef TARGET_NR_statfs64
static void
-print_statfs64(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_statfs64(void *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_string(arg0, 0);
@@ -2773,9 +2778,9 @@ print_statfs64(const struct syscallname *name,
#ifdef TARGET_NR_symlink
static void
-print_symlink(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_symlink(void *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_string(arg0, 0);
@@ -2786,9 +2791,9 @@ print_symlink(const struct syscallname *name,
#ifdef TARGET_NR_symlinkat
static void
-print_symlinkat(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_symlinkat(void *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_string(arg0, 0);
@@ -2800,9 +2805,9 @@ print_symlinkat(const struct syscallname *name,
#ifdef TARGET_NR_mount
static void
-print_mount(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_mount(void *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_string(arg0, 0);
@@ -2816,9 +2821,9 @@ print_mount(const struct syscallname *name,
#ifdef TARGET_NR_umount
static void
-print_umount(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_umount(void *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_string(arg0, 1);
@@ -2828,9 +2833,9 @@ print_umount(const struct syscallname *name,
#ifdef TARGET_NR_umount2
static void
-print_umount2(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_umount2(void *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_string(arg0, 0);
@@ -2841,9 +2846,9 @@ print_umount2(const struct syscallname *name,
#ifdef TARGET_NR_unlink
static void
-print_unlink(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_unlink(void *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_string(arg0, 1);
@@ -2853,9 +2858,9 @@ print_unlink(const struct syscallname *name,
#ifdef TARGET_NR_unlinkat
static void
-print_unlinkat(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_unlinkat(void *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_at_dirfd(arg0, 0);
@@ -2867,9 +2872,9 @@ print_unlinkat(const struct syscallname *name,
#ifdef TARGET_NR_utime
static void
-print_utime(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_utime(void *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_string(arg0, 0);
@@ -2880,9 +2885,9 @@ print_utime(const struct syscallname *name,
#ifdef TARGET_NR_utimes
static void
-print_utimes(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_utimes(void *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_string(arg0, 0);
@@ -2893,9 +2898,9 @@ print_utimes(const struct syscallname *name,
#ifdef TARGET_NR_utimensat
static void
-print_utimensat(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_utimensat(void *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_at_dirfd(arg0, 0);
@@ -2908,9 +2913,9 @@ print_utimensat(const struct syscallname *name,
#if defined(TARGET_NR_mmap) || defined(TARGET_NR_mmap2)
static void
-print_mmap(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_mmap(void *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_pointer(arg0, 0);
@@ -2926,9 +2931,9 @@ print_mmap(const struct syscallname *name,
#ifdef TARGET_NR_mprotect
static void
-print_mprotect(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_mprotect(void *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_pointer(arg0, 0);
@@ -2940,9 +2945,9 @@ print_mprotect(const struct syscallname *name,
#ifdef TARGET_NR_munmap
static void
-print_munmap(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_munmap(void *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_pointer(arg0, 0);
@@ -2993,9 +2998,9 @@ if( cmd == val ) { \
}
static void
-print_futex(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_futex(void *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_pointer(arg0, 0);
@@ -3010,9 +3015,9 @@ print_futex(const struct syscallname *name,
#ifdef TARGET_NR_kill
static void
-print_kill(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_kill(void *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_raw_param("%d", arg0, 0);
@@ -3023,9 +3028,9 @@ print_kill(const struct syscallname *name,
#ifdef TARGET_NR_tkill
static void
-print_tkill(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_tkill(void *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_raw_param("%d", arg0, 0);
@@ -3036,9 +3041,9 @@ print_tkill(const struct syscallname *name,
#ifdef TARGET_NR_tgkill
static void
-print_tgkill(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
+print_tgkill(void *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_raw_param("%d", arg0, 0);
@@ -3050,7 +3055,7 @@ print_tgkill(const struct syscallname *name,
#ifdef TARGET_NR_statx
static void
-print_statx(const struct syscallname *name,
+print_statx(void *cpu_env, const struct syscallname *name,
abi_long arg0, abi_long arg1, abi_long arg2,
abi_long arg3, abi_long arg4, abi_long arg5)
{
@@ -3066,7 +3071,7 @@ print_statx(const struct syscallname *name,
#ifdef TARGET_NR_ioctl
static void
-print_ioctl(const struct syscallname *name,
+print_ioctl(void *cpu_env, const struct syscallname *name,
abi_long arg0, abi_long arg1, abi_long arg2,
abi_long arg3, abi_long arg4, abi_long arg5)
{
@@ -3147,7 +3152,7 @@ static int nsyscalls = ARRAY_SIZE(scnames);
* The public interface to this module.
*/
void
-print_syscall(int num,
+print_syscall(void *cpu_env, int num,
abi_long arg1, abi_long arg2, abi_long arg3,
abi_long arg4, abi_long arg5, abi_long arg6)
{
@@ -3160,7 +3165,7 @@ print_syscall(int num,
if( scnames[i].nr == num ) {
if( scnames[i].call != NULL ) {
scnames[i].call(
- &scnames[i], arg1, arg2, arg3, arg4, arg5, arg6);
+ cpu_env, &scnames[i], arg1, arg2, arg3, arg4, arg5, arg6);
} else {
/* XXX: this format system is broken because it uses
host types and host pointers for strings */
@@ -3176,7 +3181,7 @@ print_syscall(int num,
void
-print_syscall_ret(int num, abi_long ret,
+print_syscall_ret(void *cpu_env, int num, abi_long ret,
abi_long arg1, abi_long arg2, abi_long arg3,
abi_long arg4, abi_long arg5, abi_long arg6)
{
@@ -3185,7 +3190,7 @@ print_syscall_ret(int num, abi_long ret,
for(i=0;i<nsyscalls;i++)
if( scnames[i].nr == num ) {
if( scnames[i].result != NULL ) {
- scnames[i].result(&scnames[i], ret,
+ scnames[i].result(cpu_env, &scnames[i], ret,
arg1, arg2, arg3,
arg4, arg5, arg6);
} else {
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 82afadcea0..703e068b74 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -12524,14 +12524,15 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
arg2, arg3, arg4, arg5, arg6, arg7, arg8);
if (unlikely(qemu_loglevel_mask(LOG_STRACE))) {
- print_syscall(num, arg1, arg2, arg3, arg4, arg5, arg6);
+ print_syscall(cpu_env, num, arg1, arg2, arg3, arg4, arg5, arg6);
}
ret = do_syscall1(cpu_env, num, arg1, arg2, arg3, arg4,
arg5, arg6, arg7, arg8);
if (unlikely(qemu_loglevel_mask(LOG_STRACE))) {
- print_syscall_ret(num, ret, arg1, arg2, arg3, arg4, arg5, arg6);
+ print_syscall_ret(cpu_env, num, ret, arg1, arg2,
+ arg3, arg4, arg5, arg6);
}
record_syscall_return(cpu, num, ret);
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 2/4] linux-user: Add strace support for printing arguments of truncate()/ftruncate() and getsid()
2020-07-13 9:50 [PATCH v2 0/4] Add strace support for printing arguments for a group of selected syscalls Filip Bozuta
2020-07-13 9:50 ` [PATCH v2 1/4] linux-user: Make cpu_env accessible in strace.c Filip Bozuta
@ 2020-07-13 9:50 ` Filip Bozuta
2020-07-21 14:28 ` Laurent Vivier
2020-07-13 9:50 ` [PATCH v2 3/4] linux-user: Add strace support for printing arguments of syscalls used to lock and unlock memory Filip Bozuta
` (2 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Filip Bozuta @ 2020-07-13 9:50 UTC (permalink / raw)
To: qemu-devel; +Cc: Laurent Vivier, Filip Bozuta
This patch implements strace argument printing functionality for following syscalls:
* truncate, ftruncate - truncate a file to a specified length
int truncate/truncate64(const char *path, off_t length)
int ftruncate/ftruncate64(int fd, off_t length)
man page: https://man7.org/linux/man-pages/man2/truncate.2.html
* getsid - get session ID
pid_t getsid(pid_t pid)
man page: https://man7.org/linux/man-pages/man2/getsid.2.html
Implementation notes:
Syscalls truncate/truncate64 take string argument types and thus a
separate print function "print_truncate/print_truncate64" is stated in
file "strace.list". This function is defined and implemented in "strace.c"
by using an existing function used to print string arguments: "print_string()".
For syscall ftruncate64, a separate printing function was also stated in
"strace.c" as it requires a special kind of handling.
The other syscalls have only primitive argument types, so the rest of the
implementation was handled by stating an appropriate printing format in file
"strace.list".
Function "regpairs_aligned()" was cut & pasted from "syscall.c" to "qemu.h"
as it is used by functions "print_truncate64()" and "print_ftruncate64()"
to print the offset arguments of "truncate64()" and "ftruncate64()".
Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
---
linux-user/qemu.h | 35 +++++++++++++++++++++++++++++++
linux-user/strace.c | 47 ++++++++++++++++++++++++++++++++++++++++++
linux-user/strace.list | 10 ++++-----
linux-user/syscall.c | 32 ----------------------------
4 files changed, 87 insertions(+), 37 deletions(-)
diff --git a/linux-user/qemu.h b/linux-user/qemu.h
index 63ddfe86fd..f431805e57 100644
--- a/linux-user/qemu.h
+++ b/linux-user/qemu.h
@@ -706,6 +706,41 @@ static inline uint64_t target_offset64(uint64_t word0, uint64_t word1)
}
#endif /* TARGET_ABI_BITS != 32 */
+
+/* ARM EABI and MIPS expect 64bit types aligned even on pairs or registers */
+#ifdef TARGET_ARM
+static inline int regpairs_aligned(void *cpu_env, int num)
+{
+ return ((((CPUARMState *)cpu_env)->eabi) == 1) ;
+}
+#elif defined(TARGET_MIPS) && (TARGET_ABI_BITS == 32)
+static inline int regpairs_aligned(void *cpu_env, int num) { return 1; }
+#elif defined(TARGET_PPC) && !defined(TARGET_PPC64)
+/*
+ * SysV AVI for PPC32 expects 64bit parameters to be passed on odd/even pairs
+ * of registers which translates to the same as ARM/MIPS, because we start with
+ * r3 as arg1
+ */
+static inline int regpairs_aligned(void *cpu_env, int num) { return 1; }
+#elif defined(TARGET_SH4)
+/* SH4 doesn't align register pairs, except for p{read,write}64 */
+static inline int regpairs_aligned(void *cpu_env, int num)
+{
+ switch (num) {
+ case TARGET_NR_pread64:
+ case TARGET_NR_pwrite64:
+ return 1;
+
+ default:
+ return 0;
+ }
+}
+#elif defined(TARGET_XTENSA)
+static inline int regpairs_aligned(void *cpu_env, int num) { return 1; }
+#else
+static inline int regpairs_aligned(void *cpu_env, int num) { return 0; }
+#endif
+
/**
* preexit_cleanup: housekeeping before the guest exits
*
diff --git a/linux-user/strace.c b/linux-user/strace.c
index ff3d584ccc..ce02f62efc 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -1962,6 +1962,53 @@ print_lseek(void *cpu_env, const struct syscallname *name,
}
#endif
+#ifdef TARGET_NR_truncate
+static void
+print_truncate(void *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_string(arg0, 0);
+ print_raw_param(TARGET_ABI_FMT_ld, arg1, 1);
+ print_syscall_epilogue(name);
+}
+#endif
+
+#ifdef TARGET_NR_truncate64
+static void
+print_truncate64(void *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_string(arg0, 0);
+ if (regpairs_aligned(cpu_env, TARGET_NR_truncate64)) {
+ arg1 = arg2;
+ arg2 = arg3;
+ }
+ print_raw_param("%" PRIu64, target_offset64(arg1, arg2), 1);
+ print_syscall_epilogue(name);
+}
+#endif
+
+#ifdef TARGET_NR_ftruncate64
+static void
+print_ftruncate64(void *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_raw_param("%d", arg0, 0);
+ if (regpairs_aligned(cpu_env, TARGET_NR_ftruncate64)) {
+ arg1 = arg2;
+ arg2 = arg3;
+ }
+ print_raw_param("%" PRIu64, target_offset64(arg1, arg2), 1);
+ print_syscall_epilogue(name);
+}
+#endif
+
#if defined(TARGET_NR_socket)
static void
print_socket(void *cpu_env, const struct syscallname *name,
diff --git a/linux-user/strace.list b/linux-user/strace.list
index a04706a524..8e5303d035 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -258,10 +258,10 @@
{ TARGET_NR_ftime, "ftime" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_ftruncate
-{ TARGET_NR_ftruncate, "ftruncate" , NULL, NULL, NULL },
+{ TARGET_NR_ftruncate, "ftruncate" , "%s(%d," TARGET_ABI_FMT_ld ")", NULL, NULL },
#endif
#ifdef TARGET_NR_ftruncate64
-{ TARGET_NR_ftruncate64, "ftruncate64" , NULL, NULL, NULL },
+{ TARGET_NR_ftruncate64, "ftruncate64" , NULL, print_ftruncate64, NULL },
#endif
#ifdef TARGET_NR_futex
{ TARGET_NR_futex, "futex" , NULL, print_futex, NULL },
@@ -372,7 +372,7 @@
{ TARGET_NR_getrusage, "getrusage" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_getsid
-{ TARGET_NR_getsid, "getsid" , NULL, NULL, NULL },
+{ TARGET_NR_getsid, "getsid" , "%s(%d)", NULL, NULL },
#endif
#ifdef TARGET_NR_getsockname
{ TARGET_NR_getsockname, "getsockname" , NULL, NULL, NULL },
@@ -1535,10 +1535,10 @@
{ TARGET_NR_tkill, "tkill" , NULL, print_tkill, NULL },
#endif
#ifdef TARGET_NR_truncate
-{ TARGET_NR_truncate, "truncate" , NULL, NULL, NULL },
+{ TARGET_NR_truncate, "truncate" , NULL, print_truncate, NULL },
#endif
#ifdef TARGET_NR_truncate64
-{ TARGET_NR_truncate64, "truncate64" , NULL, NULL, NULL },
+{ TARGET_NR_truncate64, "truncate64" , NULL, print_truncate64, NULL },
#endif
#ifdef TARGET_NR_tuxcall
{ TARGET_NR_tuxcall, "tuxcall" , NULL, NULL, NULL },
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 703e068b74..b9e86eddef 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -501,38 +501,6 @@ static inline int next_free_host_timer(void)
}
#endif
-/* ARM EABI and MIPS expect 64bit types aligned even on pairs or registers */
-#ifdef TARGET_ARM
-static inline int regpairs_aligned(void *cpu_env, int num)
-{
- return ((((CPUARMState *)cpu_env)->eabi) == 1) ;
-}
-#elif defined(TARGET_MIPS) && (TARGET_ABI_BITS == 32)
-static inline int regpairs_aligned(void *cpu_env, int num) { return 1; }
-#elif defined(TARGET_PPC) && !defined(TARGET_PPC64)
-/* SysV AVI for PPC32 expects 64bit parameters to be passed on odd/even pairs
- * of registers which translates to the same as ARM/MIPS, because we start with
- * r3 as arg1 */
-static inline int regpairs_aligned(void *cpu_env, int num) { return 1; }
-#elif defined(TARGET_SH4)
-/* SH4 doesn't align register pairs, except for p{read,write}64 */
-static inline int regpairs_aligned(void *cpu_env, int num)
-{
- switch (num) {
- case TARGET_NR_pread64:
- case TARGET_NR_pwrite64:
- return 1;
-
- default:
- return 0;
- }
-}
-#elif defined(TARGET_XTENSA)
-static inline int regpairs_aligned(void *cpu_env, int num) { return 1; }
-#else
-static inline int regpairs_aligned(void *cpu_env, int num) { return 0; }
-#endif
-
#define ERRNO_TABLE_SIZE 1200
/* target_to_host_errno_table[] is initialized from
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 3/4] linux-user: Add strace support for printing arguments of syscalls used to lock and unlock memory
2020-07-13 9:50 [PATCH v2 0/4] Add strace support for printing arguments for a group of selected syscalls Filip Bozuta
2020-07-13 9:50 ` [PATCH v2 1/4] linux-user: Make cpu_env accessible in strace.c Filip Bozuta
2020-07-13 9:50 ` [PATCH v2 2/4] linux-user: Add strace support for printing arguments of truncate()/ftruncate() and getsid() Filip Bozuta
@ 2020-07-13 9:50 ` Filip Bozuta
2020-07-21 14:33 ` Laurent Vivier
2020-07-13 9:50 ` [PATCH v2 4/4] linux-user: Add strace support for printing arguments of some clock and time functions Filip Bozuta
2020-07-13 10:42 ` [PATCH v2 0/4] Add strace support for printing arguments for a group of selected syscalls no-reply
4 siblings, 1 reply; 10+ messages in thread
From: Filip Bozuta @ 2020-07-13 9:50 UTC (permalink / raw)
To: qemu-devel; +Cc: Laurent Vivier, Filip Bozuta
This patch implements strace argument printing functionality for following syscalls:
* mlock, munlock, mlockall, munlockall - lock and unlock memory
int mlock(const void *addr, size_t len)
int munlock(const void *addr, size_t len)
int mlockall(int flags)
int munlockall(void)
man page: https://man7.org/linux/man-pages/man2/mlock.2.html
Implementation notes:
Syscall mlockall() takes an argument that is composed of predefined values
which represent flags that determine the type of locking operation that is
to be performed. For that reason, a printing function "print_mlockall" was
stated in file "strace.list". This printing function uses an already existing
function "print_flags()" to print the "flags" argument. These flags are stated
inside an array "mlockall_flags" that contains values of type "struct flags".
These values are instantiated using an existing macro "FLAG_TARGET()" that
crates aproppriate target flag values based on those defined in files
'/target_syscall.h'. These target flag values were changed from
"TARGET_MLOCKALL_MCL*" to "TARGET_MCL_*" so that they can be aproppriately set
and recognised in "strace.c" with "FLAG_TARGET()". Value for "MCL_ONFAULT"
was added in this patch. This value was also added in "syscall.c" in function
"target_to_host_mlockall_arg()". Because this flag value was added in kernel
version 4.4, it is enwrapped in an #ifdef directive (both in "syscall.c" and
in "strace.c") as to support older kernel versions.
The other syscalls have only primitive argument types, so the
rest of the implementation was handled by stating an appropriate
printing format in file "strace.list". Syscall mlock2() is not implemented in
"syscall.c" and thus it's argument printing is not implemented in this patch.
Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
---
linux-user/aarch64/target_syscall.h | 5 +++--
linux-user/alpha/target_syscall.h | 5 +++--
linux-user/arm/target_syscall.h | 6 ++++--
linux-user/cris/target_syscall.h | 5 +++--
linux-user/hppa/target_syscall.h | 5 +++--
linux-user/i386/target_syscall.h | 5 +++--
linux-user/m68k/target_syscall.h | 6 +++---
linux-user/microblaze/target_syscall.h | 5 +++--
linux-user/mips/target_syscall.h | 5 +++--
linux-user/mips64/target_syscall.h | 5 +++--
linux-user/nios2/target_syscall.h | 5 +++--
linux-user/openrisc/target_syscall.h | 5 +++--
linux-user/ppc/target_syscall.h | 5 +++--
linux-user/riscv/target_syscall.h | 5 +++--
linux-user/s390x/target_syscall.h | 5 +++--
linux-user/sh4/target_syscall.h | 5 +++--
linux-user/sparc/target_syscall.h | 5 +++--
linux-user/sparc64/target_syscall.h | 5 +++--
linux-user/strace.c | 21 +++++++++++++++++++++
linux-user/strace.list | 8 ++++----
linux-user/syscall.c | 10 ++++++++--
linux-user/tilegx/target_syscall.h | 5 +++--
linux-user/x86_64/target_syscall.h | 5 +++--
linux-user/xtensa/target_syscall.h | 5 +++--
24 files changed, 97 insertions(+), 49 deletions(-)
diff --git a/linux-user/aarch64/target_syscall.h b/linux-user/aarch64/target_syscall.h
index 995e475c73..3194e6b009 100644
--- a/linux-user/aarch64/target_syscall.h
+++ b/linux-user/aarch64/target_syscall.h
@@ -16,8 +16,9 @@ struct target_pt_regs {
#define UNAME_MINIMUM_RELEASE "3.8.0"
#define TARGET_CLONE_BACKWARDS
#define TARGET_MINSIGSTKSZ 2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE 2
+#define TARGET_MCL_CURRENT 1
+#define TARGET_MCL_FUTURE 2
+#define TARGET_MCL_ONFAULT 4
#define TARGET_PR_SVE_SET_VL 50
#define TARGET_PR_SVE_GET_VL 51
diff --git a/linux-user/alpha/target_syscall.h b/linux-user/alpha/target_syscall.h
index 3426cc5b4e..fd389422e3 100644
--- a/linux-user/alpha/target_syscall.h
+++ b/linux-user/alpha/target_syscall.h
@@ -258,7 +258,8 @@ struct target_pt_regs {
#define TARGET_UAC_NOFIX 2
#define TARGET_UAC_SIGBUS 4
#define TARGET_MINSIGSTKSZ 4096
-#define TARGET_MLOCKALL_MCL_CURRENT 0x2000
-#define TARGET_MLOCKALL_MCL_FUTURE 0x4000
+#define TARGET_MCL_CURRENT 0x2000
+#define TARGET_MCL_FUTURE 0x4000
+#define TARGET_MCL_ONFAULT 0x8000
#endif /* ALPHA_TARGET_SYSCALL_H */
diff --git a/linux-user/arm/target_syscall.h b/linux-user/arm/target_syscall.h
index f85cbdaf56..e870ed7a54 100644
--- a/linux-user/arm/target_syscall.h
+++ b/linux-user/arm/target_syscall.h
@@ -28,8 +28,10 @@ struct target_pt_regs {
#define TARGET_CLONE_BACKWARDS
#define TARGET_MINSIGSTKSZ 2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE 2
+#define TARGET_MCL_CURRENT 1
+#define TARGET_MCL_FUTURE 2
+#define TARGET_MCL_ONFAULT 4
+
#define TARGET_WANT_OLD_SYS_SELECT
#define TARGET_FORCE_SHMLBA
diff --git a/linux-user/cris/target_syscall.h b/linux-user/cris/target_syscall.h
index 29d69009ff..d109a6b42a 100644
--- a/linux-user/cris/target_syscall.h
+++ b/linux-user/cris/target_syscall.h
@@ -40,7 +40,8 @@ struct target_pt_regs {
#define TARGET_CLONE_BACKWARDS2
#define TARGET_MINSIGSTKSZ 2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE 2
+#define TARGET_MCL_CURRENT 1
+#define TARGET_MCL_FUTURE 2
+#define TARGET_MCL_ONFAULT 4
#endif
diff --git a/linux-user/hppa/target_syscall.h b/linux-user/hppa/target_syscall.h
index e2f366839d..f34e05edb5 100644
--- a/linux-user/hppa/target_syscall.h
+++ b/linux-user/hppa/target_syscall.h
@@ -23,8 +23,9 @@ struct target_pt_regs {
#define UNAME_MINIMUM_RELEASE "2.6.32"
#define TARGET_CLONE_BACKWARDS
#define TARGET_MINSIGSTKSZ 2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE 2
+#define TARGET_MCL_CURRENT 1
+#define TARGET_MCL_FUTURE 2
+#define TARGET_MCL_ONFAULT 4
#undef TARGET_ENOMSG
#define TARGET_ENOMSG 35
diff --git a/linux-user/i386/target_syscall.h b/linux-user/i386/target_syscall.h
index 2854758134..ed356b3908 100644
--- a/linux-user/i386/target_syscall.h
+++ b/linux-user/i386/target_syscall.h
@@ -151,8 +151,9 @@ struct target_vm86plus_struct {
#define TARGET_CLONE_BACKWARDS
#define TARGET_MINSIGSTKSZ 2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE 2
+#define TARGET_MCL_CURRENT 1
+#define TARGET_MCL_FUTURE 2
+#define TARGET_MCL_ONFAULT 4
#define TARGET_WANT_OLD_SYS_SELECT
#endif /* I386_TARGET_SYSCALL_H */
diff --git a/linux-user/m68k/target_syscall.h b/linux-user/m68k/target_syscall.h
index c0366b1c62..23359a6299 100644
--- a/linux-user/m68k/target_syscall.h
+++ b/linux-user/m68k/target_syscall.h
@@ -21,9 +21,9 @@ struct target_pt_regs {
#define UNAME_MINIMUM_RELEASE "2.6.32"
#define TARGET_MINSIGSTKSZ 2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE 2
-
+#define TARGET_MCL_CURRENT 1
+#define TARGET_MCL_FUTURE 2
+#define TARGET_MCL_ONFAULT 4
#define TARGET_WANT_OLD_SYS_SELECT
#endif /* M68K_TARGET_SYSCALL_H */
diff --git a/linux-user/microblaze/target_syscall.h b/linux-user/microblaze/target_syscall.h
index 4141cbaa5e..7f653db34f 100644
--- a/linux-user/microblaze/target_syscall.h
+++ b/linux-user/microblaze/target_syscall.h
@@ -50,8 +50,9 @@ struct target_pt_regs {
#define TARGET_CLONE_BACKWARDS
#define TARGET_MINSIGSTKSZ 2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE 2
+#define TARGET_MCL_CURRENT 1
+#define TARGET_MCL_FUTURE 2
+#define TARGET_MCL_ONFAULT 4
#define TARGET_WANT_NI_OLD_SELECT
diff --git a/linux-user/mips/target_syscall.h b/linux-user/mips/target_syscall.h
index d5509a34a7..dd6fd7af8e 100644
--- a/linux-user/mips/target_syscall.h
+++ b/linux-user/mips/target_syscall.h
@@ -234,8 +234,9 @@ struct target_pt_regs {
#define TARGET_CLONE_BACKWARDS
#define TARGET_MINSIGSTKSZ 2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE 2
+#define TARGET_MCL_CURRENT 1
+#define TARGET_MCL_FUTURE 2
+#define TARGET_MCL_ONFAULT 4
#define TARGET_FORCE_SHMLBA
diff --git a/linux-user/mips64/target_syscall.h b/linux-user/mips64/target_syscall.h
index 8ccc46822c..8594955eec 100644
--- a/linux-user/mips64/target_syscall.h
+++ b/linux-user/mips64/target_syscall.h
@@ -231,8 +231,9 @@ struct target_pt_regs {
#define TARGET_CLONE_BACKWARDS
#define TARGET_MINSIGSTKSZ 2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE 2
+#define TARGET_MCL_CURRENT 1
+#define TARGET_MCL_FUTURE 2
+#define TARGET_MCL_ONFAULT 4
#define TARGET_FORCE_SHMLBA
diff --git a/linux-user/nios2/target_syscall.h b/linux-user/nios2/target_syscall.h
index f3b2a500f4..78006c24d4 100644
--- a/linux-user/nios2/target_syscall.h
+++ b/linux-user/nios2/target_syscall.h
@@ -31,7 +31,8 @@ struct target_pt_regs {
};
#define TARGET_MINSIGSTKSZ 2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE 2
+#define TARGET_MCL_CURRENT 1
+#define TARGET_MCL_FUTURE 2
+#define TARGET_MCL_ONFAULT 4
#endif /* NIOS2_TARGET_SYSCALL_H */
diff --git a/linux-user/openrisc/target_syscall.h b/linux-user/openrisc/target_syscall.h
index d586d2a018..ef0d89a551 100644
--- a/linux-user/openrisc/target_syscall.h
+++ b/linux-user/openrisc/target_syscall.h
@@ -16,8 +16,9 @@ struct target_pt_regs {
#define UNAME_MINIMUM_RELEASE "2.6.32"
#define TARGET_MINSIGSTKSZ 2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE 2
+#define TARGET_MCL_CURRENT 1
+#define TARGET_MCL_FUTURE 2
+#define TARGET_MCL_ONFAULT 4
#define MMAP_SHIFT TARGET_PAGE_BITS
diff --git a/linux-user/ppc/target_syscall.h b/linux-user/ppc/target_syscall.h
index afc0570410..c461f878f2 100644
--- a/linux-user/ppc/target_syscall.h
+++ b/linux-user/ppc/target_syscall.h
@@ -72,8 +72,9 @@ struct target_revectored_struct {
#define TARGET_CLONE_BACKWARDS
#define TARGET_MINSIGSTKSZ 2048
-#define TARGET_MLOCKALL_MCL_CURRENT 0x2000
-#define TARGET_MLOCKALL_MCL_FUTURE 0x4000
+#define TARGET_MCL_CURRENT 0x2000
+#define TARGET_MCL_FUTURE 0x4000
+#define TARGET_MCL_ONFAULT 0x8000
#define TARGET_WANT_NI_OLD_SELECT
#endif /* PPC_TARGET_SYSCALL_H */
diff --git a/linux-user/riscv/target_syscall.h b/linux-user/riscv/target_syscall.h
index a88e821f73..dc597c8972 100644
--- a/linux-user/riscv/target_syscall.h
+++ b/linux-user/riscv/target_syscall.h
@@ -51,8 +51,9 @@ struct target_pt_regs {
#define UNAME_MINIMUM_RELEASE "4.15.0"
#define TARGET_MINSIGSTKSZ 2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE 2
+#define TARGET_MCL_CURRENT 1
+#define TARGET_MCL_FUTURE 2
+#define TARGET_MCL_ONFAULT 4
/* clone(flags, newsp, ptidptr, tls, ctidptr) for RISC-V */
/* This comes from linux/kernel/fork.c, CONFIG_CLONE_BACKWARDS */
diff --git a/linux-user/s390x/target_syscall.h b/linux-user/s390x/target_syscall.h
index 8d4f609eaa..94f84178db 100644
--- a/linux-user/s390x/target_syscall.h
+++ b/linux-user/s390x/target_syscall.h
@@ -28,7 +28,8 @@ struct target_pt_regs {
#define TARGET_CLONE_BACKWARDS2
#define TARGET_MINSIGSTKSZ 2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE 2
+#define TARGET_MCL_CURRENT 1
+#define TARGET_MCL_FUTURE 2
+#define TARGET_MCL_ONFAULT 4
#endif /* S390X_TARGET_SYSCALL_H */
diff --git a/linux-user/sh4/target_syscall.h b/linux-user/sh4/target_syscall.h
index 2b5f75be13..c1437adafe 100644
--- a/linux-user/sh4/target_syscall.h
+++ b/linux-user/sh4/target_syscall.h
@@ -16,8 +16,9 @@ struct target_pt_regs {
#define UNAME_MINIMUM_RELEASE "2.6.32"
#define TARGET_MINSIGSTKSZ 2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE 2
+#define TARGET_MCL_CURRENT 1
+#define TARGET_MCL_FUTURE 2
+#define TARGET_MCL_ONFAULT 4
#define TARGET_FORCE_SHMLBA
diff --git a/linux-user/sparc/target_syscall.h b/linux-user/sparc/target_syscall.h
index b9160a771b..d8ea04ea83 100644
--- a/linux-user/sparc/target_syscall.h
+++ b/linux-user/sparc/target_syscall.h
@@ -21,8 +21,9 @@ struct target_pt_regs {
*/
#define TARGET_CLONE_BACKWARDS
#define TARGET_MINSIGSTKSZ 4096
-#define TARGET_MLOCKALL_MCL_CURRENT 0x2000
-#define TARGET_MLOCKALL_MCL_FUTURE 0x4000
+#define TARGET_MCL_CURRENT 0x2000
+#define TARGET_MCL_FUTURE 0x4000
+#define TARGET_MCL_ONFAULT 0x8000
/* For SPARC SHMLBA is determined at runtime in the kernel, and
* libc has to runtime-detect it using the hwcaps (see glibc
diff --git a/linux-user/sparc64/target_syscall.h b/linux-user/sparc64/target_syscall.h
index 3073a23e03..696a68b1ed 100644
--- a/linux-user/sparc64/target_syscall.h
+++ b/linux-user/sparc64/target_syscall.h
@@ -22,8 +22,9 @@ struct target_pt_regs {
*/
#define TARGET_CLONE_BACKWARDS
#define TARGET_MINSIGSTKSZ 4096
-#define TARGET_MLOCKALL_MCL_CURRENT 0x2000
-#define TARGET_MLOCKALL_MCL_FUTURE 0x4000
+#define TARGET_MCL_CURRENT 0x2000
+#define TARGET_MCL_FUTURE 0x4000
+#define TARGET_MCL_ONFAULT 0x8000
#define TARGET_FORCE_SHMLBA
diff --git a/linux-user/strace.c b/linux-user/strace.c
index ce02f62efc..0d95cc6089 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -1198,6 +1198,15 @@ UNUSED static struct flags falloc_flags[] = {
#endif
};
+UNUSED static struct flags mlockall_flags[] = {
+ FLAG_TARGET(MCL_CURRENT),
+ FLAG_TARGET(MCL_FUTURE),
+#ifdef MCL_ONFAULT
+ FLAG_TARGET(MCL_ONFAULT),
+#endif
+ FLAG_END,
+};
+
/*
* print_xxx utility functions. These are used to print syscall
* parameters in certain format. All of these have parameter
@@ -2009,6 +2018,18 @@ print_ftruncate64(void *cpu_env, const struct syscallname *name,
}
#endif
+#ifdef TARGET_NR_mlockall
+static void
+print_mlockall(void *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_flags(mlockall_flags, arg0, 1);
+ print_syscall_epilogue(name);
+}
+#endif
+
#if defined(TARGET_NR_socket)
static void
print_socket(void *cpu_env, const struct syscallname *name,
diff --git a/linux-user/strace.list b/linux-user/strace.list
index 8e5303d035..d0ea7f3464 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -568,13 +568,13 @@
{ TARGET_NR_mknodat, "mknodat" , NULL, print_mknodat, NULL },
#endif
#ifdef TARGET_NR_mlock
-{ TARGET_NR_mlock, "mlock" , NULL, NULL, NULL },
+{ TARGET_NR_mlock, "mlock" , "%s(%p," TARGET_FMT_lu ")", NULL, NULL },
#endif
#ifdef TARGET_NR_mlock2
{ TARGET_NR_mlock2, "mlock2" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_mlockall
-{ TARGET_NR_mlockall, "mlockall" , NULL, NULL, NULL },
+{ TARGET_NR_mlockall, "mlockall" , NULL, print_mlockall, NULL },
#endif
#ifdef TARGET_NR_mmap
{ TARGET_NR_mmap, "mmap" , NULL, print_mmap, print_syscall_ret_addr },
@@ -637,10 +637,10 @@
{ TARGET_NR_multiplexer, "multiplexer" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_munlock
-{ TARGET_NR_munlock, "munlock" , NULL, NULL, NULL },
+{ TARGET_NR_munlock, "munlock" , "%s(%p," TARGET_FMT_lu ")", NULL, NULL },
#endif
#ifdef TARGET_NR_munlockall
-{ TARGET_NR_munlockall, "munlockall" , NULL, NULL, NULL },
+{ TARGET_NR_munlockall, "munlockall" , "%s()", NULL, NULL },
#endif
#ifdef TARGET_NR_munmap
{ TARGET_NR_munmap, "munmap" , NULL, print_munmap, NULL },
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index b9e86eddef..2cb7b4f6b9 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6840,12 +6840,18 @@ static inline int target_to_host_mlockall_arg(int arg)
{
int result = 0;
- if (arg & TARGET_MLOCKALL_MCL_CURRENT) {
+ if (arg & TARGET_MCL_CURRENT) {
result |= MCL_CURRENT;
}
- if (arg & TARGET_MLOCKALL_MCL_FUTURE) {
+ if (arg & TARGET_MCL_FUTURE) {
result |= MCL_FUTURE;
}
+#ifdef MCL_ONFAULT
+ if (arg & TARGET_MCL_ONFAULT) {
+ result |= MCL_ONFAULT;
+ }
+#endif
+
return result;
}
#endif
diff --git a/linux-user/tilegx/target_syscall.h b/linux-user/tilegx/target_syscall.h
index d731acdafa..8e9db734b8 100644
--- a/linux-user/tilegx/target_syscall.h
+++ b/linux-user/tilegx/target_syscall.h
@@ -34,8 +34,9 @@ struct target_pt_regs {
tilegx_reg_t pad[2];
};
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE 2
+#define TARGET_MCL_CURRENT 1
+#define TARGET_MCL_FUTURE 2
+#define TARGET_MCL_ONFAULT 4
/* For faultnum */
#define TARGET_INT_SWINT_1 14
diff --git a/linux-user/x86_64/target_syscall.h b/linux-user/x86_64/target_syscall.h
index 5e221e1d9d..3ecccb72be 100644
--- a/linux-user/x86_64/target_syscall.h
+++ b/linux-user/x86_64/target_syscall.h
@@ -101,7 +101,8 @@ struct target_msqid64_ds {
#define TARGET_ARCH_GET_FS 0x1003
#define TARGET_ARCH_GET_GS 0x1004
#define TARGET_MINSIGSTKSZ 2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE 2
+#define TARGET_MCL_CURRENT 1
+#define TARGET_MCL_FUTURE 2
+#define TARGET_MCL_ONFAULT 4
#endif /* X86_64_TARGET_SYSCALL_H */
diff --git a/linux-user/xtensa/target_syscall.h b/linux-user/xtensa/target_syscall.h
index 3866dad849..afc86a153f 100644
--- a/linux-user/xtensa/target_syscall.h
+++ b/linux-user/xtensa/target_syscall.h
@@ -43,7 +43,8 @@ struct target_pt_regs {
xtensa_reg_t areg[16];
};
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE 2
+#define TARGET_MCL_CURRENT 1
+#define TARGET_MCL_FUTURE 2
+#define TARGET_MCL_ONFAULT 4
#endif
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 4/4] linux-user: Add strace support for printing arguments of some clock and time functions
2020-07-13 9:50 [PATCH v2 0/4] Add strace support for printing arguments for a group of selected syscalls Filip Bozuta
` (2 preceding siblings ...)
2020-07-13 9:50 ` [PATCH v2 3/4] linux-user: Add strace support for printing arguments of syscalls used to lock and unlock memory Filip Bozuta
@ 2020-07-13 9:50 ` Filip Bozuta
2020-07-21 14:47 ` Laurent Vivier
2020-07-13 10:42 ` [PATCH v2 0/4] Add strace support for printing arguments for a group of selected syscalls no-reply
4 siblings, 1 reply; 10+ messages in thread
From: Filip Bozuta @ 2020-07-13 9:50 UTC (permalink / raw)
To: qemu-devel; +Cc: Laurent Vivier, Filip Bozuta
This patch implements strace argument printing functionality for following syscalls:
* clock_getres, clock_gettime, clock_settime - clock and time functions
int clock_getres(clockid_t clockid, struct timespec *res)
int clock_gettime(clockid_t clockid, struct timespec *tp)
int clock_settime(clockid_t clockid, const struct timespec *tp)
man page: https://man7.org/linux/man-pages/man2/clock_getres.2.html
* gettimeofday - get time
int gettimeofday(struct timeval *tv, struct timezone *tz)
man page: https://man7.org/linux/man-pages/man2/gettimeofday.2.html
* getitimer, setitimer - get or set value of an interval timer
int getitimer(int which, struct itimerval *curr_value)
int setitimer(int which, const struct itimerval *new_value,
struct itimerval *old_value)
man page: https://man7.org/linux/man-pages/man2/getitimer.2.html
Implementation notes:
All of the syscalls have some structue types as argument types and thus
a separate printing function was stated in file "strace.list" for each
of them. All of these functions use existing functions for their
appropriate structure types ("print_timeval()" and "print_timezone()").
Functions "print_timespec()" and "print_itimerval()" were added in this
patch so that they can be used to print types "struct timespec" and
"struct itimerval" used by some of the syscalls. Function "print_itimerval()"
uses the existing function "print_timeval()" to print fields of the
structure "struct itimerval" that are of type "struct timeval".
Function "print_itimer_type()" was added to print the type of the interval
typer which is the firt argument of "getitimer()" and "setitimer()".
Also, the existing function "print_timeval()" was changed a little so
that it prints the field names beside the values. Syscalls "clock_getres()"
and "clocK_gettime()" have the same number and types of arguments and
thus their print functions "print_clock_getres" and "print_clock_gettime"
shate a common definition in file "strace.c".
Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
---
linux-user/strace.c | 208 ++++++++++++++++++++++++++++++++++++++++-
linux-user/strace.list | 17 ++--
2 files changed, 217 insertions(+), 8 deletions(-)
diff --git a/linux-user/strace.c b/linux-user/strace.c
index 0d95cc6089..9bdee3b495 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -64,7 +64,10 @@ UNUSED static void print_string(abi_long, int);
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_timezone(abi_ulong, int);
+UNUSED static void print_itimer_type(abi_ulong, int);
+UNUSED static void print_itimerval(abi_ulong, int);
UNUSED static void print_number(abi_long, int);
UNUSED static void print_signal(abi_ulong, int);
UNUSED static void print_sockaddr(abi_ulong, abi_long, int);
@@ -829,6 +832,89 @@ print_syscall_ret_adjtimex(void *cpu_env, const struct syscallname *name,
}
#endif
+#if defined(TARGET_NR_clock_gettime) || defined(TARGET_NR_clock_getres)
+static void
+print_syscall_ret_clock_gettime(void *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)
+{
+ print_syscall_err(ret);
+
+ if (ret >= 0) {
+ qemu_log(TARGET_ABI_FMT_ld, ret);
+ qemu_log(" (");
+ print_timespec(arg1, 1);
+ qemu_log(")");
+ }
+
+ qemu_log("\n");
+}
+#define print_syscall_ret_clock_getres print_syscall_ret_clock_gettime
+#endif
+
+#ifdef TARGET_NR_gettimeofday
+static void
+print_syscall_ret_gettimeofday(void *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)
+{
+ print_syscall_err(ret);
+
+ if (ret >= 0) {
+ qemu_log(TARGET_ABI_FMT_ld, ret);
+ qemu_log(" (");
+ print_timeval(arg0, 0);
+ print_timezone(arg1, 1);
+ qemu_log(")");
+ }
+
+ qemu_log("\n");
+}
+#endif
+
+#ifdef TARGET_NR_getitimer
+static void
+print_syscall_ret_getitimer(void *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)
+{
+ print_syscall_err(ret);
+
+ if (ret >= 0) {
+ qemu_log(TARGET_ABI_FMT_ld, ret);
+ qemu_log(" (");
+ print_itimerval(arg1, 1);
+ qemu_log(")");
+ }
+
+ qemu_log("\n");
+}
+#endif
+
+
+#ifdef TARGET_NR_getitimer
+static void
+print_syscall_ret_setitimer(void *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)
+{
+ print_syscall_err(ret);
+
+ if (ret >= 0) {
+ qemu_log(TARGET_ABI_FMT_ld, ret);
+ qemu_log(" (old_value = ");
+ print_itimerval(arg2, 1);
+ qemu_log(")");
+ }
+
+ qemu_log("\n");
+}
+#endif
+
#if defined(TARGET_NR_listxattr) || defined(TARGET_NR_llistxattr) \
|| defined(TARGGET_NR_flistxattr)
static void
@@ -1408,13 +1494,34 @@ print_timeval(abi_ulong tv_addr, int last)
print_pointer(tv_addr, last);
return;
}
- qemu_log("{" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "}%s",
- tswapal(tv->tv_sec), tswapal(tv->tv_usec), get_comma(last));
+ qemu_log("{tv_sec = " TARGET_ABI_FMT_ld
+ ",tv_usec = " TARGET_ABI_FMT_ld "}%s",
+ tswapal(tv->tv_sec), tswapal(tv->tv_usec), get_comma(last));
unlock_user(tv, tv_addr, 0);
} else
qemu_log("NULL%s", get_comma(last));
}
+static void
+print_timespec(abi_ulong ts_addr, int last)
+{
+ if (ts_addr) {
+ struct target_timespec *ts;
+
+ ts = lock_user(VERIFY_READ, ts_addr, sizeof(*ts), 1);
+ if (!ts) {
+ print_pointer(ts_addr, last);
+ return;
+ }
+ qemu_log("{tv_sec = " TARGET_ABI_FMT_ld
+ ",tv_nsec = " TARGET_ABI_FMT_ld "}%s",
+ tswapal(ts->tv_sec), tswapal(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)
{
@@ -1434,6 +1541,36 @@ print_timezone(abi_ulong tz_addr, int last)
}
}
+static void
+print_itimer_type(abi_ulong itimer, int last)
+{
+ switch (itimer) {
+ case ITIMER_REAL:
+ qemu_log("ITIMER_REAL,"); break;
+ case ITIMER_VIRTUAL:
+ qemu_log("ITIMER_VIRTUAL,"); break;
+ case ITIMER_PROF:
+ qemu_log("ITIMER_PROF,"); break;
+ default:
+ print_raw_param("%#x", itimer, 0);
+ }
+ qemu_log("%s", get_comma(last));
+}
+
+static void
+print_itimerval(abi_ulong it_addr, int last)
+{
+ if (it_addr) {
+ qemu_log("{it_interval=");
+ print_timeval(it_addr, 0);
+ qemu_log("it_value=");
+ print_timeval(it_addr + sizeof(struct target_timeval), 1);
+ qemu_log("}%s", get_comma(last));
+ } else {
+ qemu_log("NULL%s", get_comma(last));
+ }
+}
+
#undef UNUSED
#ifdef TARGET_NR_accept
@@ -1876,6 +2013,19 @@ print_futimesat(void *cpu_env, const struct syscallname *name,
}
#endif
+#ifdef TARGET_NR_gettimeofday
+static void
+print_gettimeofday(void *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_pointer(arg0, 0);
+ print_pointer(arg1, 1);
+ print_syscall_epilogue(name);
+}
+#endif
+
#ifdef TARGET_NR_settimeofday
static void
print_settimeofday(void *cpu_env, const struct syscallname *name,
@@ -1889,6 +2039,60 @@ print_settimeofday(void *cpu_env, const struct syscallname *name,
}
#endif
+#if defined(TARGET_NR_clock_gettime) || defined(TARGET_NR_clock_getres)
+static void
+print_clock_gettime(void *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_clockid(arg0, 0);
+ print_pointer(arg1, 1);
+ print_syscall_epilogue(name);
+}
+#define print_clock_getres print_clock_gettime
+#endif
+
+#ifdef TARGET_NR_clock_settime
+static void
+print_clock_settime(void *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_clockid(arg0, 0);
+ print_timespec(arg1, 1);
+ print_syscall_epilogue(name);
+}
+#endif
+
+#ifdef TARGET_NR_getitimer
+static void
+print_getitimer(void *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_itimer_type(arg0, 0);
+ print_pointer(arg1, 1);
+ print_syscall_epilogue(name);
+}
+#endif
+
+#ifdef TARGET_NR_setitimer
+static void
+print_setitimer(void *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_itimer_type(arg0, 0);
+ print_itimerval(arg1, 0);
+ print_pointer(arg2, 1);
+ print_syscall_epilogue(name);
+}
+#endif
+
#ifdef TARGET_NR_link
static void
print_link(void *cpu_env, const struct syscallname *name,
diff --git a/linux-user/strace.list b/linux-user/strace.list
index d0ea7f3464..084048ab96 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -83,16 +83,18 @@
{ 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 },
+{ TARGET_NR_clock_getres, "clock_getres" , NULL, print_clock_getres,
+ print_syscall_ret_clock_getres },
#endif
#ifdef TARGET_NR_clock_gettime
-{ TARGET_NR_clock_gettime, "clock_gettime" , NULL, NULL, NULL },
+{ TARGET_NR_clock_gettime, "clock_gettime" , NULL, print_clock_gettime,
+ print_syscall_ret_clock_gettime },
#endif
#ifdef TARGET_NR_clock_nanosleep
{ TARGET_NR_clock_nanosleep, "clock_nanosleep" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_clock_settime
-{ TARGET_NR_clock_settime, "clock_settime" , NULL, NULL, NULL },
+{ TARGET_NR_clock_settime, "clock_settime" , NULL, print_clock_settime, NULL },
#endif
#ifdef TARGET_NR_clone
{ TARGET_NR_clone, "clone" , NULL, print_clone, NULL },
@@ -315,7 +317,8 @@
{ TARGET_NR_gethostname, "gethostname" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_getitimer
-{ TARGET_NR_getitimer, "getitimer" , NULL, NULL, NULL },
+{ TARGET_NR_getitimer, "getitimer" , NULL, print_getitimer,
+ print_syscall_ret_getitimer },
#endif
#ifdef TARGET_NR_get_kernel_syms
{ TARGET_NR_get_kernel_syms, "get_kernel_syms" , NULL, NULL, NULL },
@@ -388,7 +391,8 @@
{ TARGET_NR_gettid, "gettid" , "%s()", NULL, NULL },
#endif
#ifdef TARGET_NR_gettimeofday
-{ TARGET_NR_gettimeofday, "gettimeofday" , NULL, NULL, NULL },
+{ TARGET_NR_gettimeofday, "gettimeofday" , NULL, print_gettimeofday,
+ print_syscall_ret_gettimeofday },
#endif
#ifdef TARGET_NR_getuid
{ TARGET_NR_getuid, "getuid" , "%s()", NULL, NULL },
@@ -1291,7 +1295,8 @@
{ TARGET_NR_sethostname, "sethostname" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_setitimer
-{ TARGET_NR_setitimer, "setitimer" , NULL, NULL, NULL },
+{ TARGET_NR_setitimer, "setitimer" , NULL, print_setitimer,
+ print_syscall_ret_setitimer },
#endif
#ifdef TARGET_NR_set_mempolicy
{ TARGET_NR_set_mempolicy, "set_mempolicy" , NULL, NULL, NULL },
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v2 0/4] Add strace support for printing arguments for a group of selected syscalls
2020-07-13 9:50 [PATCH v2 0/4] Add strace support for printing arguments for a group of selected syscalls Filip Bozuta
` (3 preceding siblings ...)
2020-07-13 9:50 ` [PATCH v2 4/4] linux-user: Add strace support for printing arguments of some clock and time functions Filip Bozuta
@ 2020-07-13 10:42 ` no-reply
4 siblings, 0 replies; 10+ messages in thread
From: no-reply @ 2020-07-13 10:42 UTC (permalink / raw)
To: Filip.Bozuta; +Cc: qemu-devel, Filip.Bozuta, laurent
Patchew URL: https://patchew.org/QEMU/20200713095058.106624-1-Filip.Bozuta@syrmia.com/
Hi,
This series seems to have some coding style problems. See output below for
more information:
Type: series
Message-id: 20200713095058.106624-1-Filip.Bozuta@syrmia.com
Subject: [PATCH v2 0/4] Add strace support for printing arguments for a group of selected syscalls
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Switched to a new branch 'test'
773d300 linux-user: Add strace support for printing arguments of some clock and time functions
c0f4fd3 linux-user: Add strace support for printing arguments of syscalls used to lock and unlock memory
bef93ac linux-user: Add strace support for printing arguments of truncate()/ftruncate() and getsid()
6601cfb linux-user: Make cpu_env accessible in strace.c
=== OUTPUT BEGIN ===
1/4 Checking commit 6601cfb1b081 (linux-user: Make cpu_env accessible in strace.c)
2/4 Checking commit bef93ac02143 (linux-user: Add strace support for printing arguments of truncate()/ftruncate() and getsid())
3/4 Checking commit c0f4fd3df8ce (linux-user: Add strace support for printing arguments of syscalls used to lock and unlock memory)
ERROR: storage class should be at the beginning of the declaration
#336: FILE: linux-user/strace.c:1201:
+UNUSED static struct flags mlockall_flags[] = {
total: 1 errors, 0 warnings, 307 lines checked
Patch 3/4 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
4/4 Checking commit 773d300f9a0f (linux-user: Add strace support for printing arguments of some clock and time functions)
ERROR: storage class should be at the beginning of the declaration
#58: FILE: linux-user/strace.c:67:
+UNUSED static void print_timespec(abi_ulong, int);
ERROR: storage class should be at the beginning of the declaration
#60: FILE: linux-user/strace.c:69:
+UNUSED static void print_itimer_type(abi_ulong, int);
ERROR: storage class should be at the beginning of the declaration
#61: FILE: linux-user/strace.c:70:
+UNUSED static void print_itimerval(abi_ulong, int);
total: 3 errors, 0 warnings, 299 lines checked
Patch 4/4 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/20200713095058.106624-1-Filip.Bozuta@syrmia.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 1/4] linux-user: Make cpu_env accessible in strace.c
2020-07-13 9:50 ` [PATCH v2 1/4] linux-user: Make cpu_env accessible in strace.c Filip Bozuta
@ 2020-07-21 14:22 ` Laurent Vivier
0 siblings, 0 replies; 10+ messages in thread
From: Laurent Vivier @ 2020-07-21 14:22 UTC (permalink / raw)
To: Filip Bozuta, qemu-devel
Le 13/07/2020 à 11:50, Filip Bozuta a écrit :
> Variable "cpu_env" is used in file "syscall.c" to store
> the information about the cpu environment. This variable
> is used because values of some syscalls can vary between
> cpu architectures. This patch makes the "cpu_env" accessible
> in "strace.c" so it can enable aproppriate "-strace" argument
> printing for these syscalls. This will be a useful addition
> for future "-strace" implementation in QEMU.
>
> Implementation notes:
>
> Functions "print_syscall()" and "print_syscall_ret()" which
> are stated and defined in "qemu.h" and "strace.c" respectively
> are used to print syscall arguments before and after syscall
> execution. These functions were changed with addition of a
> new argument "void *cpu_env". Strucute "struct syscallname"
> in "strace.c" is used to store the information about syscalls.
> Fields "call" and "result" represent pointers to functions which
> are used to print syscall arguments before and after execution.
> These fields were also changed with addition of a new "void *"
> argumetn.
> Also, all defined "print_*" and "print_syscall_ret*" functions
> in "strace.c" were changed to have the new "void *cpu_env".
> This was done to not cause build errors (even though none of
> these functions use this argument).
>
> Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
> ---
> linux-user/qemu.h | 4 +-
> linux-user/strace.c | 479 ++++++++++++++++++++++---------------------
> linux-user/syscall.c | 5 +-
> 3 files changed, 247 insertions(+), 241 deletions(-)
>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 2/4] linux-user: Add strace support for printing arguments of truncate()/ftruncate() and getsid()
2020-07-13 9:50 ` [PATCH v2 2/4] linux-user: Add strace support for printing arguments of truncate()/ftruncate() and getsid() Filip Bozuta
@ 2020-07-21 14:28 ` Laurent Vivier
0 siblings, 0 replies; 10+ messages in thread
From: Laurent Vivier @ 2020-07-21 14:28 UTC (permalink / raw)
To: Filip Bozuta, qemu-devel
Le 13/07/2020 à 11:50, Filip Bozuta a écrit :
> This patch implements strace argument printing functionality for following syscalls:
>
> * truncate, ftruncate - truncate a file to a specified length
>
> int truncate/truncate64(const char *path, off_t length)
> int ftruncate/ftruncate64(int fd, off_t length)
> man page: https://man7.org/linux/man-pages/man2/truncate.2.html
>
> * getsid - get session ID
>
> pid_t getsid(pid_t pid)
> man page: https://man7.org/linux/man-pages/man2/getsid.2.html
>
> Implementation notes:
>
> Syscalls truncate/truncate64 take string argument types and thus a
> separate print function "print_truncate/print_truncate64" is stated in
> file "strace.list". This function is defined and implemented in "strace.c"
> by using an existing function used to print string arguments: "print_string()".
> For syscall ftruncate64, a separate printing function was also stated in
> "strace.c" as it requires a special kind of handling.
> The other syscalls have only primitive argument types, so the rest of the
> implementation was handled by stating an appropriate printing format in file
> "strace.list".
> Function "regpairs_aligned()" was cut & pasted from "syscall.c" to "qemu.h"
> as it is used by functions "print_truncate64()" and "print_ftruncate64()"
> to print the offset arguments of "truncate64()" and "ftruncate64()".
>
> Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
> ---
> linux-user/qemu.h | 35 +++++++++++++++++++++++++++++++
> linux-user/strace.c | 47 ++++++++++++++++++++++++++++++++++++++++++
> linux-user/strace.list | 10 ++++-----
> linux-user/syscall.c | 32 ----------------------------
> 4 files changed, 87 insertions(+), 37 deletions(-)
>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 3/4] linux-user: Add strace support for printing arguments of syscalls used to lock and unlock memory
2020-07-13 9:50 ` [PATCH v2 3/4] linux-user: Add strace support for printing arguments of syscalls used to lock and unlock memory Filip Bozuta
@ 2020-07-21 14:33 ` Laurent Vivier
0 siblings, 0 replies; 10+ messages in thread
From: Laurent Vivier @ 2020-07-21 14:33 UTC (permalink / raw)
To: Filip Bozuta, qemu-devel
Le 13/07/2020 à 11:50, Filip Bozuta a écrit :
> This patch implements strace argument printing functionality for following syscalls:
>
> * mlock, munlock, mlockall, munlockall - lock and unlock memory
>
> int mlock(const void *addr, size_t len)
> int munlock(const void *addr, size_t len)
> int mlockall(int flags)
> int munlockall(void)
> man page: https://man7.org/linux/man-pages/man2/mlock.2.html
>
> Implementation notes:
>
> Syscall mlockall() takes an argument that is composed of predefined values
> which represent flags that determine the type of locking operation that is
> to be performed. For that reason, a printing function "print_mlockall" was
> stated in file "strace.list". This printing function uses an already existing
> function "print_flags()" to print the "flags" argument. These flags are stated
> inside an array "mlockall_flags" that contains values of type "struct flags".
> These values are instantiated using an existing macro "FLAG_TARGET()" that
> crates aproppriate target flag values based on those defined in files
> '/target_syscall.h'. These target flag values were changed from
> "TARGET_MLOCKALL_MCL*" to "TARGET_MCL_*" so that they can be aproppriately set
> and recognised in "strace.c" with "FLAG_TARGET()". Value for "MCL_ONFAULT"
> was added in this patch. This value was also added in "syscall.c" in function
> "target_to_host_mlockall_arg()". Because this flag value was added in kernel
> version 4.4, it is enwrapped in an #ifdef directive (both in "syscall.c" and
> in "strace.c") as to support older kernel versions.
> The other syscalls have only primitive argument types, so the
> rest of the implementation was handled by stating an appropriate
> printing format in file "strace.list". Syscall mlock2() is not implemented in
> "syscall.c" and thus it's argument printing is not implemented in this patch.
>
> Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
> ---
> linux-user/aarch64/target_syscall.h | 5 +++--
> linux-user/alpha/target_syscall.h | 5 +++--
> linux-user/arm/target_syscall.h | 6 ++++--
> linux-user/cris/target_syscall.h | 5 +++--
> linux-user/hppa/target_syscall.h | 5 +++--
> linux-user/i386/target_syscall.h | 5 +++--
> linux-user/m68k/target_syscall.h | 6 +++---
> linux-user/microblaze/target_syscall.h | 5 +++--
> linux-user/mips/target_syscall.h | 5 +++--
> linux-user/mips64/target_syscall.h | 5 +++--
> linux-user/nios2/target_syscall.h | 5 +++--
> linux-user/openrisc/target_syscall.h | 5 +++--
> linux-user/ppc/target_syscall.h | 5 +++--
> linux-user/riscv/target_syscall.h | 5 +++--
> linux-user/s390x/target_syscall.h | 5 +++--
> linux-user/sh4/target_syscall.h | 5 +++--
> linux-user/sparc/target_syscall.h | 5 +++--
> linux-user/sparc64/target_syscall.h | 5 +++--
> linux-user/strace.c | 21 +++++++++++++++++++++
> linux-user/strace.list | 8 ++++----
> linux-user/syscall.c | 10 ++++++++--
> linux-user/tilegx/target_syscall.h | 5 +++--
> linux-user/x86_64/target_syscall.h | 5 +++--
> linux-user/xtensa/target_syscall.h | 5 +++--
> 24 files changed, 97 insertions(+), 49 deletions(-)
>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 4/4] linux-user: Add strace support for printing arguments of some clock and time functions
2020-07-13 9:50 ` [PATCH v2 4/4] linux-user: Add strace support for printing arguments of some clock and time functions Filip Bozuta
@ 2020-07-21 14:47 ` Laurent Vivier
0 siblings, 0 replies; 10+ messages in thread
From: Laurent Vivier @ 2020-07-21 14:47 UTC (permalink / raw)
To: Filip Bozuta, qemu-devel
Le 13/07/2020 à 11:50, Filip Bozuta a écrit :
> This patch implements strace argument printing functionality for following syscalls:
>
> * clock_getres, clock_gettime, clock_settime - clock and time functions
>
> int clock_getres(clockid_t clockid, struct timespec *res)
> int clock_gettime(clockid_t clockid, struct timespec *tp)
> int clock_settime(clockid_t clockid, const struct timespec *tp)
> man page: https://man7.org/linux/man-pages/man2/clock_getres.2.html
>
> * gettimeofday - get time
>
> int gettimeofday(struct timeval *tv, struct timezone *tz)
> man page: https://man7.org/linux/man-pages/man2/gettimeofday.2.html
>
> * getitimer, setitimer - get or set value of an interval timer
>
> int getitimer(int which, struct itimerval *curr_value)
> int setitimer(int which, const struct itimerval *new_value,
> struct itimerval *old_value)
> man page: https://man7.org/linux/man-pages/man2/getitimer.2.html
>
> Implementation notes:
>
> All of the syscalls have some structue types as argument types and thus
> a separate printing function was stated in file "strace.list" for each
> of them. All of these functions use existing functions for their
> appropriate structure types ("print_timeval()" and "print_timezone()").
> Functions "print_timespec()" and "print_itimerval()" were added in this
> patch so that they can be used to print types "struct timespec" and
> "struct itimerval" used by some of the syscalls. Function "print_itimerval()"
> uses the existing function "print_timeval()" to print fields of the
> structure "struct itimerval" that are of type "struct timeval".
> Function "print_itimer_type()" was added to print the type of the interval
> typer which is the firt argument of "getitimer()" and "setitimer()".
> Also, the existing function "print_timeval()" was changed a little so
> that it prints the field names beside the values. Syscalls "clock_getres()"
> and "clocK_gettime()" have the same number and types of arguments and
> thus their print functions "print_clock_getres" and "print_clock_gettime"
> shate a common definition in file "strace.c".
>
> Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
> ---
> linux-user/strace.c | 208 ++++++++++++++++++++++++++++++++++++++++-
> linux-user/strace.list | 17 ++--
> 2 files changed, 217 insertions(+), 8 deletions(-)
>
> diff --git a/linux-user/strace.c b/linux-user/strace.c
> index 0d95cc6089..9bdee3b495 100644
> --- a/linux-user/strace.c
> +++ b/linux-user/strace.c
> @@ -64,7 +64,10 @@ UNUSED static void print_string(abi_long, int);
> 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_timezone(abi_ulong, int);
> +UNUSED static void print_itimer_type(abi_ulong, int);
> +UNUSED static void print_itimerval(abi_ulong, int);
> UNUSED static void print_number(abi_long, int);
> UNUSED static void print_signal(abi_ulong, int);
> UNUSED static void print_sockaddr(abi_ulong, abi_long, int);
> @@ -829,6 +832,89 @@ print_syscall_ret_adjtimex(void *cpu_env, const struct syscallname *name,
> }
> #endif
>
> +#if defined(TARGET_NR_clock_gettime) || defined(TARGET_NR_clock_getres)
> +static void
> +print_syscall_ret_clock_gettime(void *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)
> +{
> + print_syscall_err(ret);
> +
> + if (ret >= 0) {
The series needs to be rebased to use:
if (!print_syscall_err(ret)) {
> + qemu_log(TARGET_ABI_FMT_ld, ret);
> + qemu_log(" (");
> + print_timespec(arg1, 1);
> + qemu_log(")");
> + }
> +
> + qemu_log("\n");
> +}
> +#define print_syscall_ret_clock_getres print_syscall_ret_clock_gettime
> +#endif
> +
> +#ifdef TARGET_NR_gettimeofday
> +static void
> +print_syscall_ret_gettimeofday(void *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)
> +{
> + print_syscall_err(ret);
> +
> + if (ret >= 0) {
if (!print_syscall_err(ret)) {
> + qemu_log(TARGET_ABI_FMT_ld, ret);
> + qemu_log(" (");
> + print_timeval(arg0, 0);
> + print_timezone(arg1, 1);
> + qemu_log(")");
> + }
> +
> + qemu_log("\n");
> +}
> +#endif
> +
> +#ifdef TARGET_NR_getitimer
> +static void
> +print_syscall_ret_getitimer(void *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)
> +{
> + print_syscall_err(ret);
> +
> + if (ret >= 0) {
if (!print_syscall_err(ret)) {
> + qemu_log(TARGET_ABI_FMT_ld, ret);
> + qemu_log(" (");
> + print_itimerval(arg1, 1);
> + qemu_log(")");
> + }
> +
> + qemu_log("\n");
> +}
> +#endif
> +
> +
> +#ifdef TARGET_NR_getitimer
> +static void
> +print_syscall_ret_setitimer(void *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)
> +{
> + print_syscall_err(ret);
> +
> + if (ret >= 0) {
if (!print_syscall_err(ret)) {
> + qemu_log(TARGET_ABI_FMT_ld, ret);
> + qemu_log(" (old_value = ");
> + print_itimerval(arg2, 1);
> + qemu_log(")");
> + }
> +
> + qemu_log("\n");
> +}
> +#endif
> +
...
All the other changes seem ok.
Thanks,
Laurent
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2020-07-21 14:47 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-13 9:50 [PATCH v2 0/4] Add strace support for printing arguments for a group of selected syscalls Filip Bozuta
2020-07-13 9:50 ` [PATCH v2 1/4] linux-user: Make cpu_env accessible in strace.c Filip Bozuta
2020-07-21 14:22 ` Laurent Vivier
2020-07-13 9:50 ` [PATCH v2 2/4] linux-user: Add strace support for printing arguments of truncate()/ftruncate() and getsid() Filip Bozuta
2020-07-21 14:28 ` Laurent Vivier
2020-07-13 9:50 ` [PATCH v2 3/4] linux-user: Add strace support for printing arguments of syscalls used to lock and unlock memory Filip Bozuta
2020-07-21 14:33 ` Laurent Vivier
2020-07-13 9:50 ` [PATCH v2 4/4] linux-user: Add strace support for printing arguments of some clock and time functions Filip Bozuta
2020-07-21 14:47 ` Laurent Vivier
2020-07-13 10:42 ` [PATCH v2 0/4] Add strace support for printing arguments for a group of selected syscalls no-reply
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).