[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 26/28] qemu-error: Add error_vreport()
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 26/28] qemu-error: Add error_vreport() |
Date: |
Thu, 9 Oct 2014 12:17:33 +0200 |
From: Corey Minyard <address@hidden>
Needed to nicely print socket error reports.
Signed-off-by: Corey Minyard <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
include/qemu/error-report.h | 1 +
util/qemu-error.c | 23 ++++++++++++++++++-----
2 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/include/qemu/error-report.h b/include/qemu/error-report.h
index 000eae3..7ab2355 100644
--- a/include/qemu/error-report.h
+++ b/include/qemu/error-report.h
@@ -38,6 +38,7 @@ void error_vprintf(const char *fmt, va_list ap)
GCC_FMT_ATTR(1, 0);
void error_printf(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
void error_printf_unless_qmp(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
void error_set_progname(const char *argv0);
+void error_vreport(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0);
void error_report(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
const char *error_get_progname(void);
extern bool enable_timestamp_msg;
diff --git a/util/qemu-error.c b/util/qemu-error.c
index 7b167fd..9bba5f5 100644
--- a/util/qemu-error.c
+++ b/util/qemu-error.c
@@ -199,14 +199,13 @@ static void error_print_loc(void)
bool enable_timestamp_msg;
/*
* Print an error message to current monitor if we have one, else to stderr.
- * Format arguments like sprintf(). The result should not contain
+ * Format arguments like vsprintf(). The result should not contain
* newlines.
* Prepend the current location and append a newline.
* It's wrong to call this in a QMP monitor. Use qerror_report() there.
*/
-void error_report(const char *fmt, ...)
+void error_vreport(const char *fmt, va_list ap)
{
- va_list ap;
GTimeVal tv;
gchar *timestr;
@@ -218,8 +217,22 @@ void error_report(const char *fmt, ...)
}
error_print_loc();
- va_start(ap, fmt);
error_vprintf(fmt, ap);
- va_end(ap);
error_printf("\n");
}
+
+/*
+ * Print an error message to current monitor if we have one, else to stderr.
+ * Format arguments like sprintf(). The result should not contain
+ * newlines.
+ * Prepend the current location and append a newline.
+ * It's wrong to call this in a QMP monitor. Use qerror_report() there.
+ */
+void error_report(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ error_vreport(fmt, ap);
+ va_end(ap);
+}
--
1.8.3.1
- [Qemu-devel] [PULL 03/28] qemu-char: Move some items into TCPCharDriver, (continued)
- [Qemu-devel] [PULL 03/28] qemu-char: Move some items into TCPCharDriver, Paolo Bonzini, 2014/10/09
- [Qemu-devel] [PULL 04/28] qemu-char: set socket filename to disconnected when not connected, Paolo Bonzini, 2014/10/09
- [Qemu-devel] [PULL 05/28] qemu-char: Add reconnecting to client sockets, Paolo Bonzini, 2014/10/09
- [Qemu-devel] [PULL 06/28] qemu-char: Print the remote and local addresses for a socket, Paolo Bonzini, 2014/10/09
- [Qemu-devel] [PULL 17/28] accel: Move qtest accel registration to qtest.c, Paolo Bonzini, 2014/10/09
- [Qemu-devel] [PULL 18/28] accel: Remove tcg_available() function, Paolo Bonzini, 2014/10/09
- [Qemu-devel] [PULL 19/28] accel: Move accel init/allowed code to separate function, Paolo Bonzini, 2014/10/09
- [Qemu-devel] [PULL 20/28] accel: Rename 'init' method to 'init_machine', Paolo Bonzini, 2014/10/09
- [Qemu-devel] [PULL 22/28] accel: Create accel object when initializing machine, Paolo Bonzini, 2014/10/09
- [Qemu-devel] [PULL 21/28] accel: Pass MachineState object to accel init functions, Paolo Bonzini, 2014/10/09
- [Qemu-devel] [PULL 26/28] qemu-error: Add error_vreport(),
Paolo Bonzini <=
- [Qemu-devel] [PULL 27/28] qemu-sockets: Add error to non-blocking connect handler, Paolo Bonzini, 2014/10/09
- [Qemu-devel] [PULL 23/28] kvm: Make KVMState be the TYPE_KVM_ACCEL instance struct, Paolo Bonzini, 2014/10/09
- Re: [Qemu-devel] [PULL 23/28] kvm: Make KVMState be the TYPE_KVM_ACCEL instance struct, Gonglei, 2014/10/10
[Qemu-devel] [PULL 28/28] qemu-char: Fix reconnect socket error reporting, Paolo Bonzini, 2014/10/09
[Qemu-devel] [PULL 25/28] virtio-scsi: fix use-after-free of VirtIOSCSIReq, Paolo Bonzini, 2014/10/09
[Qemu-devel] [PULL 24/28] linuxboot: compute initrd loading address, Paolo Bonzini, 2014/10/09