PowerPC: Fix -Wundef warning for __PTHREAD_MUTEX_HAVE_ELISION.
[glibc.git] / include / errno.h
blobdbf2a61e0d4d5d0579f54c8ec4ca0ce7ab4c44cd
1 #ifndef _ERRNO_H
3 #include <stdlib/errno.h>
5 #if defined _ERRNO_H && !defined _ISOMAC && !defined __cplusplus
7 # ifdef IS_IN_rtld
8 # include <dl-sysdep.h>
9 # ifndef RTLD_PRIVATE_ERRNO
10 # error "dl-sysdep.h must define RTLD_PRIVATE_ERRNO!"
11 # endif
12 # else
13 # define RTLD_PRIVATE_ERRNO 0
14 # endif
16 # if RTLD_PRIVATE_ERRNO
17 /* The dynamic linker uses its own private errno variable.
18 All access to errno inside the dynamic linker is serialized,
19 so a single (hidden) global variable is all it needs. */
21 # undef errno
22 # define errno rtld_errno
23 extern int rtld_errno attribute_hidden;
25 # elif !defined NOT_IN_libc || defined IN_LIB
27 # include <tls.h>
29 # undef errno
30 # ifndef NOT_IN_libc
31 # define errno __libc_errno
32 # else
33 # define errno errno /* For #ifndef errno tests. */
34 # endif
35 extern __thread int errno attribute_tls_model_ie;
37 # endif /* !NOT_IN_libc || IN_LIB */
39 # define __set_errno(val) (errno = (val))
41 # ifndef __ASSEMBLER__
42 extern int *__errno_location (void) __THROW __attribute__ ((__const__))
43 # if RTLD_PRIVATE_ERRNO
44 attribute_hidden
45 # endif
47 libc_hidden_proto (__errno_location)
48 # endif
50 #endif /* _ERRNO_H */
52 #endif /* ! _ERRNO_H */