uClibc_errno.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  3. *
  4. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  5. */
  6. #ifndef _BITS_UCLIBC_ERRNO_H
  7. #define _BITS_UCLIBC_ERRNO_H 1
  8. #ifdef IS_IN_rtld
  9. # undef errno
  10. # define errno _dl_errno
  11. extern int _dl_errno; // attribute_hidden;
  12. #elif defined __UCLIBC_HAS_THREADS__
  13. # include <tls.h>
  14. # if USE___THREAD
  15. # undef errno
  16. # ifndef NOT_IN_libc
  17. # define errno __libc_errno
  18. # else
  19. # define errno errno
  20. # endif
  21. extern __thread int errno __attribute_tls_model_ie;
  22. # endif /* USE___THREAD */
  23. #endif /* IS_IN_rtld */
  24. #define __set_errno(val) (errno = (val))
  25. #ifndef __ASSEMBLER__
  26. extern int *__errno_location (void) __THROW __attribute__ ((__const__))
  27. # ifdef IS_IN_rtld
  28. attribute_hidden
  29. # endif
  30. ;
  31. # if defined __UCLIBC_HAS_THREADS__
  32. # include <tls.h>
  33. # if USE___THREAD
  34. libc_hidden_proto(__errno_location)
  35. # endif
  36. # endif
  37. /* We now need a declaration of the `errno' variable. */
  38. # ifndef __UCLIBC_HAS_THREADS__
  39. /*extern int errno;*/
  40. libc_hidden_proto(errno)
  41. # endif
  42. #endif /* !__ASSEMBLER__ */
  43. #endif