From patchwork Wed Jun 11 14:29:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 31767 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f198.google.com (mail-ve0-f198.google.com [209.85.128.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 87B3E21134 for ; Wed, 11 Jun 2014 14:33:00 +0000 (UTC) Received: by mail-ve0-f198.google.com with SMTP id db11sf329842veb.9 for ; Wed, 11 Jun 2014 07:33:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=Ph6sQGkV5geUSy1KgCkNAtZe9LI81K8+kfvdszVNFK8=; b=Ksr9hJa2cyj+Wu49XFQxLICsi3Xb89/7AOALItv1Fxgd/Bfy/q25RXWRXBJzKIlBUM xJT5U7KwiHnPhdu4+ZDi6Qyn7Wz2KvRYAVYoe7dOHbHG2XVJI2ZePHBFHDxyxYVImh0Z ES4QHeLb8ynURXubsx8vKuEyHooyqFvqErxUZCi2fnoSdSdZi20CqThyVGZCOvXa6VLc taPTh6cHI8MiNAE0mApOHcAbVPNEoJRZBosKrcn/sVF+VOy2XjtpgWZ1fYZNIxIDtT76 n4NGmCOlRR5Vmrtudj6Lq5mRYhkcs3xrvaHzYpNEIRGqhwgx5ttcnio/aCQSiiMFN7Yl lXIg== X-Gm-Message-State: ALoCoQm3dJUW4voNlC34Pl1o2R/FdWG6AW3yYkapWgJ9YT6UPOt1fk8z+K08/EXseuIwLRMKv7Um X-Received: by 10.58.173.231 with SMTP id bn7mr1825494vec.21.1402497180370; Wed, 11 Jun 2014 07:33:00 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.83.240 with SMTP id j103ls2612728qgd.47.gmail; Wed, 11 Jun 2014 07:33:00 -0700 (PDT) X-Received: by 10.52.26.165 with SMTP id m5mr364979vdg.93.1402497180249; Wed, 11 Jun 2014 07:33:00 -0700 (PDT) Received: from mail-ve0-f182.google.com (mail-ve0-f182.google.com [209.85.128.182]) by mx.google.com with ESMTPS id xw5si13030172vcb.11.2014.06.11.07.33.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Jun 2014 07:33:00 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.182 as permitted sender) client-ip=209.85.128.182; Received: by mail-ve0-f182.google.com with SMTP id jx11so217649veb.27 for ; Wed, 11 Jun 2014 07:33:00 -0700 (PDT) X-Received: by 10.220.174.137 with SMTP id t9mr39537104vcz.12.1402497180136; Wed, 11 Jun 2014 07:33:00 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.54.6 with SMTP id vs6csp308554vcb; Wed, 11 Jun 2014 07:32:59 -0700 (PDT) X-Received: by 10.224.29.211 with SMTP id r19mr50764337qac.47.1402497179425; Wed, 11 Jun 2014 07:32:59 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id b6si22877043qcm.27.2014.06.11.07.32.59 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 11 Jun 2014 07:32:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:46828 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WujaE-0008Km-UL for patch@linaro.org; Wed, 11 Jun 2014 10:32:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38355) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WujXQ-0004pA-R2 for qemu-devel@nongnu.org; Wed, 11 Jun 2014 10:30:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WujXP-0008JX-Jm for qemu-devel@nongnu.org; Wed, 11 Jun 2014 10:30:04 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:48600) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WujXP-0008DN-D4 for qemu-devel@nongnu.org; Wed, 11 Jun 2014 10:30:03 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1WujXG-00075u-1e; Wed, 11 Jun 2014 15:29:54 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Wed, 11 Jun 2014 15:29:48 +0100 Message-Id: <1402496993-27206-11-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1402496993-27206-1-git-send-email-peter.maydell@linaro.org> References: <1402496993-27206-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Cc: Blue Swirl Subject: [Qemu-devel] [PULL 10/15] bsd-user: Implement strace support for print_sysctl syscall X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Sean Bruno Signed-off-by: Sean Bruno Message-id: 1402246651-71099-4-git-send-email-sbruno@freebsd.org Signed-off-by: Peter Maydell --- bsd-user/freebsd/strace.list | 21 +++++++++++++++++++-- bsd-user/strace.c | 22 ++++++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/bsd-user/freebsd/strace.list b/bsd-user/freebsd/strace.list index 1edf412..3235f16 100644 --- a/bsd-user/freebsd/strace.list +++ b/bsd-user/freebsd/strace.list @@ -1,7 +1,24 @@ -{ TARGET_FREEBSD_NR___getcwd, "__getcwd", NULL, NULL, NULL }, +/* + * FreeBSD strace list + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + { TARGET_FREEBSD_NR___semctl, "__semctl", NULL, NULL, NULL }, { TARGET_FREEBSD_NR___syscall, "__syscall", NULL, NULL, NULL }, -{ TARGET_FREEBSD_NR___sysctl, "__sysctl", NULL, NULL, NULL }, +{ TARGET_FREEBSD_NR___sysctl, "__sysctl", NULL, print_sysctl, NULL }, { TARGET_FREEBSD_NR_accept, "accept", "%s(%d,%#x,%#x)", NULL, NULL }, { TARGET_FREEBSD_NR_access, "access", "%s(\"%s\",%#o)", NULL, NULL }, { TARGET_FREEBSD_NR_acct, "acct", NULL, NULL, NULL }, diff --git a/bsd-user/strace.c b/bsd-user/strace.c index 47e5e76..b2633d0 100644 --- a/bsd-user/strace.c +++ b/bsd-user/strace.c @@ -33,6 +33,28 @@ int do_strace; * Utility functions */ +static void print_sysctl(const struct syscallname *name, abi_long arg1, + abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5, + abi_long arg6) +{ + uint32_t i; + int32_t *namep; + + gemu_log("%s({ ", name->name); + namep = lock_user(VERIFY_READ, arg1, sizeof(int32_t) * arg2, 1); + if (namep) { + int32_t *p = namep; + + for (i = 0; i < (uint32_t)arg2; i++) { + gemu_log("%d ", tswap32(*p++)); + } + unlock_user(namep, arg1, 0); + } + gemu_log("}, %u, 0x" TARGET_ABI_FMT_lx ", 0x" TARGET_ABI_FMT_lx ", 0x" + TARGET_ABI_FMT_lx ", 0x" TARGET_ABI_FMT_lx ")", + (uint32_t)arg2, arg3, arg4, arg5, arg6); +} + static void print_execve(const struct syscallname *name, abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5, abi_long arg6)