aboutsummaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2019-10-21 13:48:54 +0200
committerLaurent Vivier <laurent@vivier.eu>2019-10-21 15:37:04 +0200
commitd84fe1ede770444686fa49b83dbf00f5796bb9eb (patch)
tree45b37eb22a289e9c7265ed24b895724820d37847 /linux-user
parent814ae70ff9d6bd842d1530521c9ca12dd984b8ae (diff)
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>
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/strace.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/linux-user/strace.c b/linux-user/strace.c
index 5fa7748427..0ce2b658a5 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -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,");