errno.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef _ERRNO_H
  2. #include <stdlib/errno.h>
  3. #if !defined _ISOMAC && !defined __ASSEMBLER__
  4. # if IS_IN (rtld)
  5. # include <dl-sysdep.h>
  6. # ifndef RTLD_PRIVATE_ERRNO
  7. # error "dl-sysdep.h must define RTLD_PRIVATE_ERRNO!"
  8. # endif
  9. # else
  10. # define RTLD_PRIVATE_ERRNO 0
  11. # endif
  12. # if RTLD_PRIVATE_ERRNO
  13. /* The dynamic linker uses its own private errno variable.
  14. All access to errno inside the dynamic linker is serialized,
  15. so a single (hidden) global variable is all it needs. */
  16. # undef errno
  17. # define errno rtld_errno
  18. extern int rtld_errno attribute_hidden;
  19. # elif IS_IN_LIB && !IS_IN (rtld) && !defined LIBC_NONSHARED
  20. # undef errno
  21. # if IS_IN (libc)
  22. # define errno __libc_errno
  23. # else
  24. # define errno errno /* For #ifndef errno tests. */
  25. # endif
  26. extern __thread int errno attribute_tls_model_ie;
  27. # endif /* IS_IN_LIB */
  28. # define __set_errno(val) (errno = (val))
  29. extern int *__errno_location (void) __THROW __attribute_const__
  30. # if RTLD_PRIVATE_ERRNO
  31. attribute_hidden
  32. # endif
  33. ;
  34. libc_hidden_proto (__errno_location)
  35. #endif /* !_ISOMAC && !__ASSEMBLER__ */
  36. #endif /* !_ERRNO_H */