[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 1/4] error-report: provide error_report_fatal()
From: |
Peter Xu |
Subject: |
[Qemu-devel] [PATCH v4 1/4] error-report: provide error_report_fatal() |
Date: |
Wed, 7 Sep 2016 14:06:27 +0800 |
There are many places in current QEMU codes that needs to print some
error and then quit QEMU. Provide a new function for it.
Signed-off-by: Peter Xu <address@hidden>
---
include/qemu/error-report.h | 1 +
util/qemu-error.c | 11 +++++++++++
2 files changed, 12 insertions(+)
diff --git a/include/qemu/error-report.h b/include/qemu/error-report.h
index 499ec8b..eb8260e 100644
--- a/include/qemu/error-report.h
+++ b/include/qemu/error-report.h
@@ -36,6 +36,7 @@ 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);
+void error_report_fatal(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 1ef3566..684f543 100644
--- a/util/qemu-error.c
+++ b/util/qemu-error.c
@@ -237,3 +237,14 @@ void error_report(const char *fmt, ...)
error_vreport(fmt, ap);
va_end(ap);
}
+
+void error_report_fatal(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ error_vreport(fmt, ap);
+ va_end(ap);
+
+ exit(1);
+}
--
2.7.4
- [Qemu-devel] [PATCH v4 0/4] Introduce error_report_{fatal|abort}, Peter Xu, 2016/09/07
- [Qemu-devel] [PATCH v4 1/4] error-report: provide error_report_fatal(),
Peter Xu <=
- [Qemu-devel] [PATCH v4 2/4] error-report: provide error_report_abort(), Peter Xu, 2016/09/07
- [Qemu-devel] [PATCH v4 4/4] error-report: leverage error_report_abort(), Peter Xu, 2016/09/07
- [Qemu-devel] [PATCH v4 3/4] error-report: leverage error_report_fatal(), Peter Xu, 2016/09/07
- Re: [Qemu-devel] [PATCH v4 0/4] Introduce error_report_{fatal|abort}, Fam Zheng, 2016/09/07
- Re: [Qemu-devel] [PATCH v4 0/4] Introduce error_report_{fatal|abort}, Alex Bennée, 2016/09/07
- Re: [Qemu-devel] [PATCH v4 0/4] Introduce error_report_{fatal|abort}, Markus Armbruster, 2016/09/09