qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: minyard@acm.org
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, Corey Minyard <cminyard@mvista.com>
Subject: [Qemu-devel] [PATCH 1/3] qemu-error: Add error_vreport()
Date: Wed,  8 Oct 2014 07:11:54 -0500	[thread overview]
Message-ID: <1412770316-5241-2-git-send-email-minyard@acm.org> (raw)
In-Reply-To: <1412770316-5241-1-git-send-email-minyard@acm.org>

From: Corey Minyard <cminyard@mvista.com>

Needed to nicely print socket error reports.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
---
 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

  reply	other threads:[~2014-10-08 12:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-08 12:11 [Qemu-devel] [PATCH v2 0/3] Clean up non-blocking error reporting minyard
2014-10-08 12:11 ` minyard [this message]
2014-10-08 14:38   ` [Qemu-devel] [PATCH 1/3] qemu-error: Add error_vreport() Eric Blake
2014-10-08 12:11 ` [Qemu-devel] [PATCH 2/3] qemu-char: Fix reconnect socket error reporting minyard
2014-10-08 12:11 ` [Qemu-devel] [PATCH 3/3] qemu-sockets: Add error to non-blocking connect handler minyard
2014-10-09 10:07   ` Paolo Bonzini
2014-10-09 17:48     ` Corey Minyard
2014-10-08 12:56 ` [Qemu-devel] [PATCH v2 0/3] Clean up non-blocking error reporting Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1412770316-5241-2-git-send-email-minyard@acm.org \
    --to=minyard@acm.org \
    --cc=cminyard@mvista.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).