com_err.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. #if !defined(__COM_ERR_H) && !defined(__COM_ERR_H__)
  11. #ifdef __GNUC__
  12. #define COM_ERR_ATTR(x) __attribute__(x)
  13. #else
  14. #define COM_ERR_ATTR(x)
  15. #endif
  16. #include <stddef.h>
  17. #include <stdarg.h>
  18. typedef long errcode_t;
  19. struct error_table {
  20. char const * const * msgs;
  21. long base;
  22. int n_msgs;
  23. };
  24. struct et_list;
  25. extern void com_err (const char *, long, const char *, ...)
  26. COM_ERR_ATTR((format(printf, 3, 4)));
  27. extern void com_err_va (const char *whoami, errcode_t code, const char *fmt,
  28. va_list args)
  29. COM_ERR_ATTR((format(printf, 3, 0)));
  30. extern char const *error_message (long);
  31. extern void (*com_err_hook) (const char *, long, const char *, va_list);
  32. extern void (*set_com_err_hook (void (*) (const char *, long,
  33. const char *, va_list)))
  34. (const char *, long, const char *, va_list);
  35. extern void (*reset_com_err_hook (void)) (const char *, long,
  36. const char *, va_list);
  37. extern int init_error_table(const char * const *msgs, long base, int count);
  38. extern errcode_t add_error_table(const struct error_table * et);
  39. extern errcode_t remove_error_table(const struct error_table * et);
  40. extern void add_to_error_table(struct et_list *new_table);
  41. /* Provided for Heimdall compatibility */
  42. extern const char *com_right(struct et_list *list, long code);
  43. extern const char *com_right_r(struct et_list *list, long code, char *str, size_t len);
  44. extern void initialize_error_table_r(struct et_list **list,
  45. const char **messages,
  46. int num_errors,
  47. long base);
  48. extern void free_error_table(struct et_list *et);
  49. /* Provided for compatibility with other com_err libraries */
  50. extern int et_list_lock(void);
  51. extern int et_list_unlock(void);
  52. #define __COM_ERR_H
  53. #define __COM_ERR_H__
  54. #endif /* !defined(__COM_ERR_H) && !defined(__COM_ERR_H__)*/