Received: from eggs.gnu.org ([2001:4830:134:3::10]:39558) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhDAs-0006ez-3m for qemu-devel@nongnu.org; Tue, 06 Sep 2016 06:00:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bhDAo-0005rI-0p for qemu-devel@nongnu.org; Tue, 06 Sep 2016 06:00:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51666) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhDAn-0005qm-S2 for qemu-devel@nongnu.org; Tue, 06 Sep 2016 06:00:09 -0400 Date: Tue, 6 Sep 2016 17:52:54 +0800 From: Fam Zheng Message-ID: <20160906095254.GA10525@al.usersys.redhat.com> References: <1471498092-27135-1-git-send-email-peterx@redhat.com> <1471498092-27135-2-git-send-email-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1471498092-27135-2-git-send-email-peterx@redhat.com> Subject: Re: [Qemu-devel] [PATCH v3 1/4] error-report: provide error_report_fatal() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Xu Cc: qemu-devel@nongnu.org, armbru@redhat.com, peter.maydell@linaro.org, pbonzini@redhat.com On Thu, 08/18 13:28, Peter Xu wrote: > 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 > --- > include/qemu/error-report.h | 1 + > util/qemu-error.c | 12 ++++++++++++ > 2 files changed, 13 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..81379e1 100644 > --- a/util/qemu-error.c > +++ b/util/qemu-error.c > @@ -10,6 +10,7 @@ > * See the COPYING file in the top-level directory. > */ > > +#include I think qemu/osdep.h must come first. But OTOH this include is not necessary. > #include "qemu/osdep.h" > #include "monitor/monitor.h" > #include "qemu/error-report.h" > @@ -237,3 +238,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 >