log: do not use CONFIG_USER_ONLY
This decouples logging further from config-target.h
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/util/log.c b/util/log.c
index 1857730..5ad72c1 100644
--- a/util/log.c
+++ b/util/log.c
@@ -42,8 +42,10 @@
va_end(ap);
}
+static bool log_uses_own_buffers;
+
/* enable or disable low levels log */
-void do_qemu_set_log(int log_flags, bool use_own_buffers)
+void qemu_set_log(int log_flags)
{
qemu_loglevel = log_flags;
#ifdef CONFIG_TRACE_LOG
@@ -70,7 +72,7 @@
qemu_logfile = stderr;
}
/* must avoid mmap() usage of glibc by setting a buffer "by hand" */
- if (use_own_buffers) {
+ if (log_uses_own_buffers) {
static char logfile_buf[4096];
setvbuf(qemu_logfile, logfile_buf, _IOLBF, sizeof(logfile_buf));
@@ -89,6 +91,12 @@
qemu_log_close();
}
}
+
+void qemu_log_needs_buffers(void)
+{
+ log_uses_own_buffers = true;
+}
+
/*
* Allow the user to include %d in their logfile which will be
* substituted with the current PID. This is useful for debugging many