From owner-freebsd-arch Thu Jan 23 13:50:35 2003 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9F18B37B401 for ; Thu, 23 Jan 2003 13:50:33 -0800 (PST) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id 77FFA43ED8 for ; Thu, 23 Jan 2003 13:50:32 -0800 (PST) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.6/8.12.3) with ESMTP id h0NLoU1e003401; Thu, 23 Jan 2003 14:50:30 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Thu, 23 Jan 2003 14:49:33 -0700 (MST) Message-Id: <20030123.144933.13389746.imp@bsdimp.com> To: eischen@pcnet1.pcnet.com Cc: ben@timing.com, freebsd-arch@FreeBSD.ORG Subject: Re: _REENTRANT in math.h & libm oddities. From: "M. Warner Losh" In-Reply-To: References: <200301232122.h0NLM31e003077@harmony.village.org> X-Mailer: Mew version 2.1 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In message: Daniel Eischen writes: : On Thu, 23 Jan 2003, Warner Losh wrote: : : > In message Daniel Eischen writes: : > : The gcc manpage is wrong. It should state _REENTRANT instead of : > : _THREAD_SAFE. POSIX specifies that _REENTRANT be defined to get : > : these functions. I know that we always provide implementations : > : of most of these _r functions so it might not make sense to : > : #ifdef them in the header files, but I don't know that always : > : making them visible would be against the spec or cause namespace : > : pollution. : > : > Then FreeBSD's source tree is basically wrong, since it uses : > _THREAD_SAFE for this in many places. But most of them appear to be : > just defining the macro for compiles and such. There's a little bit : > in libc's stdio still, but that's the only significant place that uses : > it in the tree. I'm not sure about out-of-tree software. : : I removed a lot of the _THREAD_SAFE stuff a couple of years ago, : but it wasn't complete removed. -stable might be worse off. In a newish tree it looks like there are only 3 'real' places where we're wrong: find . -type f | xargs egrep _THREAD_SAFE code: ./contrib/ntp/ntpd/refclock_pcf.c:#if defined(_REENTRANT) || defined(_THREAD_SAFE) ./include/rpc/clnt.h:#ifdef _THREAD_SAFE ./include/rpc/clnt.h:#endif /* _THREAD_SAFE */ ./lib/libc_r/sys/uthread_error.c:#ifdef _THREAD_SAFE ./lib/libpthread/sys/thr_error.c:#ifdef _THREAD_SAFE docs or config or false positive: ./contrib/gcc/gcc.1:into user-threaded processes should be compiled with -D_THREAD_SAFE. ./contrib/gcc/gcc.1:-D_THREAD_SAFE. ./contrib/gcc/config/rs6000/aix41.h: %{pthread: -D_THREAD_SAFE}\ ./contrib/gcc/config/rs6000/aix43.h: %{pthread: -D_THREAD_SAFE}\ ./contrib/gcc/config/rs6000/aix43.h: %{pthread: -D_THREAD_SAFE}\ ./contrib/gcc/config/rs6000/aix51.h: %{pthread: -D_THREAD_SAFE}\ ./contrib/gcc/config/rs6000/aix51.h: %{pthread: -D_THREAD_SAFE}\ ./contrib/gcc/gthr-aix.h:#ifdef _THREAD_SAFE ./crypto/heimdal/configure: dpagaix_cflags="-D_THREAD_SAFE -D_AIX_PTHREADS_D7 -D_AIX32_THREADS=1 -D_AES_SOURCE -D_AIX41 -I/usr/include/dce" ./crypto/heimdal/configure.in: dpagaix_cflags="-D_THREAD_SAFE -D_AIX_PTHREADS_D7 -D_AIX32_THREADS=1 -D_AES_SOURCE -D_AIX41 -I/usr/include/dce" ./crypto/openssl/Configure:"FreeBSD-elf", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::-pthread -D_REENTRANT -D_THREAD_SAFE -D_THREADSAFE::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ./crypto/openssl/crypto/rsa/rsa.h:#define RSA_FLAG_THREAD_SAFE 0x10 ./include/unistd.h:#define _POSIX_THREAD_SAFE_FUNCTIONS -1 ./include/unistd.h:#define _SC_THREAD_SAFE_FUNCTIONS 91 /* user */ ./lib/libc/gen/sysconf.c:#if _POSIX_THREAD_SAFE_FUNCTIONS > -1 ./lib/libc/gen/sysconf.c: case _SC_THREAD_SAFE_FUNCTIONS: ./lib/libc/gen/sysconf.c: return (_POSIX_THREAD_SAFE_FUNCTIONS); ./lib/libc_r/Makefile:CFLAGS+=-DPTHREAD_KERNEL -D_THREAD_SAFE ./lib/libmilter/Makefile:CFLAGS+=-D_THREAD_SAFE ./lib/libpthread/Makefile:CFLAGS+=-DPTHREAD_KERNEL -D_THREAD_SAFE ./usr.bin/getconf/sysconf.gperf:_POSIX_THREAD_SAFE_FUNCTIONS, _SC_THREAD_SAFE_FUNCTIONS To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message