aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2015-12-04 13:12:57 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2016-05-19 13:08:04 +0200
commitf2937a33a53909af4b2340995f459a6eaf673882 (patch)
tree3db0e6d8bba9b57eda449bd54b366cfe5889edcd /util
parent4b4629d9d26fd0e100d9be526367a96aa35b541d (diff)
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>
Diffstat (limited to 'util')
-rw-r--r--util/log.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/util/log.c b/util/log.c
index 1857730dcb..5ad72c197f 100644
--- a/util/log.c
+++ b/util/log.c
@@ -42,8 +42,10 @@ void qemu_log(const char *fmt, ...)
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 @@ void do_qemu_set_log(int log_flags, bool use_own_buffers)
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 @@ void do_qemu_set_log(int log_flags, bool use_own_buffers)
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