qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: Riku Voipio <riku.voipio@iki.fi>
Cc: qemu-devel@nongnu.org, Laurent Vivier <laurent@vivier.eu>
Subject: [Qemu-devel] [PATCH 3/5] linux-user: add socket() strace
Date: Wed,  8 Jun 2016 22:24:30 +0200	[thread overview]
Message-ID: <1465417472-11359-4-git-send-email-laurent@vivier.eu> (raw)
In-Reply-To: <1465417472-11359-1-git-send-email-laurent@vivier.eu>

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 linux-user/strace.c    | 24 ++++++++++++++++++++++++
 linux-user/strace.list |  2 +-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/linux-user/strace.c b/linux-user/strace.c
index 398e56e..0c3675c 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -1221,6 +1221,30 @@ print__llseek(const struct syscallname *name,
 }
 #endif
 
+#if defined(TARGET_NR_socket)
+static void
+print_socket(const struct syscallname *name,
+             abi_long arg0, abi_long arg1, abi_long arg2,
+             abi_long arg3, abi_long arg4, abi_long arg5)
+{
+    abi_ulong domain = arg0, type = arg1, protocol = arg2;
+
+    print_syscall_prologue(name);
+    print_socket_domain(domain);
+    gemu_log(",");
+    print_socket_type(type);
+    gemu_log(",");
+    if (domain == AF_PACKET ||
+        type == TARGET_SOCK_PACKET) {
+        protocol = tswapal(protocol); /* restore network endian long */
+        protocol = abi_ntohl(protocol); /* a host endian long */
+    }
+    print_socket_protocol(domain, type, protocol);
+    print_syscall_epilogue(name);
+}
+
+#endif
+
 #if defined(TARGET_NR_socketcall)
 static void
 print_socketcall(const struct syscallname *name,
diff --git a/linux-user/strace.list b/linux-user/strace.list
index b379497..7c54dc6 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -1291,7 +1291,7 @@
 { TARGET_NR_sigsuspend, "sigsuspend" , NULL, NULL, NULL },
 #endif
 #ifdef TARGET_NR_socket
-{ TARGET_NR_socket, "socket" , NULL, NULL, NULL },
+{ TARGET_NR_socket, "socket" , NULL, print_socket, NULL },
 #endif
 #ifdef TARGET_NR_socketcall
 { TARGET_NR_socketcall, "socketcall" , NULL, print_socketcall, NULL },
-- 
2.5.5

  parent reply	other threads:[~2016-06-08 20:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-08 20:24 [Qemu-devel] [PATCH 0/5] linux-user: some strace improvements Laurent Vivier
2016-06-08 20:24 ` [Qemu-devel] [PATCH 1/5] linux-user: add socketcall() strace Laurent Vivier
2016-06-10 12:51   ` Peter Maydell
2016-06-08 20:24 ` [Qemu-devel] [PATCH 2/5] linux-user: correct setsockopt() strace Laurent Vivier
2016-06-10 12:53   ` Peter Maydell
2016-06-08 20:24 ` Laurent Vivier [this message]
2016-06-10 12:54   ` [Qemu-devel] [PATCH 3/5] linux-user: add socket() strace Peter Maydell
2016-06-08 20:24 ` [Qemu-devel] [PATCH 4/5] linux-user: fix clone() strace Laurent Vivier
2016-06-10 13:13   ` Peter Maydell
2016-06-08 20:24 ` [Qemu-devel] [PATCH 5/5] linux-user: update get_thread_area/set_thread_area strace Laurent Vivier
2016-06-10 13:04   ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1465417472-11359-4-git-send-email-laurent@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).