aboutsummaryrefslogtreecommitdiffstats
path: root/liberror.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2019-04-12 22:32:26 +0200
committerMattias Andrée <maandree@kth.se>2019-04-12 22:32:26 +0200
commit5012504d2f215002a429b14f238ebfc1d0029c05 (patch)
tree7d70dbbdef6c93da503683c30b6c6d2e90f36881 /liberror.h
parentAdd readme (diff)
downloadliberror-5012504d2f215002a429b14f238ebfc1d0029c05.tar.gz
liberror-5012504d2f215002a429b14f238ebfc1d0029c05.tar.bz2
liberror-5012504d2f215002a429b14f238ebfc1d0029c05.tar.xz
Add support for extended details
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'liberror.h')
-rw-r--r--liberror.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/liberror.h b/liberror.h
index 27c700d..508dbac 100644
--- a/liberror.h
+++ b/liberror.h
@@ -13,6 +13,53 @@
struct liberror_backtrace;
/**
+ * Value that specifies which feild in a
+ * `union liberror_details` that is used
+ */
+enum liberror_details_type {
+ LIBERROR_DETAILS_NONE,
+ LIBERROR_DETAILS_USER,
+ LIBERROR_DETAILS_ONE_FILE,
+ LIBERROR_DETAILS_TWO_FILES
+};
+
+/**
+ * Error details
+ */
+union liberror_details {
+ /**
+ * For `LIBERROR_DETAILS_USER`
+ */
+ struct {
+ const char *library;
+ void *data;
+ void (*free_data)(void *);
+ void *(*copy_data)(void *);
+ } user;
+
+ /**
+ * For `LIBERROR_DETAILS_ONE_FILE`
+ */
+ struct {
+ int fd;
+ char *name;
+ const char *role;
+ } one_file;
+
+ /**
+ * For `LIBERROR_DETAILS_TWO_FILES`
+ */
+ struct {
+ int fd1;
+ int fd2;
+ char *name1;
+ char *name2;
+ const char *role1;
+ const char *role2;
+ } two_files;
+};
+
+/**
* Error structure
*/
struct liberror_error {
@@ -63,6 +110,16 @@ struct liberror_error {
* Whether the error is physically allocated
*/
int dynamically_allocated;
+
+ /**
+ * Which value in `.details` that is used
+ */
+ enum liberror_details_type details_type;
+
+ /**
+ * Error detail
+ */
+ union liberror_details details;
};