[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL for-7.1 15/36] util/log: Use qemu_log_lock/unlock in qemu_log
|
From: |
Richard Henderson |
|
Subject: |
[PULL for-7.1 15/36] util/log: Use qemu_log_lock/unlock in qemu_log |
|
Date: |
Sun, 20 Mar 2022 10:11:14 -0700 |
Avoid using QemuLogFile and RCU directly.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
util/log.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/util/log.c b/util/log.c
index b1651d8122..3ec6e90575 100644
--- a/util/log.c
+++ b/util/log.c
@@ -62,23 +62,22 @@ void qemu_log_unlock(FILE *fd)
/* Return the number of characters emitted. */
int qemu_log(const char *fmt, ...)
{
+ FILE *f = qemu_log_lock();
int ret = 0;
- QemuLogFile *logfile;
- rcu_read_lock();
- logfile = qatomic_rcu_read(&qemu_logfile);
- if (logfile) {
+ if (f) {
va_list ap;
+
va_start(ap, fmt);
- ret = vfprintf(logfile->fd, fmt, ap);
+ ret = vfprintf(f, fmt, ap);
va_end(ap);
+ qemu_log_unlock(f);
/* Don't pass back error results. */
if (ret < 0) {
ret = 0;
}
}
- rcu_read_unlock();
return ret;
}
--
2.25.1
- [PULL for-7.1 29/36] util/log: Rename logfilename to global_filename, (continued)
- [PULL for-7.1 29/36] util/log: Rename logfilename to global_filename, Richard Henderson, 2022/03/20
- [PULL for-7.1 30/36] util/log: Rename qemu_logfile to global_file, Richard Henderson, 2022/03/20
- [PULL for-7.1 09/36] util/log: Remove qemu_log_vprintf, Richard Henderson, 2022/03/20
- [PULL for-7.1 10/36] tcg: Pass the locked filepointer to tcg_dump_ops, Richard Henderson, 2022/03/20
- [PULL for-7.1 13/36] accel/tcg: Use cpu_dump_state between qemu_log_lock/unlock, Richard Henderson, 2022/03/20
- [PULL for-7.1 12/36] exec/log: Remove log_disas and log_target_disas, Richard Henderson, 2022/03/20
- [PULL for-7.1 15/36] util/log: Use qemu_log_lock/unlock in qemu_log,
Richard Henderson <=
- [PULL for-7.1 18/36] bsd-user: Expand log_page_dump inline, Richard Henderson, 2022/03/20
- [PULL for-7.1 19/36] linux-user: Expand log_page_dump inline, Richard Henderson, 2022/03/20
- [PULL for-7.1 17/36] util/log: Drop call to setvbuf, Richard Henderson, 2022/03/20
- [PULL for-7.1 21/36] include/exec/log: Do not reference QemuLogFile directly, Richard Henderson, 2022/03/20
- [PULL for-7.1 22/36] include/qemu/log: Move entire implementation out-of-line, Richard Henderson, 2022/03/20
- [PULL for-7.1 24/36] util/log: Introduce qemu_set_log_filename_flags, Richard Henderson, 2022/03/20
- [PULL for-7.1 23/36] sysemu/os-win32: Test for and use _lock_file/_unlock_file, Richard Henderson, 2022/03/20
- [PULL for-7.1 26/36] linux-user: Use qemu_set_log_filename_flags, Richard Henderson, 2022/03/20
- [PULL for-7.1 27/36] softmmu: Use qemu_set_log_filename_flags, Richard Henderson, 2022/03/20