From patchwork Wed Jun 8 20:24:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 9165645 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D05ED60572 for ; Wed, 8 Jun 2016 20:25:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C0FB228389 for ; Wed, 8 Jun 2016 20:25:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 84EFF2837E; Wed, 8 Jun 2016 20:25:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8512428305 for ; Wed, 8 Jun 2016 20:25:30 +0000 (UTC) Received: from localhost ([::1]:59333 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAk2b-00077d-Fp for patchwork-qemu-devel@patchwork.kernel.org; Wed, 08 Jun 2016 16:25:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37265) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAk25-00075j-0r for qemu-devel@nongnu.org; Wed, 08 Jun 2016 16:24:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAk1y-0003tb-Ta for qemu-devel@nongnu.org; Wed, 08 Jun 2016 16:24:55 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:64176) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAk1y-0003sd-Jl for qemu-devel@nongnu.org; Wed, 08 Jun 2016 16:24:50 -0400 Received: from Quad.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue101) with ESMTPSA (Nemesis) id 0LuMNz-1bd5n31I2h-011hVs; Wed, 08 Jun 2016 22:24:42 +0200 From: Laurent Vivier To: Riku Voipio Date: Wed, 8 Jun 2016 22:24:30 +0200 Message-Id: <1465417472-11359-4-git-send-email-laurent@vivier.eu> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1465417472-11359-1-git-send-email-laurent@vivier.eu> References: <1465417472-11359-1-git-send-email-laurent@vivier.eu> X-Provags-ID: V03:K0:NZoIE9qH2sG5xx7RN27jmoF5/CGDyqIDFO2a8QRphKm1td7FVMC oHfYAvfZriNgxbOWgqn49VWmTirecvNOnHo661o8jfj7QVKcSR5GU8dvCgR1RKsNSdBX0GW FHdvrsjbiLCdYD4XohusbhTbVlxrYRcAEHvWxqhWW+nkhg1ne9PG78gnxR1qJwpv0cIDml9 WJMmuctKI7R/GlyEWMQFg== X-UI-Out-Filterresults: notjunk:1; V01:K0:tPodJPS263M=:BRtvLcV6YnQ4R9/prq4oGg f6tGPSs0z+NNWfRX9ZR4THUGAFcHG/S8VJJwm60xUCVYscOeWinVFfHMSXJh198QHswIJtV6G gCbb6OYZa+n8o1wffO+EowFgKlyfaCYza2B+mE55/T44Gv5u/H35nDDOYgajwzSmpXboKVPFa ICFOnbJm3HDK1RMaNYpcTY8XQ/kcDwqGpjkduK7F8e3RLMvBejLLO4Sq+Kup7fWvZrAUbO0OC 1MlDXhB8MVzbminJsw7UCUp5oO85/AysXLGYRBEo3D8NwvhQoiNNjeDt1ADyNu5Ti/WgcfOs2 KRTK6p1kg4c2BB95lfdqhrMBm84s6xmsUjrnZrd+JCe2UDuaxvH1rrWSMyS2wkigGXnnMi5IB rUdHazkxlI39H7DojlnjrAsGWoGA4YUO1YKKyhfYz4o1QBt6GaTjLK5HWy6UZke4K7+3OFnjc 16X5WapHmhPRqtVlfxSJe/NZArHBvVyUuY6KIqHOj7vqKf041qlBIph69VSa3yQbsLMzJ9UHX rIrxXhjVrdH/IqgAThzIqOTdstIG/LPemsW5lJz1HXzaXmwOMHTbvIP/ZgjCyb7CLq9S9kHKk MtfAi0aCs92ntbznfMj7+CC9Gz+ptNXUr9HC58zLHqysEZsxg5PRm5tgC2T/WYgQ1ikQT2xKt AqwnVWsPQuozfPuCpV+MgO1PvkY58OVmkhq+CH2UCEsBcmgti5iO4AbJjWEiuDuSgLbA= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.17.10 Subject: [Qemu-devel] [PATCH 3/5] linux-user: add socket() strace X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Laurent Vivier Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Laurent Vivier --- 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 },