aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-02-20 17:35:42 +0000
committerPeter Maydell <peter.maydell@linaro.org>2020-02-20 17:35:42 +0000
commitb651b80822fa8cb66ca30087ac7fbc75507ae5d2 (patch)
treeb87e86c5cd52fe4c837be8774f41ddc9d6446f58
parent7afee874f1b27abc998b8b747d16b77cb6398716 (diff)
parent045823a98c30fbcafa6d6b61a28b284de7038f07 (diff)
downloadqemu-b651b80822fa8cb66ca30087ac7fbc75507ae5d2.zip
qemu-b651b80822fa8cb66ca30087ac7fbc75507ae5d2.tar.gz
qemu-b651b80822fa8cb66ca30087ac7fbc75507ae5d2.tar.bz2
Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-5.0-pull-request' into staging
Implement membarrier, SO_RCVTIMEO and SO_SNDTIMEO Disable by default build of fdt, slirp and tools with linux-user Improve strace and use qemu_log to send trace to a file Add partial ALSA ioctl supports # gpg: Signature made Thu 20 Feb 2020 09:20:20 GMT # gpg: using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C # gpg: issuer "laurent@vivier.eu" # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full] # gpg: aka "Laurent Vivier <laurent@vivier.eu>" [full] # gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full] # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C * remotes/vivier2/tags/linux-user-for-5.0-pull-request: linux-user: Add support for selected alsa timer instructions using ioctls linux-user: Add support for getting/setting selected alsa timer parameters using ioctls linux-user: Add support for selecting alsa timer using ioctl linux-user: Add support for getting/setting specified alsa timer parameters using ioctls linux-user: Add support for getting alsa timer version and id linux-user: remove gemu_log from the linux-user tree linux-user: Use `qemu_log' for strace linux-user: Use `qemu_log' for non-strace logging configure: Avoid compiling system tools on user build by default linux-user/strace: Improve output of various syscalls configure: linux-user doesn't need neither fdt nor slirp linux-user: implement getsockopt SO_RCVTIMEO and SO_SNDTIMEO linux-user: Implement membarrier syscall Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rwxr-xr-xconfigure22
-rw-r--r--include/qemu/log.h2
-rw-r--r--linux-user/arm/cpu_loop.c5
-rw-r--r--linux-user/fd-trans.c55
-rw-r--r--linux-user/ioctls.h21
-rw-r--r--linux-user/main.c39
-rw-r--r--linux-user/qemu.h2
-rw-r--r--linux-user/signal.c2
-rw-r--r--linux-user/strace.c479
-rw-r--r--linux-user/strace.list52
-rw-r--r--linux-user/syscall.c92
-rw-r--r--linux-user/syscall_defs.h84
-rw-r--r--linux-user/syscall_types.h66
-rw-r--r--linux-user/vm86.c3
-rw-r--r--util/log.c2
15 files changed, 600 insertions, 326 deletions
diff --git a/configure b/configure
index 6f5d850..d57261e 100755
--- a/configure
+++ b/configure
@@ -455,7 +455,7 @@ guest_agent_ntddscsi="no"
guest_agent_msi=""
vss_win32_sdk=""
win_sdk="no"
-want_tools="yes"
+want_tools=""
libiscsi=""
libnfs=""
coroutine=""
@@ -2214,6 +2214,16 @@ else
fi
##########################################
+# system tools
+if test -z "$want_tools"; then
+ if test "$softmmu" = "no"; then
+ want_tools=no
+ else
+ want_tools=yes
+ fi
+fi
+
+##########################################
# cocoa implies not SDL or GTK
# (the cocoa UI code currently assumes it is always the active UI
# and doesn't interact well with other UI frontend code)
@@ -4135,6 +4145,11 @@ elif test "$fdt" != "yes" ; then
fdt=no
fi
+# fdt is only required when building softmmu targets
+if test -z "$fdt" -a "$softmmu" != "yes" ; then
+ fdt="no"
+fi
+
if test "$fdt" != "no" ; then
fdt_libs="-lfdt"
# explicitly check for libfdt_env.h as it is missing in some stable installs
@@ -6078,6 +6093,11 @@ fi
##########################################
# check for slirp
+# slirp is only required when building softmmu targets
+if test -z "$slirp" -a "$softmmu" != "yes" ; then
+ slirp="no"
+fi
+
case "$slirp" in
"" | yes)
if $pkg_config slirp; then
diff --git a/include/qemu/log.h b/include/qemu/log.h
index e0f4e40..f4724f7 100644
--- a/include/qemu/log.h
+++ b/include/qemu/log.h
@@ -62,6 +62,8 @@ static inline bool qemu_log_separate(void)
#define CPU_LOG_TB_OP_IND (1 << 16)
#define CPU_LOG_TB_FPU (1 << 17)
#define CPU_LOG_PLUGIN (1 << 18)
+/* LOG_STRACE is used for user-mode strace logging. */
+#define LOG_STRACE (1 << 19)
/* Lock output for a series of related logs. Since this is not needed
* for a single qemu_log / qemu_log_mask / qemu_log_mask_and_addr, we
diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c
index 1fae90c..cf618da 100644
--- a/linux-user/arm/cpu_loop.c
+++ b/linux-user/arm/cpu_loop.c
@@ -349,8 +349,9 @@ void cpu_loop(CPUARMState *env)
env->regs[0] = cpu_get_tls(env);
break;
default:
- gemu_log("qemu: Unsupported ARM syscall: 0x%x\n",
- n);
+ qemu_log_mask(LOG_UNIMP,
+ "qemu: Unsupported ARM syscall: 0x%x\n",
+ n);
env->regs[0] = -TARGET_ENOSYS;
break;
}
diff --git a/linux-user/fd-trans.c b/linux-user/fd-trans.c
index 9b92386..c0687c5 100644
--- a/linux-user/fd-trans.c
+++ b/linux-user/fd-trans.c
@@ -514,7 +514,8 @@ static abi_long host_to_target_data_bridge_nlattr(struct nlattr *nlattr,
u32[1] = tswap32(u32[1]); /* optmask */
break;
default:
- gemu_log("Unknown QEMU_IFLA_BR type %d\n", nlattr->nla_type);
+ qemu_log_mask(LOG_UNIMP, "Unknown QEMU_IFLA_BR type %d\n",
+ nlattr->nla_type);
break;
}
return 0;
@@ -577,7 +578,8 @@ static abi_long host_to_target_slave_data_bridge_nlattr(struct nlattr *nlattr,
case QEMU_IFLA_BRPORT_BRIDGE_ID:
break;
default:
- gemu_log("Unknown QEMU_IFLA_BRPORT type %d\n", nlattr->nla_type);
+ qemu_log_mask(LOG_UNIMP, "Unknown QEMU_IFLA_BRPORT type %d\n",
+ nlattr->nla_type);
break;
}
return 0;
@@ -605,7 +607,8 @@ static abi_long host_to_target_data_tun_nlattr(struct nlattr *nlattr,
*u32 = tswap32(*u32);
break;
default:
- gemu_log("Unknown QEMU_IFLA_TUN type %d\n", nlattr->nla_type);
+ qemu_log_mask(LOG_UNIMP, "Unknown QEMU_IFLA_TUN type %d\n",
+ nlattr->nla_type);
break;
}
return 0;
@@ -652,7 +655,8 @@ static abi_long host_to_target_data_linkinfo_nlattr(struct nlattr *nlattr,
NULL,
host_to_target_data_tun_nlattr);
} else {
- gemu_log("Unknown QEMU_IFLA_INFO_KIND %s\n", li_context->name);
+ qemu_log_mask(LOG_UNIMP, "Unknown QEMU_IFLA_INFO_KIND %s\n",
+ li_context->name);
}
break;
case QEMU_IFLA_INFO_SLAVE_DATA:
@@ -663,12 +667,13 @@ static abi_long host_to_target_data_linkinfo_nlattr(struct nlattr *nlattr,
NULL,
host_to_target_slave_data_bridge_nlattr);
} else {
- gemu_log("Unknown QEMU_IFLA_INFO_SLAVE_KIND %s\n",
+ qemu_log_mask(LOG_UNIMP, "Unknown QEMU_IFLA_INFO_SLAVE_KIND %s\n",
li_context->slave_name);
}
break;
default:
- gemu_log("Unknown host QEMU_IFLA_INFO type: %d\n", nlattr->nla_type);
+ qemu_log_mask(LOG_UNIMP, "Unknown host QEMU_IFLA_INFO type: %d\n",
+ nlattr->nla_type);
break;
}
@@ -690,7 +695,8 @@ static abi_long host_to_target_data_inet_nlattr(struct nlattr *nlattr,
}
break;
default:
- gemu_log("Unknown host AF_INET type: %d\n", nlattr->nla_type);
+ qemu_log_mask(LOG_UNIMP, "Unknown host AF_INET type: %d\n",
+ nlattr->nla_type);
}
return 0;
}
@@ -741,7 +747,8 @@ static abi_long host_to_target_data_inet6_nlattr(struct nlattr *nlattr,
}
break;
default:
- gemu_log("Unknown host AF_INET6 type: %d\n", nlattr->nla_type);
+ qemu_log_mask(LOG_UNIMP, "Unknown host AF_INET6 type: %d\n",
+ nlattr->nla_type);
}
return 0;
}
@@ -759,7 +766,8 @@ static abi_long host_to_target_data_spec_nlattr(struct nlattr *nlattr,
NULL,
host_to_target_data_inet6_nlattr);
default:
- gemu_log("Unknown host AF_SPEC type: %d\n", nlattr->nla_type);
+ qemu_log_mask(LOG_UNIMP, "Unknown host AF_SPEC type: %d\n",
+ nlattr->nla_type);
break;
}
return 0;
@@ -780,7 +788,8 @@ static abi_long host_to_target_data_xdp_nlattr(struct nlattr *nlattr,
*u32 = tswap32(*u32);
break;
default:
- gemu_log("Unknown host XDP type: %d\n", nlattr->nla_type);
+ qemu_log_mask(
+ LOG_UNIMP, "Unknown host XDP type: %d\n", nlattr->nla_type);
break;
}
return 0;
@@ -920,7 +929,8 @@ static abi_long host_to_target_data_link_rtattr(struct rtattr *rtattr)
NULL,
host_to_target_data_xdp_nlattr);
default:
- gemu_log("Unknown host QEMU_IFLA type: %d\n", rtattr->rta_type);
+ qemu_log_mask(LOG_UNIMP, "Unknown host QEMU_IFLA type: %d\n",
+ rtattr->rta_type);
break;
}
return 0;
@@ -954,7 +964,8 @@ static abi_long host_to_target_data_addr_rtattr(struct rtattr *rtattr)
ci->tstamp = tswap32(ci->tstamp);
break;
default:
- gemu_log("Unknown host IFA type: %d\n", rtattr->rta_type);
+ qemu_log_mask(
+ LOG_UNIMP, "Unknown host IFA type: %d\n", rtattr->rta_type);
break;
}
return 0;
@@ -996,7 +1007,8 @@ static abi_long host_to_target_data_route_rtattr(struct rtattr *rtattr)
#endif
break;
default:
- gemu_log("Unknown host RTA type: %d\n", rtattr->rta_type);
+ qemu_log_mask(
+ LOG_UNIMP, "Unknown host RTA type: %d\n", rtattr->rta_type);
break;
}
return 0;
@@ -1111,7 +1123,8 @@ static abi_long target_to_host_data_link_rtattr(struct rtattr *rtattr)
{
switch (rtattr->rta_type) {
default:
- gemu_log("Unknown target QEMU_IFLA type: %d\n", rtattr->rta_type);
+ qemu_log_mask(LOG_UNIMP, "Unknown target QEMU_IFLA type: %d\n",
+ rtattr->rta_type);
break;
}
return 0;
@@ -1125,7 +1138,8 @@ static abi_long target_to_host_data_addr_rtattr(struct rtattr *rtattr)
case IFA_ADDRESS:
break;
default:
- gemu_log("Unknown target IFA type: %d\n", rtattr->rta_type);
+ qemu_log_mask(LOG_UNIMP, "Unknown target IFA type: %d\n",
+ rtattr->rta_type);
break;
}
return 0;
@@ -1147,7 +1161,8 @@ static abi_long target_to_host_data_route_rtattr(struct rtattr *rtattr)
*u32 = tswap32(*u32);
break;
default:
- gemu_log("Unknown target RTA type: %d\n", rtattr->rta_type);
+ qemu_log_mask(LOG_UNIMP, "Unknown target RTA type: %d\n",
+ rtattr->rta_type);
break;
}
return 0;
@@ -1232,8 +1247,8 @@ static abi_long host_to_target_data_audit(struct nlmsghdr *nlh)
{
switch (nlh->nlmsg_type) {
default:
- gemu_log("Unknown host audit message type %d\n",
- nlh->nlmsg_type);
+ qemu_log_mask(LOG_UNIMP, "Unknown host audit message type %d\n",
+ nlh->nlmsg_type);
return -TARGET_EINVAL;
}
return 0;
@@ -1253,8 +1268,8 @@ static abi_long target_to_host_data_audit(struct nlmsghdr *nlh)
case AUDIT_FIRST_USER_MSG2 ... AUDIT_LAST_USER_MSG2:
break;
default:
- gemu_log("Unknown target audit message type %d\n",
- nlh->nlmsg_type);
+ qemu_log_mask(LOG_UNIMP, "Unknown target audit message type %d\n",
+ nlh->nlmsg_type);
return -TARGET_EINVAL;
}
diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index 73dcc76..0defa1d 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -461,6 +461,27 @@
IOCTL(SOUND_MIXER_WRITE_LOUD, IOC_W, MK_PTR(TYPE_INT))
IOCTL(SOUND_MIXER_WRITE_RECSRC, IOC_W, MK_PTR(TYPE_INT))
+ IOCTL(SNDRV_TIMER_IOCTL_PVERSION, IOC_R, MK_PTR(TYPE_INT))
+ IOCTL(SNDRV_TIMER_IOCTL_NEXT_DEVICE, IOC_RW,
+ MK_PTR(MK_STRUCT(STRUCT_snd_timer_id)))
+ IOCTL(SNDRV_TIMER_IOCTL_GINFO, IOC_RW,
+ MK_PTR(MK_STRUCT(STRUCT_snd_timer_ginfo)))
+ IOCTL(SNDRV_TIMER_IOCTL_GPARAMS, IOC_W,
+ MK_PTR(MK_STRUCT(STRUCT_snd_timer_gparams)))
+ IOCTL(SNDRV_TIMER_IOCTL_GSTATUS, IOC_RW,
+ MK_PTR(MK_STRUCT(STRUCT_snd_timer_gstatus)))
+ IOCTL(SNDRV_TIMER_IOCTL_SELECT, IOC_W,
+ MK_PTR(MK_STRUCT(STRUCT_snd_timer_select)))
+ IOCTL(SNDRV_TIMER_IOCTL_INFO, IOC_R, MK_PTR(MK_STRUCT(STRUCT_snd_timer_info)))
+ IOCTL(SNDRV_TIMER_IOCTL_PARAMS, IOC_W,
+ MK_PTR(MK_STRUCT(STRUCT_snd_timer_params)))
+ IOCTL(SNDRV_TIMER_IOCTL_STATUS, IOC_R,
+ MK_PTR(MK_STRUCT(STRUCT_snd_timer_status)))
+ IOCTL(SNDRV_TIMER_IOCTL_START, 0, TYPE_NULL)
+ IOCTL(SNDRV_TIMER_IOCTL_STOP, 0, TYPE_NULL)
+ IOCTL(SNDRV_TIMER_IOCTL_CONTINUE, 0, TYPE_NULL)
+ IOCTL(SNDRV_TIMER_IOCTL_PAUSE, 0, TYPE_NULL)
+
IOCTL(HDIO_GETGEO, IOC_R, MK_PTR(MK_STRUCT(STRUCT_hd_geometry)))
IOCTL(HDIO_GET_UNMASKINTR, IOC_R, MK_PTR(TYPE_INT))
IOCTL(HDIO_GET_MULTCOUNT, IOC_R, MK_PTR(TYPE_INT))
diff --git a/linux-user/main.c b/linux-user/main.c
index fba833a..22578b1 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -61,6 +61,19 @@ unsigned long guest_base;
int have_guest_base;
/*
+ * Used to implement backwards-compatibility for the `-strace`, and
+ * QEMU_STRACE options. Without this, the QEMU_LOG can be overwritten by
+ * -strace, or vice versa.
+ */
+static bool enable_strace;
+
+/*
+ * The last log mask given by the user in an environment variable or argument.
+ * Used to support command line arguments overriding environment variables.
+ */
+static int last_log_mask;
+
+/*
* When running 32-on-64 we should make sure we can fit all of the possible
* guest address space into a contiguous chunk of virtual host memory.
*
@@ -99,15 +112,6 @@ const char *qemu_uname_release;
by remapping the process stack directly at the right place */
unsigned long guest_stack_size = 8 * 1024 * 1024UL;
-void gemu_log(const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- vfprintf(stderr, fmt, ap);
- va_end(ap);
-}
-
#if defined(TARGET_I386)
int cpu_get_pic_interrupt(CPUX86State *env)
{
@@ -223,15 +227,11 @@ static void handle_arg_help(const char *arg)
static void handle_arg_log(const char *arg)
{
- int mask;
-
- mask = qemu_str_to_log_mask(arg);
- if (!mask) {
+ last_log_mask = qemu_str_to_log_mask(arg);
+ if (!last_log_mask) {
qemu_print_log_usage(stdout);
exit(EXIT_FAILURE);
}
- qemu_log_needs_buffers();
- qemu_set_log(mask);
}
static void handle_arg_dfilter(const char *arg)
@@ -375,7 +375,7 @@ static void handle_arg_singlestep(const char *arg)
static void handle_arg_strace(const char *arg)
{
- do_strace = 1;
+ enable_strace = true;
}
static void handle_arg_version(const char *arg)
@@ -629,6 +629,7 @@ int main(int argc, char **argv, char **envp)
int i;
int ret;
int execfd;
+ int log_mask;
unsigned long max_reserved_va;
error_init(argv[0]);
@@ -661,6 +662,12 @@ int main(int argc, char **argv, char **envp)
optind = parse_args(argc, argv);
+ log_mask = last_log_mask | (enable_strace ? LOG_STRACE : 0);
+ if (log_mask) {
+ qemu_log_needs_buffers();
+ qemu_set_log(log_mask);
+ }
+
if (!trace_init_backends()) {
exit(1);
}
diff --git a/linux-user/qemu.h b/linux-user/qemu.h
index 560a680..792c742 100644
--- a/linux-user/qemu.h
+++ b/linux-user/qemu.h
@@ -211,7 +211,6 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
abi_long arg2, abi_long arg3, abi_long arg4,
abi_long arg5, abi_long arg6, abi_long arg7,
abi_long arg8);
-void gemu_log(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
extern __thread CPUState *thread_cpu;
void cpu_loop(CPUArchState *env);
const char *target_strerror(int err);
@@ -386,7 +385,6 @@ void print_syscall_ret(int num, abi_long arg1);
* --- SIGSEGV {si_signo=SIGSEGV, si_code=SI_KERNEL, si_addr=0} ---
*/
void print_taken_signal(int target_signum, const target_siginfo_t *tinfo);
-extern int do_strace;
/* signal.c */
void process_pending_signals(CPUArchState *cpu_env);
diff --git a/linux-user/signal.c b/linux-user/signal.c
index 94259dd..8cf51ff 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -934,7 +934,7 @@ static void handle_pending_signal(CPUArchState *cpu_env, int sig,
handler = sa->_sa_handler;
}
- if (do_strace) {
+ if (unlikely(qemu_loglevel_mask(LOG_STRACE))) {
print_taken_signal(sig, &k->info);
}
diff --git a/linux-user/strace.c b/linux-user/strace.c
index 3d4d684..4f7130b 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -12,8 +12,6 @@
#include <sched.h>
#include "qemu.h"
-int do_strace=0;
-
struct syscallname {
int nr;
const char *name;
@@ -80,7 +78,7 @@ print_ipc_cmd(int cmd)
{
#define output_cmd(val) \
if( cmd == val ) { \
- gemu_log(#val); \
+ qemu_log(#val); \
return; \
}
@@ -120,7 +118,7 @@ if( cmd == val ) { \
output_cmd( IPC_RMID );
/* Some value we don't recognize */
- gemu_log("%d",cmd);
+ qemu_log("%d", cmd);
}
static void
@@ -151,7 +149,7 @@ print_signal(abi_ulong arg, int last)
print_raw_param("%ld", arg, last);
return;
}
- gemu_log("%s%s", signal_name, get_comma(last));
+ qemu_log("%s%s", signal_name, get_comma(last));
}
static void print_si_code(int arg)
@@ -184,10 +182,10 @@ static void print_si_code(int arg)
codename = "SI_TKILL";
break;
default:
- gemu_log("%d", arg);
+ qemu_log("%d", arg);
return;
}
- gemu_log("%s", codename);
+ qemu_log("%s", codename);
}
static void get_target_siginfo(target_siginfo_t *tinfo,
@@ -288,33 +286,33 @@ static void print_siginfo(const target_siginfo_t *tinfo)
int si_type = extract32(tinfo->si_code, 16, 16);
int si_code = sextract32(tinfo->si_code, 0, 16);
- gemu_log("{si_signo=");
+ qemu_log("{si_signo=");
print_signal(tinfo->si_signo, 1);
- gemu_log(", si_code=");
+ qemu_log(", si_code=");
print_si_code(si_code);
switch (si_type) {
case QEMU_SI_KILL:
- gemu_log(", si_pid=%u, si_uid=%u",
+ qemu_log(", si_pid=%u, si_uid=%u",
(unsigned int)tinfo->_sifields._kill._pid,
(unsigned int)tinfo->_sifields._kill._uid);
break;
case QEMU_SI_TIMER:
- gemu_log(", si_timer1=%u, si_timer2=%u",
+ qemu_log(", si_timer1=%u, si_timer2=%u",
tinfo->_sifields._timer._timer1,
tinfo->_sifields._timer._timer2);
break;
case QEMU_SI_POLL:
- gemu_log(", si_band=%d, si_fd=%d",
+ qemu_log(", si_band=%d, si_fd=%d",
tinfo->_sifields._sigpoll._band,
tinfo->_sifields._sigpoll._fd);
break;
case QEMU_SI_FAULT:
- gemu_log(", si_addr=");
+ qemu_log(", si_addr=");
print_pointer(tinfo->_sifields._sigfault._addr, 1);
break;
case QEMU_SI_CHLD:
- gemu_log(", si_pid=%u, si_uid=%u, si_status=%d"
+ qemu_log(", si_pid=%u, si_uid=%u, si_status=%d"
", si_utime=" TARGET_ABI_FMT_ld
", si_stime=" TARGET_ABI_FMT_ld,
(unsigned int)(tinfo->_sifields._sigchld._pid),
@@ -324,7 +322,7 @@ static void print_siginfo(const target_siginfo_t *tinfo)
tinfo->_sifields._sigchld._stime);
break;
case QEMU_SI_RT:
- gemu_log(", si_pid=%u, si_uid=%u, si_sigval=" TARGET_ABI_FMT_ld,
+ qemu_log(", si_pid=%u, si_uid=%u, si_sigval=" TARGET_ABI_FMT_ld,
(unsigned int)tinfo->_sifields._rt._pid,
(unsigned int)tinfo->_sifields._rt._uid,
tinfo->_sifields._rt._sigval.sival_ptr);
@@ -332,7 +330,7 @@ static void print_siginfo(const target_siginfo_t *tinfo)
default:
g_assert_not_reached();
}
- gemu_log("}");
+ qemu_log("}");
}
static void
@@ -349,76 +347,76 @@ print_sockaddr(abi_ulong addr, abi_long addrlen, int last)
case AF_UNIX: {
struct target_sockaddr_un *un = (struct target_sockaddr_un *)sa;
int i;
- gemu_log("{sun_family=AF_UNIX,sun_path=\"");
+ qemu_log("{sun_family=AF_UNIX,sun_path=\"");
for (i = 0; i < addrlen -
offsetof(struct target_sockaddr_un, sun_path) &&
un->sun_path[i]; i++) {
- gemu_log("%c", un->sun_path[i]);
+ qemu_log("%c", un->sun_path[i]);
}
- gemu_log("\"}");
+ qemu_log("\"}");
break;
}
case AF_INET: {
struct target_sockaddr_in *in = (struct target_sockaddr_in *)sa;
uint8_t *c = (uint8_t *)&in->sin_addr.s_addr;
- gemu_log("{sin_family=AF_INET,sin_port=htons(%d),",
+ qemu_log("{sin_family=AF_INET,sin_port=htons(%d),",
ntohs(in->sin_port));
- gemu_log("sin_addr=inet_addr(\"%d.%d.%d.%d\")",
+ qemu_log("sin_addr=inet_addr(\"%d.%d.%d.%d\")",
c[0], c[1], c[2], c[3]);
- gemu_log("}");
+ qemu_log("}");
break;
}
case AF_PACKET: {
struct target_sockaddr_ll *ll = (struct target_sockaddr_ll *)sa;
uint8_t *c = (uint8_t *)&ll->sll_addr;
- gemu_log("{sll_family=AF_PACKET,"
+ qemu_log("{sll_family=AF_PACKET,"
"sll_protocol=htons(0x%04x),if%d,pkttype=",
ntohs(ll->sll_protocol), ll->sll_ifindex);
switch (ll->sll_pkttype) {
case PACKET_HOST:
- gemu_log("PACKET_HOST");
+ qemu_log("PACKET_HOST");
break;
case PACKET_BROADCAST:
- gemu_log("PACKET_BROADCAST");
+ qemu_log("PACKET_BROADCAST");
break;
case PACKET_MULTICAST:
- gemu_log("PACKET_MULTICAST");
+ qemu_log("PACKET_MULTICAST");
break;
case PACKET_OTHERHOST:
- gemu_log("PACKET_OTHERHOST");
+ qemu_log("PACKET_OTHERHOST");
break;
case PACKET_OUTGOING:
- gemu_log("PACKET_OUTGOING");
+ qemu_log("PACKET_OUTGOING");
break;
default:
- gemu_log("%d", ll->sll_pkttype);
+ qemu_log("%d", ll->sll_pkttype);
break;
}
- gemu_log(",sll_addr=%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
+ qemu_log(",sll_addr=%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7]);
- gemu_log("}");
+ qemu_log("}");
break;
}
case AF_NETLINK: {
struct target_sockaddr_nl *nl = (struct target_sockaddr_nl *)sa;
- gemu_log("{nl_family=AF_NETLINK,nl_pid=%u,nl_groups=%u}",
+ qemu_log("{nl_family=AF_NETLINK,nl_pid=%u,nl_groups=%u}",
tswap32(nl->nl_pid), tswap32(nl->nl_groups));
break;
}
default:
- gemu_log("{sa_family=%d, sa_data={", sa->sa_family);
+ qemu_log("{sa_family=%d, sa_data={", sa->sa_family);
for (i = 0; i < 13; i++) {
- gemu_log("%02x, ", sa->sa_data[i]);
+ qemu_log("%02x, ", sa->sa_data[i]);
}
- gemu_log("%02x}", sa->sa_data[i]);
- gemu_log("}");
+ qemu_log("%02x}", sa->sa_data[i]);
+ qemu_log("}");
break;
}
unlock_user(sa, addr, 0);
} else {
print_raw_param("0x"TARGET_ABI_FMT_lx, addr, 0);
}
- gemu_log(", "TARGET_ABI_FMT_ld"%s", addrlen, get_comma(last));
+ qemu_log(", "TARGET_ABI_FMT_ld"%s", addrlen, get_comma(last));
}
static void
@@ -426,19 +424,19 @@ print_socket_domain(int domain)
{
switch (domain) {
case PF_UNIX:
- gemu_log("PF_UNIX");
+ qemu_log("PF_UNIX");
break;
case PF_INET:
- gemu_log("PF_INET");
+ qemu_log("PF_INET");
break;
case PF_NETLINK:
- gemu_log("PF_NETLINK");
+ qemu_log("PF_NETLINK");
break;
case PF_PACKET:
- gemu_log("PF_PACKET");
+ qemu_log("PF_PACKET");
break;
default:
- gemu_log("%d", domain);
+ qemu_log("%d", domain);
break;
}
}
@@ -448,22 +446,22 @@ print_socket_type(int type)
{
switch (type) {
case TARGET_SOCK_DGRAM:
- gemu_log("SOCK_DGRAM");
+ qemu_log("SOCK_DGRAM");
break;
case TARGET_SOCK_STREAM:
- gemu_log("SOCK_STREAM");
+ qemu_log("SOCK_STREAM");
break;
case TARGET_SOCK_RAW:
- gemu_log("SOCK_RAW");
+ qemu_log("SOCK_RAW");
break;
case TARGET_SOCK_RDM:
- gemu_log("SOCK_RDM");
+ qemu_log("SOCK_RDM");
break;
case TARGET_SOCK_SEQPACKET:
- gemu_log("SOCK_SEQPACKET");
+ qemu_log("SOCK_SEQPACKET");
break;
case TARGET_SOCK_PACKET:
- gemu_log("SOCK_PACKET");
+ qemu_log("SOCK_PACKET");
break;
}
}
@@ -475,10 +473,10 @@ print_socket_protocol(int domain, int type, int protocol)
(domain == AF_INET && type == TARGET_SOCK_PACKET)) {
switch (protocol) {
case 0x0003:
- gemu_log("ETH_P_ALL");
+ qemu_log("ETH_P_ALL");
break;
default:
- gemu_log("%d", protocol);
+ qemu_log("%d", protocol);
}
return;
}
@@ -486,25 +484,25 @@ print_socket_protocol(int domain, int type, int protocol)
if (domain == PF_NETLINK) {
switch (protocol) {
case NETLINK_ROUTE:
- gemu_log("NETLINK_ROUTE");
+ qemu_log("NETLINK_ROUTE");
break;
case NETLINK_AUDIT:
- gemu_log("NETLINK_AUDIT");
+ qemu_log("NETLINK_AUDIT");
break;
case NETLINK_NETFILTER:
- gemu_log("NETLINK_NETFILTER");
+ qemu_log("NETLINK_NETFILTER");
break;
case NETLINK_KOBJECT_UEVENT:
- gemu_log("NETLINK_KOBJECT_UEVENT");
+ qemu_log("NETLINK_KOBJECT_UEVENT");
break;
case NETLINK_RDMA:
- gemu_log("NETLINK_RDMA");
+ qemu_log("NETLINK_RDMA");
break;
case NETLINK_CRYPTO:
- gemu_log("NETLINK_CRYPTO");
+ qemu_log("NETLINK_CRYPTO");
break;
default:
- gemu_log("%d", protocol);
+ qemu_log("%d", protocol);
break;
}
return;
@@ -512,19 +510,19 @@ print_socket_protocol(int domain, int type, int protocol)
switch (protocol) {
case IPPROTO_IP:
- gemu_log("IPPROTO_IP");
+ qemu_log("IPPROTO_IP");
break;
case IPPROTO_TCP:
- gemu_log("IPPROTO_TCP");
+ qemu_log("IPPROTO_TCP");
break;
case IPPROTO_UDP:
- gemu_log("IPPROTO_UDP");
+ qemu_log("IPPROTO_UDP");
break;
case IPPROTO_RAW:
- gemu_log("IPPROTO_RAW");
+ qemu_log("IPPROTO_RAW");
break;
default:
- gemu_log("%d", protocol);
+ qemu_log("%d", protocol);
break;
}
}
@@ -536,7 +534,7 @@ print_fdset(int n, abi_ulong target_fds_addr)
{
int i;
- gemu_log("[");
+ qemu_log("[");
if( target_fds_addr ) {
abi_long *target_fds;
@@ -550,11 +548,11 @@ print_fdset(int n, abi_ulong target_fds_addr)
for (i=n; i>=0; i--) {
if ((tswapal(target_fds[i / TARGET_ABI_BITS]) >> (i & (TARGET_ABI_BITS - 1))) & 1)
- gemu_log("%d,", i );
+ qemu_log("%d,", i);
}
unlock_user(target_fds, target_fds_addr, 0);
}
- gemu_log("]");
+ qemu_log("]");
}
#endif
@@ -578,46 +576,46 @@ print_clockid(int clockid, int last)
{
switch (clockid) {
case TARGET_CLOCK_REALTIME:
- gemu_log("CLOCK_REALTIME");
+ qemu_log("CLOCK_REALTIME");
break;
case TARGET_CLOCK_MONOTONIC:
- gemu_log("CLOCK_MONOTONIC");
+ qemu_log("CLOCK_MONOTONIC");
break;
case TARGET_CLOCK_PROCESS_CPUTIME_ID:
- gemu_log("CLOCK_PROCESS_CPUTIME_ID");
+ qemu_log("CLOCK_PROCESS_CPUTIME_ID");
break;
case TARGET_CLOCK_THREAD_CPUTIME_ID:
- gemu_log("CLOCK_THREAD_CPUTIME_ID");
+ qemu_log("CLOCK_THREAD_CPUTIME_ID");
break;
case TARGET_CLOCK_MONOTONIC_RAW:
- gemu_log("CLOCK_MONOTONIC_RAW");
+ qemu_log("CLOCK_MONOTONIC_RAW");
break;
case TARGET_CLOCK_REALTIME_COARSE:
- gemu_log("CLOCK_REALTIME_COARSE");
+ qemu_log("CLOCK_REALTIME_COARSE");
break;
case TARGET_CLOCK_MONOTONIC_COARSE:
- gemu_log("CLOCK_MONOTONIC_COARSE");
+ qemu_log("CLOCK_MONOTONIC_COARSE");
break;
case TARGET_CLOCK_BOOTTIME:
- gemu_log("CLOCK_BOOTTIME");
+ qemu_log("CLOCK_BOOTTIME");
break;
case TARGET_CLOCK_REALTIME_ALARM:
- gemu_log("CLOCK_REALTIME_ALARM");
+ qemu_log("CLOCK_REALTIME_ALARM");
break;
case TARGET_CLOCK_BOOTTIME_ALARM:
- gemu_log("CLOCK_BOOTTIME_ALARM");
+ qemu_log("CLOCK_BOOTTIME_ALARM");
break;
case TARGET_CLOCK_SGI_CYCLE:
- gemu_log("CLOCK_SGI_CYCLE");
+ qemu_log("CLOCK_SGI_CYCLE");
break;
case TARGET_CLOCK_TAI:
- gemu_log("CLOCK_TAI");
+ qemu_log("CLOCK_TAI");
break;
default:
- gemu_log("%d", clockid);
+ qemu_log("%d", clockid);
break;
}
- gemu_log("%s", get_comma(last));
+ qemu_log("%s", get_comma(last));
}
#endif
@@ -638,15 +636,15 @@ print_newselect(const struct syscallname *name,
abi_long arg1, abi_long arg2, abi_long arg3,
abi_long arg4, abi_long arg5, abi_long arg6)
{
- gemu_log("%s(" TARGET_ABI_FMT_ld ",", name->name, arg1);
+ qemu_log("%s(" TARGET_ABI_FMT_ld ",", name->name, arg1);
print_fdset(arg1, arg2);
- gemu_log(",");
+ qemu_log(",");
print_fdset(arg1, arg3);
- gemu_log(",");
+ qemu_log(",");
print_fdset(arg1, arg4);
- gemu_log(",");
+ qemu_log(",");
print_timeval(arg5, 1);
- gemu_log(")");
+ qemu_log(")");
/* save for use in the return output function below */
newselect_arg1=arg1;
@@ -663,9 +661,10 @@ print_semctl(const struct syscallname *name,
abi_long arg1, abi_long arg2, abi_long arg3,
abi_long arg4, abi_long arg5, abi_long arg6)
{
- gemu_log("%s(" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld ",", name->name, arg1, arg2);
+ qemu_log("%s(" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld ",",
+ name->name, arg1, arg2);
print_ipc_cmd(arg3);
- gemu_log(",0x" TARGET_ABI_FMT_lx ")", arg4);
+ qemu_log(",0x" TARGET_ABI_FMT_lx ")", arg4);
}
#endif
@@ -679,7 +678,7 @@ print_execve(const struct syscallname *name,
if (!(s = lock_user_string(arg1)))
return;
- gemu_log("%s(\"%s\",{", name->name, s);
+ qemu_log("%s(\"%s\",{", name->name, s);
unlock_user(s, arg1, 0);
for (arg_ptr_addr = arg2; ; arg_ptr_addr += sizeof(abi_ulong)) {
@@ -693,12 +692,12 @@ print_execve(const struct syscallname *name,
if (!arg_addr)
break;
if ((s = lock_user_string(arg_addr))) {
- gemu_log("\"%s\",", s);
+ qemu_log("\"%s\",", s);
unlock_user(s, arg_addr, 0);
}
}
- gemu_log("NULL})");
+ qemu_log("NULL})");
}
#ifdef TARGET_NR_ipc
@@ -709,12 +708,18 @@ print_ipc(const struct syscallname *name,
{
switch(arg1) {
case IPCOP_semctl:
- gemu_log("semctl(" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld ",", arg1, arg2);
+ qemu_log("semctl(" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld ",",
+ arg1, arg2);
print_ipc_cmd(arg3);
- gemu_log(",0x" TARGET_ABI_FMT_lx ")", arg4);
+ qemu_log(",0x" TARGET_ABI_FMT_lx ")", arg4);
break;
default:
- gemu_log("%s(" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld ")",
+ qemu_log(("%s("
+ TARGET_ABI_FMT_ld ","
+ TARGET_ABI_FMT_ld ","
+ TARGET_ABI_FMT_ld ","
+ TARGET_ABI_FMT_ld
+ ")"),
name->name, arg1, arg2, arg3, arg4);
}
}
@@ -733,9 +738,9 @@ print_syscall_ret_addr(const struct syscallname *name, abi_long ret)
errstr = target_strerror(-ret);
}
if (errstr) {
- gemu_log(" = -1 errno=%d (%s)\n", (int)-ret, errstr);
+ qemu_log(" = -1 errno=%d (%s)\n", (int)-ret, errstr);
} else {
- gemu_log(" = 0x" TARGET_ABI_FMT_lx "\n", ret);
+ qemu_log(" = 0x" TARGET_ABI_FMT_lx "\n", ret);
}
}
@@ -743,7 +748,7 @@ print_syscall_ret_addr(const struct syscallname *name, abi_long ret)
static void
print_syscall_ret_raw(struct syscallname *name, abi_long ret)
{
- gemu_log(" = 0x" TARGET_ABI_FMT_lx "\n", ret);
+ qemu_log(" = 0x" TARGET_ABI_FMT_lx "\n", ret);
}
#endif
@@ -751,15 +756,15 @@ print_syscall_ret_raw(struct syscallname *name, abi_long ret)
static void
print_syscall_ret_newselect(const struct syscallname *name, abi_long ret)
{
- gemu_log(" = 0x" TARGET_ABI_FMT_lx " (", ret);
+ qemu_log(" = 0x" TARGET_ABI_FMT_lx " (", ret);
print_fdset(newselect_arg1,newselect_arg2);
- gemu_log(",");
+ qemu_log(",");
print_fdset(newselect_arg1,newselect_arg3);
- gemu_log(",");
+ qemu_log(",");
print_fdset(newselect_arg1,newselect_arg4);
- gemu_log(",");
+ qemu_log(",");
print_timeval(newselect_arg5, 1);
- gemu_log(")\n");
+ qemu_log(")\n");
}
#endif
@@ -775,38 +780,38 @@ print_syscall_ret_adjtimex(const struct syscallname *name, abi_long ret)
{
const char *errstr = NULL;
- gemu_log(" = ");
+ qemu_log(" = ");
if (ret < 0) {
- gemu_log("-1 errno=%d", errno);
+ qemu_log("-1 errno=%d", errno);
errstr = target_strerror(-ret);
if (errstr) {
- gemu_log(" (%s)", errstr);
+ qemu_log(" (%s)", errstr);
}
} else {
- gemu_log(TARGET_ABI_FMT_ld, ret);
+ qemu_log(TARGET_ABI_FMT_ld, ret);
switch (ret) {
case TARGET_TIME_OK:
- gemu_log(" TIME_OK (clock synchronized, no leap second)");
+ qemu_log(" TIME_OK (clock synchronized, no leap second)");
break;
case TARGET_TIME_INS:
- gemu_log(" TIME_INS (insert leap second)");
+ qemu_log(" TIME_INS (insert leap second)");
break;
case TARGET_TIME_DEL:
- gemu_log(" TIME_DEL (delete leap second)");
+ qemu_log(" TIME_DEL (delete leap second)");
break;
case TARGET_TIME_OOP:
- gemu_log(" TIME_OOP (leap second in progress)");
+ qemu_log(" TIME_OOP (leap second in progress)");
break;
case TARGET_TIME_WAIT:
- gemu_log(" TIME_WAIT (leap second has occurred)");
+ qemu_log(" TIME_WAIT (leap second has occurred)");
break;
case TARGET_TIME_ERROR:
- gemu_log(" TIME_ERROR (clock not synchronized)");
+ qemu_log(" TIME_ERROR (clock not synchronized)");
break;
}
}
- gemu_log("\n");
+ qemu_log("\n");
}
UNUSED static struct flags access_flags[] = {
@@ -1104,12 +1109,12 @@ print_flags(const struct flags *f, abi_long flags, int last)
int n;
if ((flags == 0) && (f->f_value == 0)) {
- gemu_log("%s%s", f->f_string, get_comma(last));
+ qemu_log("%s%s", f->f_string, get_comma(last));
return;
}
for (n = 0; f->f_string != NULL; f++) {
if ((f->f_value != 0) && ((flags & f->f_value) == f->f_value)) {
- gemu_log("%s%s", sep, f->f_string);
+ qemu_log("%s%s", sep, f->f_string);
flags &= ~f->f_value;
sep = "|";
n++;
@@ -1119,13 +1124,13 @@ print_flags(const struct flags *f, abi_long flags, int last)
if (n > 0) {
/* print rest of the flags as numeric */
if (flags != 0) {
- gemu_log("%s%#x%s", sep, (unsigned int)flags, get_comma(last));
+ qemu_log("%s%#x%s", sep, (unsigned int)flags, get_comma(last));
} else {
- gemu_log("%s", get_comma(last));
+ qemu_log("%s", get_comma(last));
}
} else {
/* no string version of flags found, print them in hex then */
- gemu_log("%#x%s", (unsigned int)flags, get_comma(last));
+ qemu_log("%#x%s", (unsigned int)flags, get_comma(last));
}
}
@@ -1134,11 +1139,11 @@ print_at_dirfd(abi_long dirfd, int last)
{
#ifdef AT_FDCWD
if (dirfd == AT_FDCWD) {
- gemu_log("AT_FDCWD%s", get_comma(last));
+ qemu_log("AT_FDCWD%s", get_comma(last));
return;
}
#endif
- gemu_log("%d%s", (int)dirfd, get_comma(last));
+ qemu_log("%d%s", (int)dirfd, get_comma(last));
}
static void
@@ -1149,7 +1154,7 @@ print_file_mode(abi_long mode, int last)
for (m = &mode_flags[0]; m->f_string != NULL; m++) {
if ((m->f_value & mode) == m->f_value) {
- gemu_log("%s%s", m->f_string, sep);
+ qemu_log("%s%s", m->f_string, sep);
sep = "|";
mode &= ~m->f_value;
break;
@@ -1159,9 +1164,9 @@ print_file_mode(abi_long mode, int last)
mode &= ~S_IFMT;
/* print rest of the mode as octal */
if (mode != 0)
- gemu_log("%s%#o", sep, (unsigned int)mode);
+ qemu_log("%s%#o", sep, (unsigned int)mode);
- gemu_log("%s", get_comma(last));
+ qemu_log("%s", get_comma(last));
}
static void
@@ -1170,17 +1175,17 @@ print_open_flags(abi_long flags, int last)
print_flags(open_access_flags, flags & TARGET_O_ACCMODE, 1);
flags &= ~TARGET_O_ACCMODE;
if (flags == 0) {
- gemu_log("%s", get_comma(last));
+ qemu_log("%s", get_comma(last));
return;
}
- gemu_log("|");
+ qemu_log("|");
print_flags(open_flags, flags, last);
}
static void
print_syscall_prologue(const struct syscallname *sc)
{
- gemu_log("%s(", sc->name);
+ qemu_log("%s(", sc->name);
}
/*ARGSUSED*/
@@ -1188,7 +1193,7 @@ static void
print_syscall_epilogue(const struct syscallname *sc)
{
(void)sc;
- gemu_log(")");
+ qemu_log(")");
}
static void
@@ -1197,7 +1202,7 @@ print_string(abi_long addr, int last)
char *s;
if ((s = lock_user_string(addr)) != NULL) {
- gemu_log("\"%s\"%s", s, get_comma(last));
+ qemu_log("\"%s\"%s", s, get_comma(last));
unlock_user(s, addr, 0);
} else {
/* can't get string out of it, so print it as pointer */
@@ -1214,20 +1219,20 @@ print_buf(abi_long addr, abi_long len, int last)
s = lock_user(VERIFY_READ, addr, len, 1);
if (s) {
- gemu_log("\"");
+ qemu_log("\"");
for (i = 0; i < MAX_PRINT_BUF && i < len; i++) {
if (isprint(s[i])) {
- gemu_log("%c", s[i]);
+ qemu_log("%c", s[i]);
} else {
- gemu_log("\\%o", s[i]);
+ qemu_log("\\%o", s[i]);
}
}
- gemu_log("\"");
+ qemu_log("\"");
if (i != len) {
- gemu_log("...");
+ qemu_log("...");
}
if (!last) {
- gemu_log(",");
+ qemu_log(",");
}
unlock_user(s, addr, 0);
} else {
@@ -1245,16 +1250,16 @@ print_raw_param(const char *fmt, abi_long param, int last)
char format[64];
(void) snprintf(format, sizeof (format), "%s%s", fmt, get_comma(last));
- gemu_log(format, param);
+ qemu_log(format, param);
}
static void
print_pointer(abi_long p, int last)
{
if (p == 0)
- gemu_log("NULL%s", get_comma(last));
+ qemu_log("NULL%s", get_comma(last));
else
- gemu_log("0x" TARGET_ABI_FMT_lx "%s", p, get_comma(last));
+ qemu_log("0x" TARGET_ABI_FMT_lx "%s", p, get_comma(last));
}
/*
@@ -1265,12 +1270,12 @@ static void
print_number(abi_long addr, int last)
{
if (addr == 0) {
- gemu_log("NULL%s", get_comma(last));
+ qemu_log("NULL%s", get_comma(last));
} else {
int num;
get_user_s32(num, addr);
- gemu_log("[%d]%s", num, get_comma(last));
+ qemu_log("[%d]%s", num, get_comma(last));
}
}
@@ -1285,11 +1290,11 @@ print_timeval(abi_ulong tv_addr, int last)
print_pointer(tv_addr, last);
return;
}
- gemu_log("{" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "}%s",
+ qemu_log("{" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "}%s",
tswapal(tv->tv_sec), tswapal(tv->tv_usec), get_comma(last));
unlock_user(tv, tv_addr, 0);
} else
- gemu_log("NULL%s", get_comma(last));
+ qemu_log("NULL%s", get_comma(last));
}
static void
@@ -1303,11 +1308,11 @@ print_timezone(abi_ulong tz_addr, int last)
print_pointer(tz_addr, last);
return;
}
- gemu_log("{%d,%d}%s", tswap32(tz->tz_minuteswest),
+ qemu_log("{%d,%d}%s", tswap32(tz->tz_minuteswest),
tswap32(tz->tz_dsttime), get_comma(last));
unlock_user(tz, tz_addr, 0);
} else {
- gemu_log("NULL%s", get_comma(last));
+ qemu_log("NULL%s", get_comma(last));
}
}
@@ -1515,83 +1520,83 @@ print_fcntl(const struct syscallname *name,
print_raw_param("%d", arg0, 0);
switch(arg1) {
case TARGET_F_DUPFD:
- gemu_log("F_DUPFD,");
+ qemu_log("F_DUPFD,");
print_raw_param(TARGET_ABI_FMT_ld, arg2, 1);
break;
case TARGET_F_GETFD:
- gemu_log("F_GETFD");
+ qemu_log("F_GETFD");
break;
case TARGET_F_SETFD:
- gemu_log("F_SETFD,");
+ qemu_log("F_SETFD,");
print_raw_param(TARGET_ABI_FMT_ld, arg2, 1);
break;
case TARGET_F_GETFL:
- gemu_log("F_GETFL");
+ qemu_log("F_GETFL");
break;
case TARGET_F_SETFL:
- gemu_log("F_SETFL,");
+ qemu_log("F_SETFL,");
print_open_flags(arg2, 1);
break;
case TARGET_F_GETLK:
- gemu_log("F_GETLK,");
+ qemu_log("F_GETLK,");
print_pointer(arg2, 1);
break;
case TARGET_F_SETLK:
- gemu_log("F_SETLK,");
+ qemu_log("F_SETLK,");
print_pointer(arg2, 1);
break;
case TARGET_F_SETLKW:
- gemu_log("F_SETLKW,");
+ qemu_log("F_SETLKW,");
print_pointer(arg2, 1);
break;
case TARGET_F_GETOWN:
- gemu_log("F_GETOWN");
+ qemu_log("F_GETOWN");
break;
case TARGET_F_SETOWN:
- gemu_log("F_SETOWN,");
+ qemu_log("F_SETOWN,");
print_raw_param(TARGET_ABI_FMT_ld, arg2, 0);
break;
case TARGET_F_GETSIG:
- gemu_log("F_GETSIG");
+ qemu_log("F_GETSIG");
break;
case TARGET_F_SETSIG:
- gemu_log("F_SETSIG,");
+ qemu_log("F_SETSIG,");
print_raw_param(TARGET_ABI_FMT_ld, arg2, 0);
break;
#if TARGET_ABI_BITS == 32
case TARGET_F_GETLK64:
- gemu_log("F_GETLK64,");
+ qemu_log("F_GETLK64,");
print_pointer(arg2, 1);
break;
case TARGET_F_SETLK64:
- gemu_log("F_SETLK64,");
+ qemu_log("F_SETLK64,");
print_pointer(arg2, 1);
break;
case TARGET_F_SETLKW64:
- gemu_log("F_SETLKW64,");
+ qemu_log("F_SETLKW64,");
print_pointer(arg2, 1);
break;
#endif
case TARGET_F_SETLEASE:
- gemu_log("F_SETLEASE,");
+ qemu_log("F_SETLEASE,");
print_raw_param(TARGET_ABI_FMT_ld, arg2, 0);
break;
case TARGET_F_GETLEASE:
- gemu_log("F_GETLEASE");
+ qemu_log("F_GETLEASE");
break;
case TARGET_F_SETPIPE_SZ:
- gemu_log("F_SETPIPE_SZ,");
+ qemu_log("F_SETPIPE_SZ,");
print_raw_param(TARGET_ABI_FMT_ld, arg2, 1);
break;
case TARGET_F_GETPIPE_SZ:
- gemu_log("F_GETPIPE_SZ");
+ qemu_log("F_GETPIPE_SZ");
break;
case TARGET_F_DUPFD_CLOEXEC:
- gemu_log("F_DUPFD_CLOEXEC,");
+ qemu_log("F_DUPFD_CLOEXEC,");
print_raw_param(TARGET_ABI_FMT_ld, arg2, 1);
break;
case TARGET_F_NOTIFY:
- gemu_log("F_NOTIFY,");
+ qemu_log("F_NOTIFY,");
print_raw_param(TARGET_ABI_FMT_ld, arg2, 0);
break;
default:
@@ -1679,7 +1684,7 @@ print__llseek(const struct syscallname *name,
case SEEK_CUR: whence = "SEEK_CUR"; break;
case SEEK_END: whence = "SEEK_END"; break;
}
- gemu_log("%s",whence);
+ qemu_log("%s", whence);
print_syscall_epilogue(name);
}
#endif
@@ -1694,9 +1699,9 @@ print_socket(const struct syscallname *name,
print_syscall_prologue(name);
print_socket_domain(domain);
- gemu_log(",");
+ qemu_log(",");
print_socket_type(type);
- gemu_log(",");
+ qemu_log(",");
if (domain == AF_PACKET ||
(domain == AF_INET && type == TARGET_SOCK_PACKET)) {
protocol = tswap16(protocol);
@@ -1728,17 +1733,17 @@ static void do_print_socket(const char *name, abi_long arg1)
get_user_ualx(domain, arg1, 0);
get_user_ualx(type, arg1, 1);
get_user_ualx(protocol, arg1, 2);
- gemu_log("%s(", name);
+ qemu_log("%s(", name);
print_socket_domain(domain);
- gemu_log(",");
+ qemu_log(",");
print_socket_type(type);
- gemu_log(",");
+ qemu_log(",");
if (domain == AF_PACKET ||
(domain == AF_INET && type == TARGET_SOCK_PACKET)) {
protocol = tswap16(protocol);
}
print_socket_protocol(domain, type, protocol);
- gemu_log(")");
+ qemu_log(")");
}
static void do_print_sockaddr(const char *name, abi_long arg1)
@@ -1749,10 +1754,10 @@ static void do_print_sockaddr(const char *name, abi_long arg1)
get_user_ualx(addr, arg1, 1);
get_user_ualx(addrlen, arg1, 2);
- gemu_log("%s(", name);
+ qemu_log("%s(", name);
print_sockfd(sockfd, 0);
print_sockaddr(addr, addrlen, 0);
- gemu_log(")");
+ qemu_log(")");
}
static void do_print_listen(const char *name, abi_long arg1)
@@ -1762,10 +1767,10 @@ static void do_print_listen(const char *name, abi_long arg1)
get_user_ualx(sockfd, arg1, 0);
get_user_ualx(backlog, arg1, 1);
- gemu_log("%s(", name);
+ qemu_log("%s(", name);
print_sockfd(sockfd, 0);
print_raw_param(TARGET_ABI_FMT_ld, backlog, 1);
- gemu_log(")");
+ qemu_log(")");
}
static void do_print_socketpair(const char *name, abi_long arg1)
@@ -1777,15 +1782,15 @@ static void do_print_socketpair(const char *name, abi_long arg1)
get_user_ualx(protocol, arg1, 2);
get_user_ualx(tab, arg1, 3);
- gemu_log("%s(", name);
+ qemu_log("%s(", name);
print_socket_domain(domain);
- gemu_log(",");
+ qemu_log(",");
print_socket_type(type);
- gemu_log(",");
+ qemu_log(",");
print_socket_protocol(domain, type, protocol);
- gemu_log(",");
+ qemu_log(",");
print_raw_param(TARGET_ABI_FMT_lx, tab, 1);
- gemu_log(")");
+ qemu_log(")");
}
static void do_print_sendrecv(const char *name, abi_long arg1)
@@ -1797,12 +1802,12 @@ static void do_print_sendrecv(const char *name, abi_long arg1)
get_user_ualx(len, arg1, 2);
get_user_ualx(flags, arg1, 3);
- gemu_log("%s(", name);
+ qemu_log("%s(", name);
print_sockfd(sockfd, 0);
print_buf(msg, len, 0);
print_raw_param(TARGET_ABI_FMT_ld, len, 0);
print_flags(msg_flags, flags, 1);
- gemu_log(")");
+ qemu_log(")");
}
static void do_print_msgaddr(const char *name, abi_long arg1)
@@ -1816,13 +1821,13 @@ static void do_print_msgaddr(const char *name, abi_long arg1)
get_user_ualx(addr, arg1, 4);
get_user_ualx(addrlen, arg1, 5);
- gemu_log("%s(", name);
+ qemu_log("%s(", name);
print_sockfd(sockfd, 0);
print_buf(msg, len, 0);
print_raw_param(TARGET_ABI_FMT_ld, len, 0);
print_flags(msg_flags, flags, 0);
print_sockaddr(addr, addrlen, 0);
- gemu_log(")");
+ qemu_log(")");
}
static void do_print_shutdown(const char *name, abi_long arg1)
@@ -1832,23 +1837,23 @@ static void do_print_shutdown(const char *name, abi_long arg1)
get_user_ualx(sockfd, arg1, 0);
get_user_ualx(how, arg1, 1);
- gemu_log("shutdown(");
+ qemu_log("shutdown(");
print_sockfd(sockfd, 0);
switch (how) {
case SHUT_RD:
- gemu_log("SHUT_RD");
+ qemu_log("SHUT_RD");
break;
case SHUT_WR:
- gemu_log("SHUT_WR");
+ qemu_log("SHUT_WR");
break;
case SHUT_RDWR:
- gemu_log("SHUT_RDWR");
+ qemu_log("SHUT_RDWR");
break;
default:
print_raw_param(TARGET_ABI_FMT_ld, how, 1);
break;
}
- gemu_log(")");
+ qemu_log(")");
}
static void do_print_msg(const char *name, abi_long arg1)
@@ -1859,11 +1864,11 @@ static void do_print_msg(const char *name, abi_long arg1)
get_user_ualx(msg, arg1, 1);
get_user_ualx(flags, arg1, 2);
- gemu_log("%s(", name);
+ qemu_log("%s(", name);
print_sockfd(sockfd, 0);
print_pointer(msg, 0);
print_flags(msg_flags, flags, 1);
- gemu_log(")");
+ qemu_log(")");
}
static void do_print_sockopt(const char *name, abi_long arg1)
@@ -1876,113 +1881,113 @@ static void do_print_sockopt(const char *name, abi_long arg1)
get_user_ualx(optval, arg1, 3);
get_user_ualx(optlen, arg1, 4);
- gemu_log("%s(", name);
+ qemu_log("%s(", name);
print_sockfd(sockfd, 0);
switch (level) {
case SOL_TCP:
- gemu_log("SOL_TCP,");
+ qemu_log("SOL_TCP,");
print_raw_param(TARGET_ABI_FMT_ld, optname, 0);
print_pointer(optval, 0);
break;
case SOL_IP:
- gemu_log("SOL_IP,");
+ qemu_log("SOL_IP,");
print_raw_param(TARGET_ABI_FMT_ld, optname, 0);
print_pointer(optval, 0);
break;
case SOL_RAW:
- gemu_log("SOL_RAW,");
+ qemu_log("SOL_RAW,");
print_raw_param(TARGET_ABI_FMT_ld, optname, 0);
print_pointer(optval, 0);
break;
case TARGET_SOL_SOCKET:
- gemu_log("SOL_SOCKET,");
+ qemu_log("SOL_SOCKET,");
switch (optname) {
case TARGET_SO_DEBUG:
- gemu_log("SO_DEBUG,");
+ qemu_log("SO_DEBUG,");
print_optint:
print_number(optval, 0);
break;
case TARGET_SO_REUSEADDR:
- gemu_log("SO_REUSEADDR,");
+ qemu_log("SO_REUSEADDR,");
goto print_optint;
case TARGET_SO_REUSEPORT:
- gemu_log("SO_REUSEPORT,");
+ qemu_log("SO_REUSEPORT,");
goto print_optint;
case TARGET_SO_TYPE:
- gemu_log("SO_TYPE,");
+ qemu_log("SO_TYPE,");
goto print_optint;
case TARGET_SO_ERROR:
- gemu_log("SO_ERROR,");
+ qemu_log("SO_ERROR,");
goto print_optint;
case TARGET_SO_DONTROUTE:
- gemu_log("SO_DONTROUTE,");
+ qemu_log("SO_DONTROUTE,");
goto print_optint;
case TARGET_SO_BROADCAST:
- gemu_log("SO_BROADCAST,");
+ qemu_log("SO_BROADCAST,");
goto print_optint;
case TARGET_SO_SNDBUF:
- gemu_log("SO_SNDBUF,");
+ qemu_log("SO_SNDBUF,");
goto print_optint;
case TARGET_SO_RCVBUF:
- gemu_log("SO_RCVBUF,");
+ qemu_log("SO_RCVBUF,");
goto print_optint;
case TARGET_SO_KEEPALIVE:
- gemu_log("SO_KEEPALIVE,");
+ qemu_log("SO_KEEPALIVE,");
goto print_optint;
case TARGET_SO_OOBINLINE:
- gemu_log("SO_OOBINLINE,");
+ qemu_log("SO_OOBINLINE,");
goto print_optint;
case TARGET_SO_NO_CHECK:
- gemu_log("SO_NO_CHECK,");
+ qemu_log("SO_NO_CHECK,");
goto print_optint;
case TARGET_SO_PRIORITY:
- gemu_log("SO_PRIORITY,");
+ qemu_log("SO_PRIORITY,");
goto print_optint;
case TARGET_SO_BSDCOMPAT:
- gemu_log("SO_BSDCOMPAT,");
+ qemu_log("SO_BSDCOMPAT,");
goto print_optint;
case TARGET_SO_PASSCRED:
- gemu_log("SO_PASSCRED,");
+ qemu_log("SO_PASSCRED,");
goto print_optint;
case TARGET_SO_TIMESTAMP:
- gemu_log("SO_TIMESTAMP,");
+ qemu_log("SO_TIMESTAMP,");
goto print_optint;
case TARGET_SO_RCVLOWAT:
- gemu_log("SO_RCVLOWAT,");
+ qemu_log("SO_RCVLOWAT,");
goto print_optint;
case TARGET_SO_RCVTIMEO:
- gemu_log("SO_RCVTIMEO,");
+ qemu_log("SO_RCVTIMEO,");
print_timeval(optval, 0);
break;
case TARGET_SO_SNDTIMEO:
- gemu_log("SO_SNDTIMEO,");
+ qemu_log("SO_SNDTIMEO,");
print_timeval(optval, 0);
break;
case TARGET_SO_ATTACH_FILTER: {
struct target_sock_fprog *fprog;
- gemu_log("SO_ATTACH_FILTER,");
+ qemu_log("SO_ATTACH_FILTER,");
if (lock_user_struct(VERIFY_READ, fprog, optval, 0)) {
struct target_sock_filter *filter;
- gemu_log("{");
+ qemu_log("{");
if (lock_user_struct(VERIFY_READ, filter,
tswapal(fprog->filter), 0)) {
int i;
for (i = 0; i < tswap16(fprog->len) - 1; i++) {
- gemu_log("[%d]{0x%x,%d,%d,0x%x},",
+ qemu_log("[%d]{0x%x,%d,%d,0x%x},",
i, tswap16(filter[i].code),
filter[i].jt, filter[i].jf,
tswap32(filter[i].k));
}
- gemu_log("[%d]{0x%x,%d,%d,0x%x}",
+ qemu_log("[%d]{0x%x,%d,%d,0x%x}",
i, tswap16(filter[i].code),
filter[i].jt, filter[i].jf,
tswap32(filter[i].k));
} else {
- gemu_log(TARGET_ABI_FMT_lx, tswapal(fprog->filter));
+ qemu_log(TARGET_ABI_FMT_lx, tswapal(fprog->filter));
}
- gemu_log(",%d},", tswap16(fprog->len));
+ qemu_log(",%d},", tswap16(fprog->len));
unlock_user(fprog, optval, 0);
} else {
print_pointer(optval, 0);
@@ -2002,7 +2007,7 @@ print_optint:
break;
}
print_raw_param(TARGET_ABI_FMT_ld, optlen, 1);
- gemu_log(")");
+ qemu_log(")");
}
#define PRINT_SOCKOP(name, func) \
@@ -2164,7 +2169,7 @@ print_rt_sigprocmask(const struct syscallname *name,
case TARGET_SIG_UNBLOCK: how = "SIG_UNBLOCK"; break;
case TARGET_SIG_SETMASK: how = "SIG_SETMASK"; break;
}
- gemu_log("%s,",how);
+ qemu_log("%s,", how);
print_pointer(arg1, 0);
print_pointer(arg2, 1);
print_syscall_epilogue(name);
@@ -2278,7 +2283,7 @@ print_syslog_action(abi_ulong arg, int last)
return;
}
}
- gemu_log("%s%s", type, get_comma(last));
+ qemu_log("%s%s", type, get_comma(last));
}
static void
@@ -2683,20 +2688,20 @@ static void print_futex_op(abi_long tflag, int last)
{
#define print_op(val) \
if( cmd == val ) { \
- gemu_log(#val); \
+ qemu_log(#val); \
return; \
}
int cmd = (int)tflag;
#ifdef FUTEX_PRIVATE_FLAG
if (cmd & FUTEX_PRIVATE_FLAG) {
- gemu_log("FUTEX_PRIVATE_FLAG|");
+ qemu_log("FUTEX_PRIVATE_FLAG|");
cmd &= ~FUTEX_PRIVATE_FLAG;
}
#endif
#ifdef FUTEX_CLOCK_REALTIME
if (cmd & FUTEX_CLOCK_REALTIME) {
- gemu_log("FUTEX_CLOCK_REALTIME|");
+ qemu_log("FUTEX_CLOCK_REALTIME|");
cmd &= ~FUTEX_CLOCK_REALTIME;
}
#endif
@@ -2716,7 +2721,7 @@ if( cmd == val ) { \
print_op(FUTEX_WAKE_BITSET)
#endif
/* unknown values */
- gemu_log("%d",cmd);
+ qemu_log("%d", cmd);
}
static void
@@ -2812,22 +2817,24 @@ print_syscall(int num,
int i;
const char *format="%s(" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld ")";
- gemu_log("%d ", getpid() );
+ qemu_log("%d ", getpid());
for(i=0;i<nsyscalls;i++)
if( scnames[i].nr == num ) {
if( scnames[i].call != NULL ) {
- scnames[i].call(&scnames[i],arg1,arg2,arg3,arg4,arg5,arg6);
+ scnames[i].call(
+ &scnames[i], arg1, arg2, arg3, arg4, arg5, arg6);
} else {
/* XXX: this format system is broken because it uses
host types and host pointers for strings */
if( scnames[i].format != NULL )
format = scnames[i].format;
- gemu_log(format,scnames[i].name, arg1,arg2,arg3,arg4,arg5,arg6);
+ qemu_log(format,
+ scnames[i].name, arg1, arg2, arg3, arg4, arg5, arg6);
}
return;
}
- gemu_log("Unknown syscall %d\n", num);
+ qemu_log("Unknown syscall %d\n", num);
}
@@ -2840,16 +2847,16 @@ print_syscall_ret(int num, abi_long ret)
for(i=0;i<nsyscalls;i++)
if( scnames[i].nr == num ) {
if( scnames[i].result != NULL ) {
- scnames[i].result(&scnames[i],ret);
+ scnames[i].result(&scnames[i], ret);
} else {
if (ret < 0) {
errstr = target_strerror(-ret);
}
if (errstr) {
- gemu_log(" = -1 errno=" TARGET_ABI_FMT_ld " (%s)\n",
+ qemu_log(" = -1 errno=" TARGET_ABI_FMT_ld " (%s)\n",
-ret, errstr);
} else {
- gemu_log(" = " TARGET_ABI_FMT_ld "\n", ret);
+ qemu_log(" = " TARGET_ABI_FMT_ld "\n", ret);
}
}
break;
@@ -2861,9 +2868,9 @@ void print_taken_signal(int target_signum, const target_siginfo_t *tinfo)
/* Print the strace output for a signal being taken:
* --- SIGSEGV {si_signo=SIGSEGV, si_code=SI_KERNEL, si_addr=0} ---
*/
- gemu_log("--- ");
+ qemu_log("--- ");
print_signal(target_signum, 1);
- gemu_log(" ");
+ qemu_log(" ");
print_siginfo(tinfo);
- gemu_log(" ---\n");
+ qemu_log(" ---\n");
}
diff --git a/linux-user/strace.list b/linux-user/strace.list
index 1de4319..d49a1e9 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -26,7 +26,7 @@
{ TARGET_NR_afs_syscall, "afs_syscall" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_alarm
-{ TARGET_NR_alarm, "alarm" , NULL, NULL, NULL },
+{ TARGET_NR_alarm, "alarm" , "%s(%u)", NULL, NULL },
#endif
#ifdef TARGET_NR_aplib
{ TARGET_NR_aplib, "aplib" , NULL, NULL, NULL },
@@ -116,19 +116,19 @@
{ TARGET_NR_dipc, "dipc" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_dup
-{ TARGET_NR_dup, "dup" , NULL, NULL, NULL },
+{ TARGET_NR_dup, "dup" , "%s(%d)", NULL, NULL },
#endif
#ifdef TARGET_NR_dup2
-{ TARGET_NR_dup2, "dup2" , NULL, NULL, NULL },
+{ TARGET_NR_dup2, "dup2" , "%s(%d,%d)", NULL, NULL },
#endif
#ifdef TARGET_NR_dup3
-{ TARGET_NR_dup3, "dup3" , NULL, NULL, NULL },
+{ TARGET_NR_dup3, "dup3" , "%s(%d,%d,%d)", NULL, NULL },
#endif
#ifdef TARGET_NR_epoll_create
-{ TARGET_NR_epoll_create, "epoll_create" , NULL, NULL, NULL },
+{ TARGET_NR_epoll_create, "%s(%d)", NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_epoll_create1
-{ TARGET_NR_epoll_create1, "epoll_create1" , NULL, NULL, NULL },
+{ TARGET_NR_epoll_create1, "%s(%d)", NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_epoll_ctl
{ TARGET_NR_epoll_ctl, "epoll_ctl" , NULL, NULL, NULL },
@@ -146,10 +146,10 @@
{ TARGET_NR_epoll_wait_old, "epoll_wait_old" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_eventfd
-{ TARGET_NR_eventfd, "eventfd" , NULL, NULL, NULL },
+{ TARGET_NR_eventfd, "eventfd", "%s(%d)", NULL, NULL },
#endif
#ifdef TARGET_NR_eventfd2
-{ TARGET_NR_eventfd2, "eventfd2" , NULL, NULL, NULL },
+{ TARGET_NR_eventfd2, "eventfd2" , "%s(%d,%d)", NULL, NULL },
#endif
#ifdef TARGET_NR_execv
{ TARGET_NR_execv, "execv" , NULL, print_execv, NULL },
@@ -191,7 +191,7 @@
{ TARGET_NR_fanotify_mark, "fanotify_mark" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_fchdir
-{ TARGET_NR_fchdir, "fchdir" , NULL, NULL, NULL },
+{ TARGET_NR_fchdir, "fchdir" , "%s(%d)", NULL, NULL },
#endif
#ifdef TARGET_NR_fchmod
{ TARGET_NR_fchmod, "fchmod" , "%s(%d,%#o)", NULL, NULL },
@@ -287,7 +287,7 @@
{ TARGET_NR_getdtablesize, "getdtablesize" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_getegid
-{ TARGET_NR_getegid, "getegid" , NULL, NULL, NULL },
+{ TARGET_NR_getegid, "getegid" , "%s()", NULL, NULL },
#endif
#ifdef TARGET_NR_getegid32
{ TARGET_NR_getegid32, "getegid32" , NULL, NULL, NULL },
@@ -299,7 +299,7 @@
{ TARGET_NR_geteuid32, "geteuid32" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_getgid
-{ TARGET_NR_getgid, "getgid" , NULL, NULL, NULL },
+{ TARGET_NR_getgid, "getgid" , "%s()", NULL, NULL },
#endif
#ifdef TARGET_NR_getgid32
{ TARGET_NR_getgid32, "getgid32" , NULL, NULL, NULL },
@@ -329,10 +329,10 @@
{ TARGET_NR_getpeername, "getpeername" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_getpgid
-{ TARGET_NR_getpgid, "getpgid" , NULL, NULL, NULL },
+{ TARGET_NR_getpgid, "getpgid" , "%s(%u)", NULL, NULL },
#endif
#ifdef TARGET_NR_getpgrp
-{ TARGET_NR_getpgrp, "getpgrp" , NULL, NULL, NULL },
+{ TARGET_NR_getpgrp, "getpgrp" , "%s()", NULL, NULL },
#endif
#ifdef TARGET_NR_getpid
{ TARGET_NR_getpid, "getpid" , "%s()", NULL, NULL },
@@ -432,7 +432,7 @@
{ TARGET_NR_io_cancel, "io_cancel" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_ioctl
-{ TARGET_NR_ioctl, "ioctl" , NULL, NULL, NULL },
+{ TARGET_NR_ioctl, "ioctl" , "%s(%d,%#x,%#x)", NULL, NULL },
#endif
#ifdef TARGET_NR_io_destroy
{ TARGET_NR_io_destroy, "io_destroy" , NULL, NULL, NULL },
@@ -1257,22 +1257,22 @@
{ TARGET_NR_setdomainname, "setdomainname" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_setfsgid
-{ TARGET_NR_setfsgid, "setfsgid" , NULL, NULL, NULL },
+{ TARGET_NR_setfsgid, "setfsgid" , "%s(%u)", NULL, NULL },
#endif
#ifdef TARGET_NR_setfsgid32
-{ TARGET_NR_setfsgid32, "setfsgid32" , NULL, NULL, NULL },
+{ TARGET_NR_setfsgid32, "setfsgid32" , "%s(%u)" , NULL, NULL },
#endif
#ifdef TARGET_NR_setfsuid
-{ TARGET_NR_setfsuid, "setfsuid" , NULL, NULL, NULL },
+{ TARGET_NR_setfsuid, "setfsuid" , "%s(%u)" , NULL, NULL },
#endif
#ifdef TARGET_NR_setfsuid32
{ TARGET_NR_setfsuid32, "setfsuid32" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_setgid
-{ TARGET_NR_setgid, "setgid" , NULL, NULL, NULL },
+{ TARGET_NR_setgid, "setgid" , "%s(%u)", NULL, NULL },
#endif
#ifdef TARGET_NR_setgid32
-{ TARGET_NR_setgid32, "setgid32" , NULL, NULL, NULL },
+{ TARGET_NR_setgid32, "setgid32" , "%s(%u)", NULL, NULL },
#endif
#ifdef TARGET_NR_setgroups
{ TARGET_NR_setgroups, "setgroups" , NULL, NULL, NULL },
@@ -1296,7 +1296,7 @@
{ TARGET_NR_setns, "setns" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_setpgid
-{ TARGET_NR_setpgid, "setpgid" , NULL, NULL, NULL },
+{ TARGET_NR_setpgid, "setpgid" , "%s(%u,%u)", NULL, NULL },
#endif
#ifdef TARGET_NR_setpgrp
{ TARGET_NR_setpgrp, "setpgrp" , NULL, NULL, NULL },
@@ -1311,22 +1311,22 @@
{ TARGET_NR_setregid32, "setregid32" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_setresgid
-{ TARGET_NR_setresgid, "setresgid" , NULL, NULL, NULL },
+{ TARGET_NR_setresgid, "setresgid" , "%s(%u,%u,%u)", NULL, NULL },
#endif
#ifdef TARGET_NR_setresgid32
{ TARGET_NR_setresgid32, "setresgid32" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_setresuid
-{ TARGET_NR_setresuid, "setresuid" , NULL, NULL, NULL },
+{ TARGET_NR_setresuid, "setresuid" , "%s(%u,%u,%u)", NULL, NULL },
#endif
#ifdef TARGET_NR_setresuid32
-{ TARGET_NR_setresuid32, "setresuid32" , NULL, NULL, NULL },
+{ TARGET_NR_setresuid32, "setresuid32" , "%s(%u,%u,%u)", NULL, NULL },
#endif
#ifdef TARGET_NR_setreuid
-{ TARGET_NR_setreuid, "setreuid" , NULL, NULL, NULL },
+{ TARGET_NR_setreuid, "setreuid" , "%s(%u,%u)", NULL, NULL },
#endif
#ifdef TARGET_NR_setreuid32
-{ TARGET_NR_setreuid32, "setreuid32" , NULL, NULL, NULL },
+{ TARGET_NR_setreuid32, "setreuid32" , "%s(%u,%u)", NULL, NULL },
#endif
#ifdef TARGET_NR_setrlimit
{ TARGET_NR_setrlimit, "setrlimit" , NULL, NULL, NULL },
@@ -1335,7 +1335,7 @@
{ TARGET_NR_set_robust_list, "set_robust_list" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_setsid
-{ TARGET_NR_setsid, "setsid" , NULL, NULL, NULL },
+{ TARGET_NR_setsid, "setsid" , "%s()", NULL, NULL },
#endif
#ifdef TARGET_NR_setsockopt
{ TARGET_NR_setsockopt, "setsockopt" , NULL, NULL, NULL },
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index c930577..8d27d10 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -111,6 +111,7 @@
#include <linux/netlink.h>
#include <linux/if_alg.h>
#include <linux/rtc.h>
+#include <sound/asound.h>
#include "linux_loop.h"
#include "uname.h"
@@ -334,6 +335,9 @@ _syscall5(int, kcmp, pid_t, pid1, pid_t, pid2, int, type,
_syscall5(int, sys_statx, int, dirfd, const char *, pathname, int, flags,
unsigned int, mask, struct target_statx *, statxbuf)
#endif
+#if defined(TARGET_NR_membarrier) && defined(__NR_membarrier)
+_syscall2(int, membarrier, int, cmd, int, flags)
+#endif
static bitmask_transtbl fcntl_flags_tbl[] = {
{ TARGET_O_ACCMODE, TARGET_O_WRONLY, O_ACCMODE, O_WRONLY, },
@@ -1560,7 +1564,11 @@ static inline abi_long target_to_host_cmsg(struct msghdr *msgh,
* something more intelligent than "twice the size of the
* target buffer we're reading from".
*/
- gemu_log("Host cmsg overflow\n");
+ qemu_log_mask(LOG_UNIMP,
+ ("Unsupported ancillary data %d/%d: "
+ "unhandled msg size\n"),
+ tswap32(target_cmsg->cmsg_level),
+ tswap32(target_cmsg->cmsg_type));
break;
}
@@ -1590,8 +1598,8 @@ static inline abi_long target_to_host_cmsg(struct msghdr *msgh,
__get_user(cred->uid, &target_cred->uid);
__get_user(cred->gid, &target_cred->gid);
} else {
- gemu_log("Unsupported ancillary data: %d/%d\n",
- cmsg->cmsg_level, cmsg->cmsg_type);
+ qemu_log_mask(LOG_UNIMP, "Unsupported ancillary data: %d/%d\n",
+ cmsg->cmsg_level, cmsg->cmsg_type);
memcpy(data, target_data, len);
}
@@ -1812,8 +1820,8 @@ static inline abi_long host_to_target_cmsg(struct target_msghdr *target_msgh,
default:
unimplemented:
- gemu_log("Unsupported ancillary data: %d/%d\n",
- cmsg->cmsg_level, cmsg->cmsg_type);
+ qemu_log_mask(LOG_UNIMP, "Unsupported ancillary data: %d/%d\n",
+ cmsg->cmsg_level, cmsg->cmsg_type);
memcpy(target_data, data, MIN(len, tgt_len));
if (tgt_len > len) {
memset(target_data + len, 0, tgt_len - len);
@@ -2288,7 +2296,8 @@ set_timeout:
#endif /* SOL_NETLINK */
default:
unimplemented:
- gemu_log("Unsupported setsockopt level=%d optname=%d\n", level, optname);
+ qemu_log_mask(LOG_UNIMP, "Unsupported setsockopt level=%d optname=%d\n",
+ level, optname);
ret = -TARGET_ENOPROTOOPT;
}
return ret;
@@ -2307,10 +2316,42 @@ static abi_long do_getsockopt(int sockfd, int level, int optname,
level = SOL_SOCKET;
switch (optname) {
/* These don't just return a single integer */
- case TARGET_SO_RCVTIMEO:
- case TARGET_SO_SNDTIMEO:
case TARGET_SO_PEERNAME:
goto unimplemented;
+ case TARGET_SO_RCVTIMEO: {
+ struct timeval tv;
+ socklen_t tvlen;
+
+ optname = SO_RCVTIMEO;
+
+get_timeout:
+ if (get_user_u32(len, optlen)) {
+ return -TARGET_EFAULT;
+ }
+ if (len < 0) {
+ return -TARGET_EINVAL;
+ }
+
+ tvlen = sizeof(tv);
+ ret = get_errno(getsockopt(sockfd, level, optname,
+ &tv, &tvlen));
+ if (ret < 0) {
+ return ret;
+ }
+ if (len > sizeof(struct target_timeval)) {
+ len = sizeof(struct target_timeval);
+ }
+ if (copy_to_user_timeval(optval_addr, &tv)) {
+ return -TARGET_EFAULT;
+ }
+ if (put_user_u32(len, optlen)) {
+ return -TARGET_EFAULT;
+ }
+ break;
+ }
+ case TARGET_SO_SNDTIMEO:
+ optname = SO_SNDTIMEO;
+ goto get_timeout;
case TARGET_SO_PEERCRED: {
struct ucred cr;
socklen_t crlen;
@@ -2663,8 +2704,9 @@ static abi_long do_getsockopt(int sockfd, int level, int optname,
#endif /* SOL_NETLINK */
default:
unimplemented:
- gemu_log("getsockopt level=%d optname=%d not yet supported\n",
- level, optname);
+ qemu_log_mask(LOG_UNIMP,
+ "getsockopt level=%d optname=%d not yet supported\n",
+ level, optname);
ret = -TARGET_EOPNOTSUPP;
break;
}
@@ -3419,7 +3461,7 @@ static abi_long do_socketcall(int num, abi_ulong vptr)
case TARGET_SYS_SENDMMSG: /* sockfd, msgvec, vlen, flags */
return do_sendrecvmmsg(a[0], a[1], a[2], a[3], 1);
default:
- gemu_log("Unsupported socketcall: %d\n", num);
+ qemu_log_mask(LOG_UNIMP, "Unsupported socketcall: %d\n", num);
return -TARGET_EINVAL;
}
}
@@ -4330,7 +4372,8 @@ static abi_long do_ipc(CPUArchState *cpu_env,
ret = do_shmctl(first, second, ptr);
break;
default:
- gemu_log("Unsupported ipc call: %d (version %d)\n", call, version);
+ qemu_log_mask(LOG_UNIMP, "Unsupported ipc call: %d (version %d)\n",
+ call, version);
ret = -TARGET_ENOSYS;
break;
}
@@ -5178,7 +5221,8 @@ static abi_long do_ioctl(int fd, int cmd, abi_long arg)
ie = ioctl_entries;
for(;;) {
if (ie->target_cmd == 0) {
- gemu_log("Unsupported ioctl: cmd=0x%04lx\n", (long)cmd);
+ qemu_log_mask(
+ LOG_UNIMP, "Unsupported ioctl: cmd=0x%04lx\n", (long)cmd);
return -TARGET_ENOSYS;
}
if (ie->target_cmd == cmd)
@@ -5246,8 +5290,9 @@ static abi_long do_ioctl(int fd, int cmd, abi_long arg)
}
break;
default:
- gemu_log("Unsupported ioctl type: cmd=0x%04lx type=%d\n",
- (long)cmd, arg_type[0]);
+ qemu_log_mask(LOG_UNIMP,
+ "Unsupported ioctl type: cmd=0x%04lx type=%d\n",
+ (long)cmd, arg_type[0]);
ret = -TARGET_ENOSYS;
break;
}
@@ -12090,6 +12135,10 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
unlock_user(p, arg1, 0);
return ret;
#endif
+#if defined TARGET_NR_membarrier && defined __NR_membarrier
+ case TARGET_NR_membarrier:
+ return get_errno(membarrier(arg1, arg2));
+#endif
default:
qemu_log_mask(LOG_UNIMP, "Unsupported syscall: %d\n", num);
@@ -12123,14 +12172,15 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
record_syscall_start(cpu, num, arg1,
arg2, arg3, arg4, arg5, arg6, arg7, arg8);
- if (unlikely(do_strace)) {
+ if (unlikely(qemu_loglevel_mask(LOG_STRACE))) {
print_syscall(num, arg1, arg2, arg3, arg4, arg5, arg6);
- ret = do_syscall1(cpu_env, num, arg1, arg2, arg3, arg4,
- arg5, arg6, arg7, arg8);
+ }
+
+ ret = do_syscall1(cpu_env, num, arg1, arg2, arg3, arg4,
+ arg5, arg6, arg7, arg8);
+
+ if (unlikely(qemu_loglevel_mask(LOG_STRACE))) {
print_syscall_ret(num, ret);
- } else {
- ret = do_syscall1(cpu_env, num, arg1, arg2, arg3, arg4,
- arg5, arg6, arg7, arg8);
}
record_syscall_return(cpu, num, ret);
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 9b61ae8..152ec63 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2437,6 +2437,90 @@ struct target_statfs64 {
#define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC)
+struct target_snd_timer_id {
+ int dev_class;
+ int dev_sclass;
+ int card;
+ int device;
+ int subdevice;
+};
+
+struct target_snd_timer_ginfo {
+ struct target_snd_timer_id tid;
+ unsigned int flags;
+ int card;
+ unsigned char id[64];
+ unsigned char name[80];
+ abi_ulong reserved0;
+ abi_ulong resolution;
+ abi_ulong resolution_min;
+ abi_ulong resolution_max;
+ unsigned int clients;
+ unsigned char reserved[32];
+};
+
+struct target_snd_timer_gparams {
+ struct target_snd_timer_id tid;
+ abi_ulong period_num;
+ abi_ulong period_den;
+ unsigned char reserved[32];
+};
+
+struct target_snd_timer_gstatus {
+ struct target_snd_timer_id tid;
+ abi_ulong resolution;
+ abi_ulong resolution_num;
+ abi_ulong resolution_den;
+ unsigned char reserved[32];
+};
+
+struct target_snd_timer_select {
+ struct target_snd_timer_id id;
+ unsigned char reserved[32];
+};
+
+struct target_snd_timer_info {
+ unsigned int flags;
+ int card;
+ unsigned char id[64];
+ unsigned char name[80];
+ abi_ulong reserved0;
+ abi_ulong resolution;
+ unsigned char reserved[64];
+};
+
+struct target_snd_timer_status {
+ struct target_timespec tstamp;
+ unsigned int resolution;
+ unsigned int lost;
+ unsigned int overrun;
+ unsigned int queue;
+ unsigned char reserved[64];
+};
+
+/* alsa timer ioctls */
+#define TARGET_SNDRV_TIMER_IOCTL_PVERSION TARGET_IOR('T', 0x00, int)
+#define TARGET_SNDRV_TIMER_IOCTL_NEXT_DEVICE TARGET_IOWR('T', 0x01, \
+ struct snd_timer_id)
+#define TARGET_SNDRV_TIMER_IOCTL_GINFO TARGET_IOWR('T', 0x03, \
+ struct target_snd_timer_ginfo)
+#define TARGET_SNDRV_TIMER_IOCTL_GPARAMS TARGET_IOW('T', 0x04, \
+ struct target_snd_timer_gparams)
+#define TARGET_SNDRV_TIMER_IOCTL_GSTATUS TARGET_IOWR('T', 0x05, \
+ struct target_snd_timer_gstatus)
+#define TARGET_SNDRV_TIMER_IOCTL_SELECT TARGET_IOW('T', 0x10, \
+ struct target_snd_timer_select)
+#define TARGET_SNDRV_TIMER_IOCTL_INFO TARGET_IOR('T', 0x11, \
+ struct target_snd_timer_info)
+#define TARGET_SNDRV_TIMER_IOCTL_PARAMS TARGET_IOW('T', 0x12, \
+ struct snd_timer_params)
+#define TARGET_SNDRV_TIMER_IOCTL_STATUS TARGET_IOR('T', 0x14, \
+ struct target_snd_timer_status)
+#define TARGET_SNDRV_TIMER_IOCTL_START TARGET_IO('T', 0xa0)
+#define TARGET_SNDRV_TIMER_IOCTL_STOP TARGET_IO('T', 0xa1)
+#define TARGET_SNDRV_TIMER_IOCTL_CONTINUE TARGET_IO('T', 0xa2)
+#define TARGET_SNDRV_TIMER_IOCTL_PAUSE TARGET_IO('T', 0xa3)
+
/* vfat ioctls */
#define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1)
#define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2)
diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
index 5ba4155..4e12c16 100644
--- a/linux-user/syscall_types.h
+++ b/linux-user/syscall_types.h
@@ -83,6 +83,72 @@ STRUCT(buffmem_desc,
STRUCT(mixer_info,
MK_ARRAY(TYPE_CHAR, 16), MK_ARRAY(TYPE_CHAR, 32), TYPE_INT, MK_ARRAY(TYPE_INT, 10))
+STRUCT(snd_timer_id,
+ TYPE_INT, /* dev_class */
+ TYPE_INT, /* dev_sclass */
+ TYPE_INT, /* card */
+ TYPE_INT, /* device */
+ TYPE_INT) /* subdevice */
+
+STRUCT(snd_timer_ginfo,
+ MK_STRUCT(STRUCT_snd_timer_id), /* tid */
+ TYPE_INT, /* flags */
+ TYPE_INT, /* card */
+ MK_ARRAY(TYPE_CHAR, 64), /* id */
+ MK_ARRAY(TYPE_CHAR, 80), /* name */
+ TYPE_ULONG, /* reserved0 */
+ TYPE_ULONG, /* resolution */
+ TYPE_ULONG, /* resolution_min */
+ TYPE_ULONG, /* resolution_max */
+ TYPE_INT, /* clients */
+ MK_ARRAY(TYPE_CHAR, 32)) /* reserved */
+
+STRUCT(snd_timer_gparams,
+ MK_STRUCT(STRUCT_snd_timer_id), /* tid */
+ TYPE_ULONG, /* period_num */
+ TYPE_ULONG, /* period_den */
+ MK_ARRAY(TYPE_CHAR, 32)) /* reserved */
+
+STRUCT(snd_timer_gstatus,
+ MK_STRUCT(STRUCT_snd_timer_id), /* tid */
+ TYPE_ULONG, /* resolution */
+ TYPE_ULONG, /* resolution_num */
+ TYPE_ULONG, /* resolution_den */
+ MK_ARRAY(TYPE_CHAR, 32)) /* reserved */
+
+STRUCT(snd_timer_select,
+ MK_STRUCT(STRUCT_snd_timer_id), /* id */
+ MK_ARRAY(TYPE_CHAR, 32)) /* reserved */
+
+STRUCT(snd_timer_info,
+ TYPE_INT, /* flags */
+ TYPE_INT, /* card */
+ MK_ARRAY(TYPE_CHAR, 64), /* id */
+ MK_ARRAY(TYPE_CHAR, 80), /* name */
+ TYPE_ULONG, /* reserved0 */
+ TYPE_ULONG, /* resolution */
+ MK_ARRAY(TYPE_CHAR, 64)) /* reserved */
+
+STRUCT(snd_timer_params,
+ TYPE_INT, /* flags */
+ TYPE_INT, /* ticks */
+ TYPE_INT, /* queue_size */
+ TYPE_INT, /* reserved0 */
+ TYPE_INT, /* filter */
+ MK_ARRAY(TYPE_CHAR, 60)) /* reserved */
+
+STRUCT(timespec,
+ TYPE_LONG, /* tv_sec */
+ TYPE_LONG) /* tv_nsec */
+
+STRUCT(snd_timer_status,
+ MK_STRUCT(STRUCT_timespec), /* tstamp */
+ TYPE_INT, /* resolution */
+ TYPE_INT, /* lost */
+ TYPE_INT, /* overrun */
+ TYPE_INT, /* queue */
+ MK_ARRAY(TYPE_CHAR, 64)) /* reserved */
+
/* loop device ioctls */
STRUCT(loop_info,
TYPE_INT, /* lo_number */
diff --git a/linux-user/vm86.c b/linux-user/vm86.c
index 2fa7a89..4412522 100644
--- a/linux-user/vm86.c
+++ b/linux-user/vm86.c
@@ -402,7 +402,8 @@ int do_vm86(CPUX86State *env, long subfunction, abi_ulong vm86_addr)
case TARGET_VM86_FREE_IRQ:
case TARGET_VM86_GET_IRQ_BITS:
case TARGET_VM86_GET_AND_RESET_IRQ:
- gemu_log("qemu: unsupported vm86 subfunction (%ld)\n", subfunction);
+ qemu_log_mask(LOG_UNIMP, "qemu: unsupported vm86 subfunction (%ld)\n",
+ subfunction);
ret = -TARGET_EINVAL;
goto out;
case TARGET_VM86_PLUS_INSTALL_CHECK:
diff --git a/util/log.c b/util/log.c
index 47f2827..2da6cb3 100644
--- a/util/log.c
+++ b/util/log.c
@@ -332,6 +332,8 @@ const QEMULogItem qemu_log_items[] = {
#ifdef CONFIG_PLUGIN
{ CPU_LOG_PLUGIN, "plugin", "output from TCG plugins\n"},
#endif
+ { LOG_STRACE, "strace",
+ "log every user-mode syscall, its input, and its result" },
{ 0, NULL, NULL },
};