com_err.h revision d3395ae71a38ff562e0af3a174ecbc5b523057d6
1/*
2 * Header file for common error description library.
3 *
4 * Copyright 1988, Student Information Processing Board of the
5 * Massachusetts Institute of Technology.
6 *
7 * For copyright and distribution info, see the documentation supplied
8 * with this package.
9 */
10
11#if !defined(__COM_ERR_H) && !defined(__COM_ERR_H__)
12
13#ifdef __GNUC__
14#define COM_ERR_ATTR(x) __attribute__(x)
15#else
16#define COM_ERR_ATTR(x)
17#endif
18
19#include <stdarg.h>
20
21typedef long errcode_t;
22
23struct error_table {
24	char const * const * msgs;
25	long base;
26	int n_msgs;
27};
28struct et_list;
29
30extern void com_err (const char *, long, const char *, ...)
31	COM_ERR_ATTR((format(printf, 3, 4)));
32
33extern void com_err_va (const char *whoami, errcode_t code, const char *fmt,
34		 va_list args)
35	COM_ERR_ATTR((format(printf, 3, 0)));
36
37extern char const *error_message (long);
38extern void (*com_err_hook) (const char *, long, const char *, va_list);
39extern void (*set_com_err_hook (void (*) (const char *, long,
40					  const char *, va_list)))
41	(const char *, long, const char *, va_list);
42extern void (*reset_com_err_hook (void)) (const char *, long,
43					  const char *, va_list);
44extern int init_error_table(const char * const *msgs, long base, int count);
45
46extern errcode_t add_error_table(const struct error_table * et);
47extern errcode_t remove_error_table(const struct error_table * et);
48extern void add_to_error_table(struct et_list *new_table);
49
50/* Provided for Heimdall compatibility */
51extern const char *com_right(struct et_list *list, long code);
52extern void initialize_error_table_r(struct et_list **list,
53				     const char **messages,
54				     int num_errors,
55				     long base);
56extern void free_error_table(struct et_list *et);
57
58/* Provided for compatibility with other com_err libraries */
59extern int et_list_lock(void);
60extern int et_list_unlock(void);
61
62#define __COM_ERR_H
63#define __COM_ERR_H__
64#endif /* !defined(__COM_ERR_H) && !defined(__COM_ERR_H__)*/
65