|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 3/4] tools/xc: preserve errno in ERROR and DRINTF macros
This simplifies a changes made in a follow-up patch.
Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
---
tools/libxc/xc_private.h | 29 ++++++++++++++++++++++-------
1 file changed, 22 insertions(+), 7 deletions(-)
diff --git a/tools/libxc/xc_private.h b/tools/libxc/xc_private.h
index a610f0c..b3e0130 100644
--- a/tools/libxc/xc_private.h
+++ b/tools/libxc/xc_private.h
@@ -119,13 +119,28 @@ void xc_report_progress_step(xc_interface *xch,
/* anamorphic macros: struct xc_interface *xch must be in scope */
-#define IPRINTF(_f, _a...) xc_report(xch, xch->error_handler, XTL_INFO,0, _f ,
## _a)
-#define DPRINTF(_f, _a...) xc_report(xch, xch->error_handler, XTL_DETAIL,0, _f
, ## _a)
-#define DBGPRINTF(_f, _a...) xc_report(xch, xch->error_handler, XTL_DEBUG,0,
_f , ## _a)
-
-#define ERROR(_m, _a...) xc_report_error(xch,XC_INTERNAL_ERROR,_m , ## _a )
-#define PERROR(_m, _a...) xc_report_error(xch,XC_INTERNAL_ERROR,_m \
- " (%d = %s)", ## _a , errno, xc_strerror(xch, errno))
+#define IPRINTF(_f, _a...) do { int __errno = errno; \
+ xc_report(xch, xch->error_handler, XTL_INFO,0, _f , ## _a); \
+ errno = __errno; \
+ } while (0)
+#define DPRINTF(_f, _a...) do { int __errno = errno; \
+ xc_report(xch, xch->error_handler, XTL_DETAIL,0, _f , ## _a); \
+ errno = __errno; \
+ } while (0)
+#define DBGPRINTF(_f, _a...) do { int __errno = errno; \
+ xc_report(xch, xch->error_handler, XTL_DEBUG,0, _f , ## _a); \
+ errno = __errno; \
+ } while (0)
+
+#define ERROR(_m, _a...) do { int __errno = errno; \
+ xc_report_error(xch,XC_INTERNAL_ERROR,_m , ## _a ); \
+ errno = __errno; \
+ } while (0)
+#define PERROR(_m, _a...) do { int __errno = errno; \
+ xc_report_error(xch,XC_INTERNAL_ERROR,_m " (%d = %s)", \
+ ## _a , errno, xc_strerror(xch, errno)); \
+ errno = __errno; \
+ } while (0)
/*
* HYPERCALL ARGUMENT BUFFERS
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |