From f106775df14dbd1af2f1e0d3b1b3c67c167f8ce0 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Fri, 16 Aug 2002 04:49:08 +0000 Subject: Replace all instances of _LIBC_REENTRANT with __UCLIBC_HAS_THREADS__ -Erik --- Rules.mak | 3 --- include/netdb.h | 6 +++--- include/resolv.h | 2 +- libc/inet/rpc/rcmd.c | 20 ++++++++++---------- libc/sysdeps/linux/common/bits/errno.h | 2 +- libc/sysdeps/linux/i386/syscall.S | 8 ++++---- libc/sysdeps/linux/i386/vfork.S | 8 ++++---- libc/sysdeps/linux/mips/bits/errno.h | 2 +- 8 files changed, 24 insertions(+), 27 deletions(-) diff --git a/Rules.mak b/Rules.mak index 53e324081..5a912ae6d 100644 --- a/Rules.mak +++ b/Rules.mak @@ -120,9 +120,6 @@ endif ifeq ($(strip $(DOPIC)),true) CFLAGS += -fPIC endif -ifeq ($(strip $(INCLUDE_THREADS)),true) - CFLAGS += -D_LIBC_REENTRANT -endif # Currently locale support requires wide char support. ifeq ($(strip $(HAS_LOCALE)),true) HAS_WCHAR:=true diff --git a/include/netdb.h b/include/netdb.h index c3e07728c..ffa9cd524 100644 --- a/include/netdb.h +++ b/include/netdb.h @@ -60,7 +60,7 @@ extern int h_errno; extern int *__h_errno_location (void) __THROW __attribute__ ((__const__)); #ifdef _LIBC -# ifdef _LIBC_REENTRANT +# ifdef __UCLIBC_HAS_THREADS__ static inline int __set_h_errno (int __err) { @@ -68,11 +68,11 @@ __set_h_errno (int __err) } # else # define __set_h_errno(x) (h_errno = (x)) -# endif /* _LIBC_REENTRANT */ +# endif /* __UCLIBC_HAS_THREADS__ */ #endif /* _LIBC */ -#if !defined _LIBC || defined _LIBC_REENTRANT +#if !defined _LIBC || defined __UCLIBC_HAS_THREADS__ /* Use a macro to access always the thread specific `h_errno' variable. */ # define h_errno (*__h_errno_location ()) #endif diff --git a/include/resolv.h b/include/resolv.h index 2d2258c7d..d77a42ecd 100644 --- a/include/resolv.h +++ b/include/resolv.h @@ -217,7 +217,7 @@ typedef struct __res_state *res_state; /* 0x00008000 */ /* Things involving an internal (static) resolver context. */ -#if !defined _LIBC || defined _LIBC_REENTRANT +#if !defined _LIBC || defined __UCLIBC_HAS_THREADS__ __BEGIN_DECLS extern struct __res_state *__res_state(void) __attribute__ ((__const__)); __END_DECLS diff --git a/libc/inet/rpc/rcmd.c b/libc/inet/rpc/rcmd.c index de7433d46..b8138497c 100644 --- a/libc/inet/rpc/rcmd.c +++ b/libc/inet/rpc/rcmd.c @@ -38,8 +38,8 @@ static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94"; #define __FORCE_GLIBC #include -#ifdef _LIBC_REENTRANT -#undef _LIBC_REENTRANT +#ifdef __UCLIBC_HAS_THREADS__ +#undef __UCLIBC_HAS_THREADS__ #warning FIXME I am not reentrant yet... #endif @@ -81,7 +81,7 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) const char *locuser, *remuser, *cmd; int *fd2p; { -#ifdef _LIBC_REENTRANT +#ifdef __UCLIBC_HAS_THREADS__ int herr; struct hostent hostbuf; size_t hstbuflen; @@ -97,7 +97,7 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) pid = getpid(); -#ifdef _LIBC_REENTRANT +#ifdef __UCLIBC_HAS_THREADS__ hstbuflen = 1024; #ifdef __UCLIBC_HAS_MMU__ tmphstbuf = alloca (hstbuflen); @@ -304,14 +304,14 @@ int ruserok(rhost, superuser, ruser, luser) struct hostent *hp; u_int32_t addr; char **ap; -#ifdef _LIBC_REENTRANT +#ifdef __UCLIBC_HAS_THREADS__ size_t buflen; char *buffer; int herr; struct hostent hostbuf; #endif -#ifdef _LIBC_REENTRANT +#ifdef __UCLIBC_HAS_THREADS__ buflen = 1024; #ifdef __UCLIBC_HAS_MMU__ buffer = alloca (buflen); @@ -437,7 +437,7 @@ iruserok2 (raddr, superuser, ruser, luser, rhost) size_t dirlen; uid_t uid; -#ifdef _LIBC_REENTRANT +#ifdef __UCLIBC_HAS_THREADS__ size_t buflen = sysconf (_SC_GETPW_R_SIZE_MAX); struct passwd pwdbuf; #ifdef __UCLIBC_HAS_MMU__ @@ -520,7 +520,7 @@ __icheckhost (u_int32_t raddr, char *lhost, const char *rhost) int negate=1; /* Multiply return with this to get -1 instead of 1 */ char **pp; -#ifdef _LIBC_REENTRANT +#ifdef __UCLIBC_HAS_THREADS__ int save_errno; size_t buflen; char *buffer; @@ -550,7 +550,7 @@ __icheckhost (u_int32_t raddr, char *lhost, const char *rhost) return negate * (! (raddr ^ laddr)); /* Better be a hostname. */ -#ifdef _LIBC_REENTRANT +#ifdef __UCLIBC_HAS_THREADS__ buflen = 1024; buffer = malloc(buflen); save_errno = errno; @@ -564,7 +564,7 @@ __icheckhost (u_int32_t raddr, char *lhost, const char *rhost) __set_errno (save_errno); #else hp = gethostbyname(lhost); -#endif /* _LIBC_REENTRANT */ +#endif /* __UCLIBC_HAS_THREADS__ */ if (hp == NULL) return 0; diff --git a/libc/sysdeps/linux/common/bits/errno.h b/libc/sysdeps/linux/common/bits/errno.h index ac59d4c9d..97e4320f5 100644 --- a/libc/sysdeps/linux/common/bits/errno.h +++ b/libc/sysdeps/linux/common/bits/errno.h @@ -43,7 +43,7 @@ extern int *__errno_location (void) __THROW __attribute__ ((__const__)); # define __set_errno(val) (*__errno_location ()) = (val) # endif /* _LIBC */ -# if !defined _LIBC || defined _LIBC_REENTRANT +# if !defined _LIBC || defined __UCLIBC_HAS_THREADS__ /* When using threads, errno is a per-thread value. */ # define errno (*__errno_location ()) # endif diff --git a/libc/sysdeps/linux/i386/syscall.S b/libc/sysdeps/linux/i386/syscall.S index c67b39ece..a70a99701 100644 --- a/libc/sysdeps/linux/i386/syscall.S +++ b/libc/sysdeps/linux/i386/syscall.S @@ -47,21 +47,21 @@ Lhere: addl $_GLOBAL_OFFSET_TABLE_+[.-Lhere],%ebx negl %eax movl %eax,%ecx -#ifdef _LIBC_REENTRANT +#ifdef __UCLIBC_HAS_THREADS__ call __errno_location@PLT #else movl errno@GOT(%ebx),%eax -#endif /* _LIBC_REENTRANT */ +#endif /* __UCLIBC_HAS_THREADS__ */ movl %ecx,(%eax) #else negl %eax -#ifdef _LIBC_REENTRANT +#ifdef __UCLIBC_HAS_THREADS__ movl %eax,%ecx call __errno_location movl %ecx,(%eax) #else movl %eax,errno -#endif /* _LIBC_REENTRANT */ +#endif /* __UCLIBC_HAS_THREADS__ */ #endif /* PIC */ diff --git a/libc/sysdeps/linux/i386/vfork.S b/libc/sysdeps/linux/i386/vfork.S index 10e95b170..176f25cc3 100644 --- a/libc/sysdeps/linux/i386/vfork.S +++ b/libc/sysdeps/linux/i386/vfork.S @@ -36,22 +36,22 @@ vfork: addl $_GLOBAL_OFFSET_TABLE_+[.-.Lhere],%ebx negl %eax movl %eax,%ecx -#ifdef _LIBC_REENTRANT +#ifdef __UCLIBC_HAS_THREADS__ call __errno_location@PLT #else movl errno@GOT(%ebx),%eax -#endif /* _LIBC_REENTRANT */ +#endif /* __UCLIBC_HAS_THREADS__ */ movl %ecx,(%eax) popl %ebx #else negl %eax -#ifdef _LIBC_REENTRANT +#ifdef __UCLIBC_HAS_THREADS__ movl %eax,%ecx call __errno_location movl %ecx,(%eax) #else movl %eax,errno -#endif /* _LIBC_REENTRANT */ +#endif /* __UCLIBC_HAS_THREADS__ */ #endif /* PIC */ diff --git a/libc/sysdeps/linux/mips/bits/errno.h b/libc/sysdeps/linux/mips/bits/errno.h index 29ba9807a..ca9c32fed 100644 --- a/libc/sysdeps/linux/mips/bits/errno.h +++ b/libc/sysdeps/linux/mips/bits/errno.h @@ -39,7 +39,7 @@ extern int *__errno_location (void) __THROW __attribute__ ((__const__)); # define __set_errno(val) (*__errno_location ()) = (val) # endif /* _LIBC */ -# if !defined _LIBC || defined _LIBC_REENTRANT +# if !defined _LIBC || defined __UCLIBC_HAS_THREADS__ /* When using threads, errno is a per-thread value. */ # define errno (*__errno_location ()) # endif -- cgit v1.2.3