strerror-override.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* strerror-override.h --- POSIX compatible system error routine
  2. Copyright (C) 2010-2021 Free Software Foundation, Inc.
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <https://www.gnu.org/licenses/>. */
  13. #ifndef _GL_STRERROR_OVERRIDE_H
  14. # define _GL_STRERROR_OVERRIDE_H
  15. # include <errno.h>
  16. # include <stddef.h>
  17. /* Reasonable buffer size that should never trigger ERANGE; if this
  18. proves too small, we intentionally abort(), to remind us to fix
  19. this value. */
  20. # define STACKBUF_LEN 256
  21. /* If ERRNUM maps to an errno value defined by gnulib, return a string
  22. describing the error. Otherwise return NULL. */
  23. # if REPLACE_STRERROR_0 \
  24. || GNULIB_defined_ESOCK \
  25. || GNULIB_defined_ESTREAMS \
  26. || GNULIB_defined_EWINSOCK \
  27. || GNULIB_defined_ENOMSG \
  28. || GNULIB_defined_EIDRM \
  29. || GNULIB_defined_ENOLINK \
  30. || GNULIB_defined_EPROTO \
  31. || GNULIB_defined_EMULTIHOP \
  32. || GNULIB_defined_EBADMSG \
  33. || GNULIB_defined_EOVERFLOW \
  34. || GNULIB_defined_ENOTSUP \
  35. || GNULIB_defined_ENETRESET \
  36. || GNULIB_defined_ECONNABORTED \
  37. || GNULIB_defined_ESTALE \
  38. || GNULIB_defined_EDQUOT \
  39. || GNULIB_defined_ECANCELED \
  40. || GNULIB_defined_EOWNERDEAD \
  41. || GNULIB_defined_ENOTRECOVERABLE \
  42. || GNULIB_defined_EILSEQ
  43. extern const char *strerror_override (int errnum) _GL_ATTRIBUTE_CONST;
  44. # else
  45. # define strerror_override(ignored) NULL
  46. # endif
  47. #endif /* _GL_STRERROR_OVERRIDE_H */