summaryrefslogtreecommitdiff
path: root/sysemu.h
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-08-14 10:36:06 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-08-27 20:43:33 -0500
commitac7531ecdc8349ffc3a8d85721218df5585e30b6 (patch)
tree61b23e3a7f491b9f5939f03ab77527e9183be0cb /sysemu.h
parent81a322d4a1b68d47908a6630bf22897a289722aa (diff)
downloadqemu-ac7531ecdc8349ffc3a8d85721218df5585e30b6.tar.gz
add qemu_error() + friends
This patch adds some functions for error reporting to address the problem that error messages should be routed to different destinations depending on the context of the caller, i.e. monitor command errors should go to the monitor, command line errors to stderr. qemu_error() is a printf-like function to report errors. qemu_errors_to_file() and qemu_errors_to_mon() switch the destination for the error message to the specified file or monitor. When setting a new destination the old one will be kept. One can switch back using qemu_errors_to_previous(). i.e. it works like a stack. main() calls qemu_errors_to_file(stderr), so errors go to stderr by default. monitor callbacks are wrapped into qemu_errors_to_mon() + qemu_errors_to_previous(), so any errors triggered by monitor commands will go to the monitor. Each thread has its own error message destination. qemu-kvm probably should add a qemu_errors_to_file(stderr) call to the i/o-thread initialization code. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'sysemu.h')
-rw-r--r--sysemu.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/sysemu.h b/sysemu.h
index 18fa0727c1..d42fe9dc7e 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -65,6 +65,11 @@ int qemu_savevm_state_complete(QEMUFile *f);
int qemu_savevm_state(QEMUFile *f);
int qemu_loadvm_state(QEMUFile *f);
+void qemu_errors_to_file(FILE *fp);
+void qemu_errors_to_mon(Monitor *mon);
+void qemu_errors_to_previous(void);
+void qemu_error(const char *fmt, ...) __attribute__ ((format(printf, 1, 2)));
+
#ifdef _WIN32
/* Polling handling */