mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-11 16:00:50 -07:00
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>
This commit is contained in:
parent
e10ee3f567
commit
39be535008
4 changed files with 62 additions and 36 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue