about summary refs log tree commit diff
path: root/include/errno.h
blob: eed947fd3052134308ff7707cd1bd9f4595a7e2f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef _ERRNO_H

#include <stdlib/errno.h>

#if defined _ERRNO_H && !defined _ISOMAC

# ifdef IS_IN_rtld
#  include <dl-sysdep.h>
# endif

# if RTLD_PRIVATE_ERRNO
/* The dynamic linker uses its own private errno variable.
   All access to errno inside the dynamic linker is serialized,
   so a single (hidden) global variable is all it needs.  */

#  undef  errno
#  define errno errno		/* For #ifndef errno tests.  */
extern int errno attribute_hidden;
#  define __set_errno(val) (errno = (val))

# else

#  include <tls.h>		/* Defines USE_TLS.  */

#  if USE___THREAD
#   undef  errno
#   define errno errno		/* For #ifndef errno tests.  */
extern __thread int errno;
#   define __set_errno(val) (errno = (val))
#  else
#   define __set_errno(val) (*__errno_location ()) = (val)
#  endif

# endif	/* RTLD_PRIVATE_ERRNO */

#endif /* _ERRNO_H */

#endif /* ! _ERRNO_H */