From patchwork Wed Sep 7 06:06:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 9318215 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C821F6077F for ; Wed, 7 Sep 2016 06:07:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B8FA028FDF for ; Wed, 7 Sep 2016 06:07:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AD80F29029; Wed, 7 Sep 2016 06:07:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 523D628FDF for ; Wed, 7 Sep 2016 06:07:14 +0000 (UTC) Received: from localhost ([::1]:38197 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhW0v-0008Be-8n for patchwork-qemu-devel@patchwork.kernel.org; Wed, 07 Sep 2016 02:07:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51630) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhW0O-00088c-LG for qemu-devel@nongnu.org; Wed, 07 Sep 2016 02:06:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bhW0M-0001lY-EJ for qemu-devel@nongnu.org; Wed, 07 Sep 2016 02:06:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56878) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhW0M-0001lP-8m for qemu-devel@nongnu.org; Wed, 07 Sep 2016 02:06:38 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DEBFD9B0DD; Wed, 7 Sep 2016 06:06:37 +0000 (UTC) Received: from pxdev.xzpeter.org.com (dhcp-14-106.nay.redhat.com [10.66.14.106]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8766W2j024709; Wed, 7 Sep 2016 02:06:35 -0400 From: Peter Xu To: qemu-devel@nongnu.org Date: Wed, 7 Sep 2016 14:06:27 +0800 Message-Id: <1473228390-18669-2-git-send-email-peterx@redhat.com> In-Reply-To: <1473228390-18669-1-git-send-email-peterx@redhat.com> References: <1473228390-18669-1-git-send-email-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 07 Sep 2016 06:06:37 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v4 1/4] error-report: provide error_report_fatal() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, famz@redhat.com, armbru@redhat.com, peterx@redhat.com, pbonzini@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 | 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); +}