mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-23 03:29:43 +00:00
util/log: Ignore per-thread flag if global file already there
If QEMU is started with `-D qemu.log.%d` without any `-d` option,
doing `log all` in the monitor fails with:
Filename template with '%d' required for 'tid'
It is confusing since '%d' was actually passed.
This happens because QEMU caches the log file name with %d converted
to getpid() since `tid` wasn't required. This name isn't suitable
for a subsequent enablement of per-thread logs. There's little cause
to change the behavior as `-d tid` is mostly used at user-only startup.
Drop the per-thread from the requested flags in this case : `log all`
will thus enable everything except `tid` instead of failing. This is
preferable over forcing the user to enable each log item individually.
With this patch, `tid` is now truely immutable : it can only be set
or unset from the command line and never changed afterwards.
Fixes: 4e51069d67
("util/log: Support per-thread log files")
Cc: richard.henderson@linaro.org
Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20221104120059.678470-3-groug@kaod.org
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
479b350ebf
commit
524fc73743
@ -209,6 +209,10 @@ static bool qemu_set_log_internal(const char *filename, bool changed_name,
|
||||
/* The per-thread flag is immutable. */
|
||||
if (log_per_thread) {
|
||||
log_flags |= LOG_PER_THREAD;
|
||||
} else {
|
||||
if (global_filename) {
|
||||
log_flags &= ~LOG_PER_THREAD;
|
||||
}
|
||||
}
|
||||
|
||||
per_thread = log_flags & LOG_PER_THREAD;
|
||||
|
Loading…
Reference in New Issue
Block a user