qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Sean Bruno <sbruno@freebsd.org>
To: qemu-devel@nongnu.org
Cc: Sean Bruno <sbruno@freebsd.org>
Subject: [Qemu-devel] [PATCH 03/10 v4] bsd-user: Implement strace support for print_sysctl syscall
Date: Sun,  8 Jun 2014 09:57:24 -0700	[thread overview]
Message-ID: <1402246651-71099-4-git-send-email-sbruno@freebsd.org> (raw)
In-Reply-To: <1402246651-71099-1-git-send-email-sbruno@freebsd.org>

Signed-off-by: Sean Bruno <sbruno@freebsd.org>
---
 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 <http://www.gnu.org/licenses/>.
+ */
+
 { 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)
-- 
1.9.3

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

  parent reply	other threads:[~2014-06-08 16:57 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-08 16:57 [Qemu-devel] [PATCH 00/10 v4] bsd-user: update strace syscalls and breakout BSD distros Sean Bruno
2014-06-08 16:57 ` [Qemu-devel] [PATCH 01/10 v4] bsd-user: add HOST_VARIANT_DIR for various *BSD dependent code Sean Bruno
2014-06-08 16:57 ` [Qemu-devel] [PATCH 02/10 v4] bsd-user: GPL v2 attribution update and style Sean Bruno
2014-06-08 16:57 ` Sean Bruno [this message]
2014-06-08 16:57 ` [Qemu-devel] [PATCH 04/10 v4] bsd-user: Implement strace support for print_ioctl syscall Sean Bruno
2014-06-08 16:57 ` [Qemu-devel] [PATCH 05/10 v4] bsd-user: Implement new syscall print_sysarch and add strace support Sean Bruno
2014-06-10 22:53   ` Peter Maydell
2014-06-11 18:52     ` Sean Bruno
2014-06-15 15:33     ` Sean Bruno
2014-06-15 19:20       ` Peter Maydell
2014-06-15 19:30         ` Sean Bruno
2014-06-08 16:57 ` [Qemu-devel] [PATCH 06/10 v4] bsd-user: Implement strace support for __acl_* syscalls Sean Bruno
2014-06-08 16:57 ` [Qemu-devel] [PATCH 07/10 v4] bsd-user: Implement strace support for extattr_* syscalls Sean Bruno
2014-06-08 16:57 ` [Qemu-devel] [PATCH 08/10 v4] bsd-user: Implement strace support for thr_* syscalls Sean Bruno
2014-06-08 16:57 ` [Qemu-devel] [PATCH 09/10 v4] bsd-user: Fix syscall format, add strace support for more syscalls Sean Bruno
2014-06-08 16:57 ` [Qemu-devel] [PATCH 10/10 v4] bsd-user: Add TARGET_HW_MACHINE TARGET_HW_MACHINE_ARCH for future use Sean Bruno
2014-06-10 23:00   ` Peter Maydell
2014-06-10 23:29 ` [Qemu-devel] [PATCH 00/10 v4] bsd-user: update strace syscalls and breakout BSD distros 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=1402246651-71099-4-git-send-email-sbruno@freebsd.org \
    --to=sbruno@freebsd.org \
    --cc=qemu-devel@nongnu.org \
    /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).