summaryrefslogtreecommitdiffstats
path: root/src/guestfs-internal.h
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2010-11-03 15:49:36 +0000
committerRichard W.M. Jones <rjones@redhat.com>2010-11-03 18:48:56 +0000
commit2066805a5d93b62beaf6653324715f0b62b06a05 (patch)
tree393ec11feb514069cf5cfb102b24a4d3a75d7e40 /src/guestfs-internal.h
parentd859c283c469b9d9124d90d0ac32024671372ed5 (diff)
downloadlibguestfs-2066805a5d93b62beaf6653324715f0b62b06a05.tar.gz
libguestfs-2066805a5d93b62beaf6653324715f0b62b06a05.tar.xz
libguestfs-2066805a5d93b62beaf6653324715f0b62b06a05.zip
lib: Expose errno through new API guestfs_last_errno.
If either the daemon sends back an errno, or a system call fails in the library, save the errno in the handle and then make it available to callers through the guestfs_last_errno function.
Diffstat (limited to 'src/guestfs-internal.h')
-rw-r--r--src/guestfs-internal.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h
index ffd8cf15..9c7c96cc 100644
--- a/src/guestfs-internal.h
+++ b/src/guestfs-internal.h
@@ -114,6 +114,7 @@ struct guestfs_h
int selinux; /* selinux enabled? */
char *last_error;
+ int last_errnum; /* errno, or 0 if there was no errno */
/* Callbacks. */
guestfs_abort_cb abort_cb;
@@ -200,6 +201,8 @@ struct guestfs_message_error;
extern void guestfs_error (guestfs_h *g, const char *fs, ...)
__attribute__((format (printf,2,3)));
+extern void guestfs_error_errno (guestfs_h *g, int errnum, const char *fs, ...)
+ __attribute__((format (printf,3,4)));
extern void guestfs_perrorf (guestfs_h *g, const char *fs, ...)
__attribute__((format (printf,2,3)));
extern void *guestfs_safe_realloc (guestfs_h *g, void *ptr, int nbytes);
@@ -221,7 +224,7 @@ extern int guestfs___accept_from_daemon (guestfs_h *g);
extern int guestfs___build_appliance (guestfs_h *g, char **kernel, char **initrd, char **appliance);
extern void guestfs___print_BufferIn (FILE *out, const char *buf, size_t buf_size);
-#define error guestfs_error
+#define error(g,...) guestfs_error_errno((g),0,__VA_ARGS__)
#define perrorf guestfs_perrorf
#define safe_calloc guestfs_safe_calloc
#define safe_malloc guestfs_safe_malloc