qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

linux-user: Add strace support for printing arguments of chown()/lchown()

This patch implements strace argument printing functionality for syscalls:

*chown, lchown - change ownership of a file

int chown(const char *pathname, uid_t owner, gid_t group)
int lchown(const char *pathname, uid_t owner, gid_t group)
man page: https://www.man7.org/linux/man-pages/man2/lchown.2.html

Implementation notes:

Both syscalls use strings as arguments and thus a separate
printing function was stated in "strace.list" for them.
Both syscalls share the same number and types of arguments
and thus share a same definition in file "syscall.c".
This defintion uses existing functions "print_string()" to
print the string argument and "print_raw_param()" to print
other two arguments that are of basic types.

Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20200619123331.17387-6-filip.bozuta@syrmia.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>

authored by

Filip Bozuta and committed by
Laurent Vivier
5844f4bc af861dea

+17 -2
+15
linux-user/strace.c
··· 1452 1452 } 1453 1453 #endif 1454 1454 1455 + #if defined(TARGET_NR_chown) || defined(TARGET_NR_lchown) 1456 + static void 1457 + print_chown(const struct syscallname *name, 1458 + abi_long arg0, abi_long arg1, abi_long arg2, 1459 + abi_long arg3, abi_long arg4, abi_long arg5) 1460 + { 1461 + print_syscall_prologue(name); 1462 + print_string(arg0, 0); 1463 + print_raw_param("%d", arg1, 0); 1464 + print_raw_param("%d", arg2, 1); 1465 + print_syscall_epilogue(name); 1466 + } 1467 + #define print_lchown print_chown 1468 + #endif 1469 + 1455 1470 #ifdef TARGET_NR_clock_adjtime 1456 1471 static void 1457 1472 print_clock_adjtime(const struct syscallname *name,
+2 -2
linux-user/strace.list
··· 71 71 { TARGET_NR_chmod, "chmod" , NULL, print_chmod, NULL }, 72 72 #endif 73 73 #ifdef TARGET_NR_chown 74 - { TARGET_NR_chown, "chown" , NULL, NULL, NULL }, 74 + { TARGET_NR_chown, "chown" , NULL, print_chown, NULL }, 75 75 #endif 76 76 #ifdef TARGET_NR_chown32 77 77 { TARGET_NR_chown32, "chown32" , NULL, NULL, NULL }, ··· 475 475 { TARGET_NR_kill, "kill", NULL, print_kill, NULL }, 476 476 #endif 477 477 #ifdef TARGET_NR_lchown 478 - { TARGET_NR_lchown, "lchown" , NULL, NULL, NULL }, 478 + { TARGET_NR_lchown, "lchown" , NULL, print_lchown, NULL }, 479 479 #endif 480 480 #ifdef TARGET_NR_lchown32 481 481 { TARGET_NR_lchown32, "lchown32" , NULL, NULL, NULL },