Bug 203317: getipnodebyxxx routines are not thread-safe on OpenVMS, so we

need to lock around them.  The patch is contributed by Colin Blake
<colin@theblakes.com>.  r=wtc.
Modified Files: configure configure.in prnetdb.c
This commit is contained in:
wtc%netscape.com 2003-04-30 00:44:16 +00:00
Родитель 4b18dbd475
Коммит ac2dd722a6
3 изменённых файлов: 45 добавлений и 22 удалений

48
nsprpub/configure поставляемый
Просмотреть файл

@ -4145,6 +4145,10 @@ EOF
cat >> confdefs.h <<\EOF cat >> confdefs.h <<\EOF
#define VMS 1 #define VMS 1
EOF
cat >> confdefs.h <<\EOF
#define PR_GETIPNODE_NOT_THREADSAFE 1
EOF EOF
RESOLVE_LINK_SYMBOLS=1 RESOLVE_LINK_SYMBOLS=1
@ -4194,17 +4198,17 @@ EOF
_OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Olimit 4000" _OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Olimit 4000"
ac_safe=`echo "machine/builtins.h" | sed 'y%./+-%__p_%'` ac_safe=`echo "machine/builtins.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for machine/builtins.h""... $ac_c" 1>&6 echo $ac_n "checking for machine/builtins.h""... $ac_c" 1>&6
echo "configure:4198: checking for machine/builtins.h" >&5 echo "configure:4202: checking for machine/builtins.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 4203 "configure" #line 4207 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <machine/builtins.h> #include <machine/builtins.h>
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:4208: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } { (eval echo configure:4212: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then if test -z "$ac_err"; then
rm -rf conftest* rm -rf conftest*
@ -4715,12 +4719,12 @@ esac
if test -z "$SKIP_LIBRARY_CHECKS"; then if test -z "$SKIP_LIBRARY_CHECKS"; then
echo $ac_n "checking for dlopen""... $ac_c" 1>&6 echo $ac_n "checking for dlopen""... $ac_c" 1>&6
echo "configure:4719: checking for dlopen" >&5 echo "configure:4723: checking for dlopen" >&5
if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 4724 "configure" #line 4728 "configure"
#include "confdefs.h" #include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes, /* System header to define __stub macros and hopefully few prototypes,
which can conflict with char dlopen(); below. */ which can conflict with char dlopen(); below. */
@ -4743,7 +4747,7 @@ dlopen();
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:4747: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:4751: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_func_dlopen=yes" eval "ac_cv_func_dlopen=yes"
else else
@ -4762,7 +4766,7 @@ else
echo "$ac_t""no" 1>&6 echo "$ac_t""no" 1>&6
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
echo "configure:4766: checking for dlopen in -ldl" >&5 echo "configure:4770: checking for dlopen in -ldl" >&5
ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
@ -4770,7 +4774,7 @@ else
ac_save_LIBS="$LIBS" ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS" LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 4774 "configure" #line 4778 "configure"
#include "confdefs.h" #include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */ /* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2 /* We use char because int might match the return type of a gcc2
@ -4781,7 +4785,7 @@ int main() {
dlopen() dlopen()
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:4785: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:4789: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes" eval "ac_cv_lib_$ac_lib_var=yes"
else else
@ -4809,13 +4813,13 @@ fi
if test $ac_cv_prog_gcc = yes; then if test $ac_cv_prog_gcc = yes; then
echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
echo "configure:4813: checking whether ${CC-cc} needs -traditional" >&5 echo "configure:4817: checking whether ${CC-cc} needs -traditional" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
ac_pattern="Autoconf.*'x'" ac_pattern="Autoconf.*'x'"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 4819 "configure" #line 4823 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <sgtty.h> #include <sgtty.h>
Autoconf TIOCGETP Autoconf TIOCGETP
@ -4833,7 +4837,7 @@ rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 4837 "configure" #line 4841 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <termio.h> #include <termio.h>
Autoconf TCGETA Autoconf TCGETA
@ -4857,12 +4861,12 @@ fi
for ac_func in lchown strerror for ac_func in lchown strerror
do do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:4861: checking for $ac_func" >&5 echo "configure:4865: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 4866 "configure" #line 4870 "configure"
#include "confdefs.h" #include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes, /* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */ which can conflict with char $ac_func(); below. */
@ -4885,7 +4889,7 @@ $ac_func();
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:4889: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:4893: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_func_$ac_func=yes" eval "ac_cv_func_$ac_func=yes"
else else
@ -4924,7 +4928,7 @@ hpux*)
if test -z "$GNU_CC"; then if test -z "$GNU_CC"; then
echo $ac_n "checking for +Olit support""... $ac_c" 1>&6 echo $ac_n "checking for +Olit support""... $ac_c" 1>&6
echo "configure:4928: checking for +Olit support" >&5 echo "configure:4932: checking for +Olit support" >&5
if eval "test \"`echo '$''{'ac_cv_hpux_usable_olit_option'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_hpux_usable_olit_option'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -4958,7 +4962,7 @@ esac
echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6 echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6
echo "configure:4962: checking for pthread_create in -lpthreads" >&5 echo "configure:4966: checking for pthread_create in -lpthreads" >&5
echo " echo "
#include <pthread.h> #include <pthread.h>
void *foo(void *v) { return v; } void *foo(void *v) { return v; }
@ -4980,7 +4984,7 @@ echo "
echo "$ac_t""no" 1>&6 echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
echo "configure:4984: checking for pthread_create in -lpthread" >&5 echo "configure:4988: checking for pthread_create in -lpthread" >&5
echo " echo "
#include <pthread.h> #include <pthread.h>
void *foo(void *v) { return v; } void *foo(void *v) { return v; }
@ -5002,7 +5006,7 @@ echo "
echo "$ac_t""no" 1>&6 echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6 echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
echo "configure:5006: checking for pthread_create in -lc_r" >&5 echo "configure:5010: checking for pthread_create in -lc_r" >&5
echo " echo "
#include <pthread.h> #include <pthread.h>
void *foo(void *v) { return v; } void *foo(void *v) { return v; }
@ -5024,7 +5028,7 @@ echo "
echo "$ac_t""no" 1>&6 echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6 echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6
echo "configure:5028: checking for pthread_create in -lc" >&5 echo "configure:5032: checking for pthread_create in -lc" >&5
echo " echo "
#include <pthread.h> #include <pthread.h>
void *foo(void *v) { return v; } void *foo(void *v) { return v; }
@ -5176,7 +5180,7 @@ if test -n "$USE_PTHREADS"; then
rm -f conftest* rm -f conftest*
ac_cv_have_dash_pthread=no ac_cv_have_dash_pthread=no
echo $ac_n "checking whether ${CC-cc} accepts -pthread""... $ac_c" 1>&6 echo $ac_n "checking whether ${CC-cc} accepts -pthread""... $ac_c" 1>&6
echo "configure:5180: checking whether ${CC-cc} accepts -pthread" >&5 echo "configure:5184: checking whether ${CC-cc} accepts -pthread" >&5
echo 'int main() { return 0; }' | cat > conftest.c echo 'int main() { return 0; }' | cat > conftest.c
${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
if test $? -eq 0; then if test $? -eq 0; then
@ -5199,7 +5203,7 @@ echo "configure:5180: checking whether ${CC-cc} accepts -pthread" >&5
ac_cv_have_dash_pthreads=no ac_cv_have_dash_pthreads=no
if test "$ac_cv_have_dash_pthread" = "no"; then if test "$ac_cv_have_dash_pthread" = "no"; then
echo $ac_n "checking whether ${CC-cc} accepts -pthreads""... $ac_c" 1>&6 echo $ac_n "checking whether ${CC-cc} accepts -pthreads""... $ac_c" 1>&6
echo "configure:5203: checking whether ${CC-cc} accepts -pthreads" >&5 echo "configure:5207: checking whether ${CC-cc} accepts -pthreads" >&5
echo 'int main() { return 0; }' | cat > conftest.c echo 'int main() { return 0; }' | cat > conftest.c
${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
if test $? -eq 0; then if test $? -eq 0; then

Просмотреть файл

@ -1501,6 +1501,7 @@ mips-sony-newsos*)
*-openvms*) *-openvms*)
AC_DEFINE(XP_UNIX) AC_DEFINE(XP_UNIX)
AC_DEFINE(VMS) AC_DEFINE(VMS)
AC_DEFINE(PR_GETIPNODE_NOT_THREADSAFE)
RESOLVE_LINK_SYMBOLS=1 RESOLVE_LINK_SYMBOLS=1
AR_FLAGS='c $@' AR_FLAGS='c $@'
MDCPUCFG_H=_openvms.cfg MDCPUCFG_H=_openvms.cfg

