glibc/include/errno.h
Siddhesh Poyarekar a10178bda1 Remove IN_LIB
Replace with IS_IN and IS_IN_LIB macros instead.  This change results
in a change in generated code, because it fixes a subtle bug.  The bug
was introduced when systemtap probes were added to lowlevellock.h,
which resulted in stap-probe.h being included in a number of places.
stap-probe.h always defines IN_LIB, which breaks a check in errno.h
and netdb.h since they rely on that macro to decide whether to
implement an internal version of a declaration or an external one.

The components that see a code change due to this are:

iconv_prog
libmemusage.so
libpcprofile.so
libSegFault.so
libutil.so.1
locale
localedef
nscd

All other built components (i.e. libc, libpthread, etc.) remain
unchanged by this on x86_64.

	* elf/Makefile (CPPFLAGS-.os): Remove IN_LIB.
	* elf/rtld-Rules (rtld-CPPFLAGS): Likewise.
	* extra-lib.mk (CPPFLAGS-$(lib)): Likewise.
	* include/libc-symbols.h (IS_IN_LIB): New macro.
	* include/errno.h: Use IS_IN_LIB instead of IN_LIB.
	* include/netdb.h: Likewise.
	* include/stap-probe.h: Remove all uses of IN_LIB.
2014-11-24 11:41:42 +05:30

53 lines
1.1 KiB
C

#ifndef _ERRNO_H
#include <stdlib/errno.h>
#if defined _ERRNO_H && !defined _ISOMAC && !defined __cplusplus
# ifdef IS_IN_rtld
# include <dl-sysdep.h>
# ifndef RTLD_PRIVATE_ERRNO
# error "dl-sysdep.h must define RTLD_PRIVATE_ERRNO!"
# endif
# else
# define RTLD_PRIVATE_ERRNO 0
# 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 rtld_errno
extern int rtld_errno attribute_hidden;
# elif !defined NOT_IN_libc || IS_IN_LIB
# include <tls.h>
# undef errno
# ifndef NOT_IN_libc
# define errno __libc_errno
# else
# define errno errno /* For #ifndef errno tests. */
# endif
extern __thread int errno attribute_tls_model_ie;
# endif /* !NOT_IN_libc || IS_IN_LIB */
# define __set_errno(val) (errno = (val))
# ifndef __ASSEMBLER__
extern int *__errno_location (void) __THROW __attribute__ ((__const__))
# if RTLD_PRIVATE_ERRNO
attribute_hidden
# endif
;
libc_hidden_proto (__errno_location)
# endif
#endif /* _ERRNO_H */
#endif /* ! _ERRNO_H */