Skip to content

Commit

Permalink
bsd-user: Implement strace support for print_ioctl syscall
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Bruno <sbruno@freebsd.org>
Message-id: 1402246651-71099-5-git-send-email-sbruno@freebsd.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
seanbruno authored and pm215 committed Jun 10, 2014
1 parent 80b3460 commit b85159a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bsd-user/freebsd/strace.list
Expand Up @@ -80,7 +80,7 @@
{ TARGET_FREEBSD_NR_getsockopt, "getsockopt", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_gettimeofday, "gettimeofday", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_getuid, "getuid", "%s()", NULL, NULL },
{ TARGET_FREEBSD_NR_ioctl, "ioctl", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_ioctl, "ioctl", NULL, print_ioctl, NULL },
{ TARGET_FREEBSD_NR_issetugid, "issetugid", "%s()", NULL, NULL },
{ TARGET_FREEBSD_NR_kevent, "kevent", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_kill, "kill", NULL, NULL, NULL },
Expand Down
19 changes: 19 additions & 0 deletions bsd-user/strace.c
Expand Up @@ -89,6 +89,25 @@ static void print_execve(const struct syscallname *name, abi_long arg1,
gemu_log("NULL})");
}

static void print_ioctl(const struct syscallname *name,
abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4,
abi_long arg5, abi_long arg6)
{
/* Decode the ioctl request */
gemu_log("%s(%d, 0x%0lx { IO%s%s GRP:0x%x('%c') CMD:%d LEN:%d }, 0x"
TARGET_ABI_FMT_lx ", ...)",
name->name,
(int)arg1,
(unsigned long)arg2,
arg2 & IOC_OUT ? "R" : "",
arg2 & IOC_IN ? "W" : "",
(unsigned)IOCGROUP(arg2),
isprint(IOCGROUP(arg2)) ? (char)IOCGROUP(arg2) : '?',
(int)arg2 & 0xFF,
(int)IOCPARM_LEN(arg2),
arg3);
}

/*
* Variants for the return value output function
*/
Expand Down

0 comments on commit b85159a

Please sign in to comment.