Просмотреть файл

@ -874,7 +874,12 @@ PR_IMPLEMENT(PRStatus) PR_GetIPNodeByName(
#endif /* _PR_HAVE_GETHOSTBYNAME2 */ #endif /* _PR_HAVE_GETHOSTBYNAME2 */
#elif defined(_PR_INET6_PROBE) && defined(_PR_HAVE_GETIPNODEBYNAME) #elif defined(_PR_INET6_PROBE) && defined(_PR_HAVE_GETIPNODEBYNAME)
if (_pr_ipv6_is_present == PR_TRUE) if (_pr_ipv6_is_present == PR_TRUE)
{
#ifdef PR_GETIPNODE_NOT_THREADSAFE
LOCK_DNS();
#endif
h = (*((_pr_getipnodebyname_t)_pr_getipnodebyname_fp))(name, md_af, tmp_flags, &error_num); h = (*((_pr_getipnodebyname_t)_pr_getipnodebyname_fp))(name, md_af, tmp_flags, &error_num);
}
else else
{ {
LOCK_DNS(); LOCK_DNS();
@ -934,8 +939,12 @@ PR_IMPLEMENT(PRStatus) PR_GetIPNodeByName(
UNLOCK_DNS(); UNLOCK_DNS();
#endif /* _PR_HAVE_GETHOSTBYNAME2 */ #endif /* _PR_HAVE_GETHOSTBYNAME2 */
#elif defined(_PR_INET6_PROBE) && defined(_PR_HAVE_GETIPNODEBYNAME) #elif defined(_PR_INET6_PROBE) && defined(_PR_HAVE_GETIPNODEBYNAME)
#ifdef PR_GETIPNODE_NOT_THREADSAFE
UNLOCK_DNS();
#else
if (_pr_ipv6_is_present == PR_FALSE) if (_pr_ipv6_is_present == PR_FALSE)
UNLOCK_DNS(); UNLOCK_DNS();
#endif
#else /* _PR_INET6 */ #else /* _PR_INET6 */
UNLOCK_DNS(); UNLOCK_DNS();
#endif /* _PR_INET6 */ #endif /* _PR_INET6 */
@ -1035,8 +1044,13 @@ PR_IMPLEMENT(PRStatus) PR_GetHostByAddr(
h = getipnodebyaddr(addr, addrlen, af, &error_num); h = getipnodebyaddr(addr, addrlen, af, &error_num);
#elif defined(_PR_HAVE_GETIPNODEBYADDR) && defined(_PR_INET6_PROBE) #elif defined(_PR_HAVE_GETIPNODEBYADDR) && defined(_PR_INET6_PROBE)
if (_pr_ipv6_is_present == PR_TRUE) if (_pr_ipv6_is_present == PR_TRUE)
{
#ifdef PR_GETIPNODE_NOT_THREADSAFE
LOCK_DNS();
#endif
h = (*((_pr_getipnodebyaddr_t)_pr_getipnodebyaddr_fp))(addr, addrlen, h = (*((_pr_getipnodebyaddr_t)_pr_getipnodebyaddr_fp))(addr, addrlen,
af, &error_num); af, &error_num);
}
else else
{ {
LOCK_DNS(); LOCK_DNS();
@ -1092,8 +1106,12 @@ PR_IMPLEMENT(PRStatus) PR_GetHostByAddr(
/* Must match the convoluted logic above for LOCK_DNS() */ /* Must match the convoluted logic above for LOCK_DNS() */
#if defined(_PR_HAVE_GETIPNODEBYADDR) && defined(_PR_INET6) #if defined(_PR_HAVE_GETIPNODEBYADDR) && defined(_PR_INET6)
#elif defined(_PR_HAVE_GETIPNODEBYADDR) && defined(_PR_INET6_PROBE) #elif defined(_PR_HAVE_GETIPNODEBYADDR) && defined(_PR_INET6_PROBE)
#ifdef PR_GETIPNODE_NOT_THREADSAFE
UNLOCK_DNS();
#else
if (_pr_ipv6_is_present == PR_FALSE) if (_pr_ipv6_is_present == PR_FALSE)
UNLOCK_DNS(); UNLOCK_DNS();
#endif
#else /* _PR_HAVE_GETIPNODEBYADDR */ #else /* _PR_HAVE_GETIPNODEBYADDR */
UNLOCK_DNS(); UNLOCK_DNS();
#endif /* _PR_HAVE_GETIPNODEBYADDR */ #endif /* _PR_HAVE_GETIPNODEBYADDR */