diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2024-11-21 14:05:26 -0600 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2024-11-29 05:22:48 -0600 |
commit | 043f47ac299a4086a486818ac7b35e6bc5d0490b (patch) | |
tree | f31129bfffd65c1cea1f77b46957f553e392dbe9 /system/elfutils/error.h | |
parent | 43026fcd8adaf1b38a44e4cafcec37460c50af8b (diff) | |
download | packages-043f47ac299a4086a486818ac7b35e6bc5d0490b.tar.gz packages-043f47ac299a4086a486818ac7b35e6bc5d0490b.tar.bz2 packages-043f47ac299a4086a486818ac7b35e6bc5d0490b.tar.xz packages-043f47ac299a4086a486818ac7b35e6bc5d0490b.zip |
system/elfutils: New package
Needed for kernel on x86 platforms.
Includes one patch from experimental/elfutils set.
Diffstat (limited to 'system/elfutils/error.h')
-rw-r--r-- | system/elfutils/error.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/system/elfutils/error.h b/system/elfutils/error.h new file mode 100644 index 000000000..8bae4c7db --- /dev/null +++ b/system/elfutils/error.h @@ -0,0 +1,29 @@ +#ifndef _ERROR_H_ +#define _ERROR_H_ + +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> + +static unsigned int error_message_count = 0; + +static inline void error(int status, int errnum, const char* format, ...) +{ + va_list ap; + fflush(stdout); + fprintf(stderr, "%s: ", program_invocation_name); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); + if (errnum) + fprintf(stderr, ": %s", strerror(errnum)); + fprintf(stderr, "\n"); + error_message_count++; + if (status) + exit(status); + fflush(stderr); +} + +#endif /* _ERROR_H_ */ |