提交 5748e4c2 编写于 作者: C Corey Minyard 提交者: Paolo Bonzini

qemu-error: Add error_vreport()

Needed to nicely print socket error reports.
Signed-off-by: NCorey Minyard <cminyard@mvista.com>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 35e4e96c
...@@ -38,6 +38,7 @@ void error_vprintf(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0); ...@@ -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(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
void error_printf_unless_qmp(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_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); void error_report(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
const char *error_get_progname(void); const char *error_get_progname(void);
extern bool enable_timestamp_msg; extern bool enable_timestamp_msg;
......
...@@ -199,14 +199,13 @@ static void error_print_loc(void) ...@@ -199,14 +199,13 @@ static void error_print_loc(void)
bool enable_timestamp_msg; bool enable_timestamp_msg;
/* /*
* Print an error message to current monitor if we have one, else to stderr. * 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. * newlines.
* Prepend the current location and append a newline. * Prepend the current location and append a newline.
* It's wrong to call this in a QMP monitor. Use qerror_report() there. * 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; GTimeVal tv;
gchar *timestr; gchar *timestr;
...@@ -218,8 +217,22 @@ void error_report(const char *fmt, ...) ...@@ -218,8 +217,22 @@ void error_report(const char *fmt, ...)
} }
error_print_loc(); error_print_loc();
va_start(ap, fmt);
error_vprintf(fmt, ap); error_vprintf(fmt, ap);
va_end(ap);
error_printf("\n"); 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);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册