aboutsummaryrefslogtreecommitdiff
path: root/linux-user/syscall.c
diff options
context:
space:
mode:
authorJosh Kunz <jkz@google.com>2020-02-03 18:54:13 -0800
committerLaurent Vivier <laurent@vivier.eu>2020-02-19 11:17:40 +0100
commit39be535008f120452d3bda2a50798774a5f1f963 (patch)
tree68d2f8f211e24c608601f454e7d91ebfb864e3f6 /linux-user/syscall.c
parente10ee3f567c098929217458fb47a5a2d147331bd (diff)
linux-user: Use `qemu_log' for non-strace logging
Since most calls to `gemu_log` are actually logging unimplemented features, this change replaces most non-strace calls to `gemu_log` with calls to `qemu_log_mask(LOG_UNIMP, ...)`. This allows the user to easily log to a file, and to mask out these log messages if they desire. Note: This change is slightly backwards incompatible, since now these "unimplemented" log messages will not be logged by default. Signed-off-by: Josh Kunz <jkz@google.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20200204025416.111409-2-jkz@google.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'linux-user/syscall.c')
-rw-r--r--linux-user/syscall.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 9fa722f238..16d98c1ff5 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -1563,7 +1563,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;
}
@@ -1593,8 +1597,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);
}
@@ -1815,8 +1819,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);
@@ -2291,7 +2295,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;
@@ -2698,8 +2703,9 @@ get_timeout:
#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;
}
@@ -3454,7 +3460,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;
}
}
@@ -4365,7 +4371,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;
}
@@ -5213,7 +5220,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)
@@ -5281,8 +5289,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;
}