summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2015-09-11 16:51:42 +0200
committerMarkus Armbruster <armbru@redhat.com>2015-09-18 14:38:08 +0200
commita29a37b994ca3c5a1d39fa0e8934f7e0f2cf57ef (patch)
treef370acbbace6189dedc5f3b000c4307a07af663e /include
parent4f966768acd1d677d24d60a01c160c18a09cce80 (diff)
downloadqemu-a29a37b994ca3c5a1d39fa0e8934f7e0f2cf57ef.zip
error: New error_fatal
Similar to error_abort, but doesn't report where the error was created, and terminates the process with exit(1) rather than abort(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1441983105-26376-2-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/qapi/error.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/qapi/error.h b/include/qapi/error.h
index d7878c3088..c69dddbbf2 100644
--- a/include/qapi/error.h
+++ b/include/qapi/error.h
@@ -50,6 +50,9 @@
* Call a function aborting on errors:
* foo(arg, &error_abort);
*
+ * Call a function treating errors as fatal:
+ * foo(arg, &error_fatal);
+ *
* Receive an error and pass it on to the caller:
* Error *err = NULL;
* foo(arg, &err);
@@ -100,6 +103,7 @@ ErrorClass error_get_class(const Error *err);
* If @errp is NULL, the error is ignored. Don't bother creating one
* then.
* If @errp is &error_abort, print a suitable message and abort().
+ * If @errp is &error_fatal, print a suitable message and exit(1).
* If @errp is anything else, *@errp must be NULL.
* The new error's class is ERROR_CLASS_GENERIC_ERROR, and its
* human-readable error message is made from printf-style @fmt, ...
@@ -148,6 +152,8 @@ void error_setg_win32_internal(Error **errp,
* error object.
* Else, if @dst_errp is &error_abort, print a suitable message and
* abort().
+ * Else, if @dst_errp is &error_fatal, print a suitable message and
+ * exit(1).
* Else, if @dst_errp already contains an error, ignore this one: free
* the error object.
* Else, move the error object from @local_err to *@dst_errp.
@@ -206,4 +212,9 @@ void error_set_internal(Error **errp,
*/
extern Error *error_abort;
+/*
+ * Pass to error_setg() & friends to exit(1) on error.
+ */
+extern Error *error_fatal;
+
#endif