summaryrefslogtreecommitdiff
path: root/qemu-error.c
diff options
context:
space:
mode:
Diffstat (limited to 'qemu-error.c')
-rw-r--r--qemu-error.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/qemu-error.c b/qemu-error.c
new file mode 100644
index 000000000..63bcdcfa1
--- /dev/null
+++ b/qemu-error.c
@@ -0,0 +1,34 @@
+#include <stdio.h>
+#include "monitor.h"
+#include "sysemu.h"
+
+void qemu_error(const char *fmt, ...)
+{
+ va_list args;
+
+ va_start(args, fmt);
+ if (cur_mon) {
+ monitor_vprintf(cur_mon, fmt, args);
+ } else {
+ vfprintf(stderr, fmt, args);
+ }
+ va_end(args);
+}
+
+void qemu_error_internal(const char *file, int linenr, const char *func,
+ const char *fmt, ...)
+{
+ va_list va;
+ QError *qerror;
+
+ va_start(va, fmt);
+ qerror = qerror_from_info(file, linenr, func, fmt, &va);
+ va_end(va);
+
+ if (cur_mon) {
+ monitor_set_error(cur_mon, qerror);
+ } else {
+ qerror_print(qerror);
+ QDECREF(qerror);
+ }
+}