diff options
author | Gianni Tedesco <gianni.tedesco@citrix.com> | 2010-07-23 17:26:28 +0100 |
---|---|---|
committer | Gianni Tedesco <gianni.tedesco@citrix.com> | 2010-07-23 17:26:28 +0100 |
commit | 2bdc928237ca74c5194d9487c21290eb8f1016c3 (patch) | |
tree | af6fde7c555036b3b11f913926b76a3cc2e0c903 /tools/libxl/libxl_internal.h | |
parent | b545cf4fb2f9246b4dd50353e8018c2d66b9b3f7 (diff) | |
download | xen-2bdc928237ca74c5194d9487c21290eb8f1016c3.tar.gz xen-2bdc928237ca74c5194d9487c21290eb8f1016c3.tar.bz2 xen-2bdc928237ca74c5194d9487c21290eb8f1016c3.zip |
libxl: consistent handling of libxc errors
Lots of places in libxl return -1 as an error which is inconsistent with
libxl error codes since that is ERROR_VERSION. Also in other places the
xc_* function to implement a command is called but the return value is
either never checked or not passed on.
This patch makes callers of libxc functions use XL_LOG_ERRNO to log a
suitable message including the contents of errno, before returning
ERROR_FAIL, if an xc call fails. (Except for pci device removals and
domain destroys where release of resources ought to continue even if
an error occurs in an early step. In this case the error is still
logged at least.)
Also a bug is fixed where a caller depends on errno being set but is
cleared by cleanup code which calls in to library functions which modify
errno as a side-effect.
This is version 2 of the patch previously applied as 91c486918e02.
Changed since then: Removed mapping from libxc error codes to libxl -
this is redundant because libxl ought to return -1 with errno set to a
meaningful value.
Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxl/libxl_internal.h')
-rw-r--r-- | tools/libxl/libxl_internal.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 05b637b0d6..205d37306d 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -222,5 +222,8 @@ char *libxl_abs_path(struct libxl_ctx *ctx, char *s, const char *path); #define XL_LOG_WARNING XTL_WARN #define XL_LOG_ERROR XTL_ERROR +/* Error handling */ +int libxl_xc_error(int xc_err); + #endif |