summaryrefslogtreecommitdiff
path: root/util/error.c
AgeCommit message (Collapse)AuthorFilesLines
2014-01-17Revert "error: Don't use error_report() for assertion msgs."Peter Crosthwaite1-4/+4
This reverts commit d32934c84c72f57e78d430c22974677b7bcabe5d. The original implementation before this patch makes abortive error messages much more friendly. The underlying bug that required this change is now fixed. Revert. Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
2014-01-15error: Don't use error_report() for assertion msgs.Peter Crosthwaite1-4/+4
Use fprintf(stderr instead. This removes dependency of libqemuutil.a on the monitor. We can further justify this change, in that this code path should only trigger under a fatal error condition. fprintf-stderr is probably the appropriate medium as under a fatal error conidition the monitor itself may be down and out for the count. So assertion failure messages should go lowest common denominator - straight to stderr. Fixes the build as reported by Kevin Wolf. Issue debugged and change suggested by Luiz Capitulino. Issue introduced by 5d24ee70bcbcf578614193526bcd5ed30a8eb16c. Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
2014-01-06error: Add error_abortPeter Crosthwaite1-1/+21
Add a special Error * that can be passed to error handling APIs to signal that any errors are fatal and should abort QEMU. There are two advantages to this: - allows for brevity when wishing to assert success of Error ** accepting APIs. No need for this pattern: Error * local_err = NULL; api_call(foo, bar, &local_err); assert_no_error(local_err); This also removes the need for _nofail variants of APIs with asserting call sites now reduced to 1LOC. - SIGABRT happens from within the offending API. When a fatal error occurs in an API call (when the caller is asserting sucess) failure often means the API itself is broken. With the abort happening in the API call now, the stack frames into the call are available at debug time. In the assert_no_error scheme the abort happens after the fact. The exact semantic is that when an error is raised, if the argument Error ** matches &error_abort, then the abort occurs immediately. The error messaged is reported. For error_propagate, if the destination error is &error_abort, then the abort happens at propagation time. Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-11-28util/error: Save errno from clobberingMax Reitz1-0/+6
There may be calls to error_setg() and especially error_setg_errno() which blindly (and until now wrongly) assume these functions not to clobber errno (e.g., they pass errno to error_setg_errno() and return -errno afterwards). Instead of trying to find and fix all of these constructs, just make sure error_setg() and error_setg_errno() indeed do not clobber errno. Suggested-by: Eric Blake <eblake@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-09-09error: Add error_set_win32 and error_setg_win32Tomoki Sekiyama1-0/+35
These functions help maintaining homogeneous formatting of error messages with Windows error code and description (generated by g_win32_error_message()). Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-06-17error: add error_setg_file_open() helperLuiz Capitulino1-0/+5
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Acked-by: Kevin Wolf <kwolf@redhat.com>
2013-01-12build: move libqemuutil.a components to util/Paolo Bonzini1-0/+115
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>