From 5012504d2f215002a429b14f238ebfc1d0029c05 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 12 Apr 2019 22:32:26 +0200 Subject: Add support for extended details MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- liberror.h | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'liberror.h') diff --git a/liberror.h b/liberror.h index 27c700d..508dbac 100644 --- a/liberror.h +++ b/liberror.h @@ -12,6 +12,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 */ @@ -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; }; -- cgit v1.2.3-70-g09d2