libctf: error handling

CTF functions return zero on success or an extended errno value which
can be translated into a string via the functions in this commit.

The errno numbers start at -CTF_BASE.

libctf/
	* ctf-error.c: New file.

include/
	* ctf-api.h (ctf_errno): New declaration.
	(ctf_errmsg): Likewise.
This commit is contained in:
Nick Alcock
2019-04-23 22:05:52 +01:00
parent 94585e7f93
commit 479604f44f
4 changed files with 104 additions and 0 deletions

View File

@ -122,6 +122,8 @@ enum
#define CTF_ADD_NONROOT 0 /* Type only visible in nested scope. */
#define CTF_ADD_ROOT 1 /* Type visible at top-level scope. */
extern int ctf_errno (ctf_file_t *);
extern const char *ctf_errmsg (int);
extern void ctf_setdebug (int debug);
extern int ctf_getdebug (void);