mirror of
https://github.com/qemu/qemu.git
synced 2024-12-01 07:43:35 +08:00
linux-user/strace: Add print_sockfd()
Extract common print_sockfd() from various socket related syscalls. Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20191021114857.20538-7-f4bug@amsat.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
parent
814ae70ff9
commit
d84fe1ede7
@ -1709,6 +1709,15 @@ print_socket(const struct syscallname *name,
|
||||
|
||||
#if defined(TARGET_NR_socketcall)
|
||||
|
||||
static void print_sockfd(abi_long sockfd, int last)
|
||||
{
|
||||
print_raw_param(TARGET_ABI_FMT_ld, sockfd, last);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(TARGET_NR_socketcall)
|
||||
|
||||
#define get_user_ualx(x, gaddr, idx) \
|
||||
get_user_ual(x, (gaddr) + (idx) * sizeof(abi_long))
|
||||
|
||||
@ -1741,7 +1750,7 @@ static void do_print_sockaddr(const char *name, abi_long arg1)
|
||||
get_user_ualx(addrlen, arg1, 2);
|
||||
|
||||
gemu_log("%s(", name);
|
||||
print_raw_param(TARGET_ABI_FMT_ld, sockfd, 0);
|
||||
print_sockfd(sockfd, 0);
|
||||
print_sockaddr(addr, addrlen);
|
||||
gemu_log(")");
|
||||
}
|
||||
@ -1754,7 +1763,7 @@ static void do_print_listen(const char *name, abi_long arg1)
|
||||
get_user_ualx(backlog, arg1, 1);
|
||||
|
||||
gemu_log("%s(", name);
|
||||
print_raw_param(TARGET_ABI_FMT_ld, sockfd, 0);
|
||||
print_sockfd(sockfd, 0);
|
||||
print_raw_param(TARGET_ABI_FMT_ld, backlog, 1);
|
||||
gemu_log(")");
|
||||
}
|
||||
@ -1789,7 +1798,7 @@ static void do_print_sendrecv(const char *name, abi_long arg1)
|
||||
get_user_ualx(flags, arg1, 3);
|
||||
|
||||
gemu_log("%s(", name);
|
||||
print_raw_param(TARGET_ABI_FMT_ld, sockfd, 0);
|
||||
print_sockfd(sockfd, 0);
|
||||
print_buf(msg, len, 0);
|
||||
print_raw_param(TARGET_ABI_FMT_ld, len, 0);
|
||||
print_flags(msg_flags, flags, 1);
|
||||
@ -1808,7 +1817,7 @@ static void do_print_msgaddr(const char *name, abi_long arg1)
|
||||
get_user_ualx(addrlen, arg1, 5);
|
||||
|
||||
gemu_log("%s(", name);
|
||||
print_raw_param(TARGET_ABI_FMT_ld, sockfd, 0);
|
||||
print_sockfd(sockfd, 0);
|
||||
print_buf(msg, len, 0);
|
||||
print_raw_param(TARGET_ABI_FMT_ld, len, 0);
|
||||
print_flags(msg_flags, flags, 0);
|
||||
@ -1824,7 +1833,7 @@ static void do_print_shutdown(const char *name, abi_long arg1)
|
||||
get_user_ualx(how, arg1, 1);
|
||||
|
||||
gemu_log("shutdown(");
|
||||
print_raw_param(TARGET_ABI_FMT_ld, sockfd, 0);
|
||||
print_sockfd(sockfd, 0);
|
||||
switch (how) {
|
||||
case SHUT_RD:
|
||||
gemu_log("SHUT_RD");
|
||||
@ -1851,7 +1860,7 @@ static void do_print_msg(const char *name, abi_long arg1)
|
||||
get_user_ualx(flags, arg1, 2);
|
||||
|
||||
gemu_log("%s(", name);
|
||||
print_raw_param(TARGET_ABI_FMT_ld, sockfd, 0);
|
||||
print_sockfd(sockfd, 0);
|
||||
print_pointer(msg, 0);
|
||||
print_flags(msg_flags, flags, 1);
|
||||
gemu_log(")");
|
||||
@ -1868,7 +1877,7 @@ static void do_print_sockopt(const char *name, abi_long arg1)
|
||||
get_user_ualx(optlen, arg1, 4);
|
||||
|
||||
gemu_log("%s(", name);
|
||||
print_raw_param(TARGET_ABI_FMT_ld, sockfd, 0);
|
||||
print_sockfd(sockfd, 0);
|
||||
switch (level) {
|
||||
case SOL_TCP:
|
||||
gemu_log("SOL_TCP,");
|
||||
|
Loading…
Reference in New Issue
Block a user