diff options
author | wtc%netscape.com <devnull@localhost> | 2003-04-30 00:36:39 +0000 |
---|---|---|
committer | wtc%netscape.com <devnull@localhost> | 2003-04-30 00:36:39 +0000 |
commit | e59bc30c264398410b0c1309072f747202c0303a (patch) | |
tree | 7749ca21ad4af700d27dd5115ea117dc1e9a0bde | |
parent | 5b5831cd3596a8b83aea873c40d4c7d8deeb999c (diff) | |
download | nspr-hg-e59bc30c264398410b0c1309072f747202c0303a.tar.gz |
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. a=dbaron for mozilla 1.4b.
Modified Files: configure configure.in prnetdb.c
Tag: NSPRPUB_PRE_4_2_CLIENT_BRANCH
-rwxr-xr-x | configure | 50 | ||||
-rw-r--r-- | configure.in | 1 | ||||
-rw-r--r-- | pr/src/misc/prnetdb.c | 18 |
3 files changed, 46 insertions, 23 deletions
@@ -4147,6 +4147,10 @@ EOF #define VMS 1 EOF + cat >> confdefs.h <<\EOF +#define PR_GETIPNODE_NOT_THREADSAFE 1 +EOF + RESOLVE_LINK_SYMBOLS=1 AR_FLAGS='c $@' MDCPUCFG_H=_openvms.cfg @@ -4194,17 +4198,17 @@ EOF _OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Olimit 4000" ac_safe=`echo "machine/builtins.h" | sed 'y%./+-%__p_%'` 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 echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4203 "configure" +#line 4207 "configure" #include "confdefs.h" #include <machine/builtins.h> EOF 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}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4716,12 +4720,12 @@ esac if test -z "$SKIP_LIBRARY_CHECKS"; then echo $ac_n "checking for dlopen""... $ac_c" 1>&6 -echo "configure:4720: checking for dlopen" >&5 +echo "configure:4724: checking for dlopen" >&5 if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4725 "configure" +#line 4729 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char dlopen(); below. */ @@ -4744,7 +4748,7 @@ dlopen(); ; return 0; } EOF -if { (eval echo configure:4748: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4752: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_dlopen=yes" else @@ -4763,7 +4767,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:4767: checking for dlopen in -ldl" >&5 +echo "configure:4771: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4771,7 +4775,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <<EOF -#line 4775 "configure" +#line 4779 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4782,7 +4786,7 @@ int main() { dlopen() ; return 0; } EOF -if { (eval echo configure:4786: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4790: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4810,13 +4814,13 @@ fi if test $ac_cv_prog_gcc = yes; then echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:4814: checking whether ${CC-cc} needs -traditional" >&5 +echo "configure:4818: checking whether ${CC-cc} needs -traditional" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_pattern="Autoconf.*'x'" cat > conftest.$ac_ext <<EOF -#line 4820 "configure" +#line 4824 "configure" #include "confdefs.h" #include <sgtty.h> Autoconf TIOCGETP @@ -4834,7 +4838,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext <<EOF -#line 4838 "configure" +#line 4842 "configure" #include "confdefs.h" #include <termio.h> Autoconf TCGETA @@ -4858,12 +4862,12 @@ fi for ac_func in lchown strerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4862: checking for $ac_func" >&5 +echo "configure:4866: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4867 "configure" +#line 4871 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4886,7 +4890,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4890: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4894: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4925,7 +4929,7 @@ hpux*) if test -z "$GNU_CC"; then echo $ac_n "checking for +Olit support""... $ac_c" 1>&6 -echo "configure:4929: checking for +Olit support" >&5 +echo "configure:4933: checking for +Olit support" >&5 if eval "test \"`echo '$''{'ac_cv_hpux_usable_olit_option'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4959,7 +4963,7 @@ esac echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6 -echo "configure:4963: checking for pthread_create in -lpthreads" >&5 +echo "configure:4967: checking for pthread_create in -lpthreads" >&5 echo " #include <pthread.h> void *foo(void *v) { return v; } @@ -4981,7 +4985,7 @@ echo " echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 -echo "configure:4985: checking for pthread_create in -lpthread" >&5 +echo "configure:4989: checking for pthread_create in -lpthread" >&5 echo " #include <pthread.h> void *foo(void *v) { return v; } @@ -5003,7 +5007,7 @@ echo " echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6 -echo "configure:5007: checking for pthread_create in -lc_r" >&5 +echo "configure:5011: checking for pthread_create in -lc_r" >&5 echo " #include <pthread.h> void *foo(void *v) { return v; } @@ -5025,7 +5029,7 @@ echo " echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6 -echo "configure:5029: checking for pthread_create in -lc" >&5 +echo "configure:5033: checking for pthread_create in -lc" >&5 echo " #include <pthread.h> void *foo(void *v) { return v; } @@ -5177,7 +5181,7 @@ if test -n "$USE_PTHREADS"; then rm -f conftest* ac_cv_have_dash_pthread=no echo $ac_n "checking whether ${CC-cc} accepts -pthread""... $ac_c" 1>&6 -echo "configure:5181: checking whether ${CC-cc} accepts -pthread" >&5 +echo "configure:5185: checking whether ${CC-cc} accepts -pthread" >&5 echo 'int main() { return 0; }' | cat > conftest.c ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1 if test $? -eq 0; then @@ -5200,7 +5204,7 @@ echo "configure:5181: checking whether ${CC-cc} accepts -pthread" >&5 ac_cv_have_dash_pthreads=no if test "$ac_cv_have_dash_pthread" = "no"; then echo $ac_n "checking whether ${CC-cc} accepts -pthreads""... $ac_c" 1>&6 -echo "configure:5204: checking whether ${CC-cc} accepts -pthreads" >&5 +echo "configure:5208: checking whether ${CC-cc} accepts -pthreads" >&5 echo 'int main() { return 0; }' | cat > conftest.c ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1 if test $? -eq 0; then @@ -5715,7 +5719,7 @@ s%\[%\\&%g s%\]%\\&%g s%\$%$$%g EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' ' | tr '\015' ' '` rm -f conftest.defs diff --git a/configure.in b/configure.in index 22dd4195..3abf69ba 100644 --- a/configure.in +++ b/configure.in @@ -1501,6 +1501,7 @@ mips-sony-newsos*) *-openvms*) AC_DEFINE(XP_UNIX) AC_DEFINE(VMS) + AC_DEFINE(PR_GETIPNODE_NOT_THREADSAFE) RESOLVE_LINK_SYMBOLS=1 AR_FLAGS='c $@' MDCPUCFG_H=_openvms.cfg diff --git a/pr/src/misc/prnetdb.c b/pr/src/misc/prnetdb.c index c9206af7..dc89b891 100644 --- a/pr/src/misc/prnetdb.c +++ b/pr/src/misc/prnetdb.c @@ -874,7 +874,12 @@ PR_IMPLEMENT(PRStatus) PR_GetIPNodeByName( #endif /* _PR_HAVE_GETHOSTBYNAME2 */ #elif defined(_PR_INET6_PROBE) && defined(_PR_HAVE_GETIPNODEBYNAME) 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); + } else { LOCK_DNS(); @@ -934,8 +939,12 @@ PR_IMPLEMENT(PRStatus) PR_GetIPNodeByName( UNLOCK_DNS(); #endif /* _PR_HAVE_GETHOSTBYNAME2 */ #elif defined(_PR_INET6_PROBE) && defined(_PR_HAVE_GETIPNODEBYNAME) +#ifdef PR_GETIPNODE_NOT_THREADSAFE + UNLOCK_DNS(); +#else if (_pr_ipv6_is_present == PR_FALSE) UNLOCK_DNS(); +#endif #else /* _PR_INET6 */ UNLOCK_DNS(); #endif /* _PR_INET6 */ @@ -1035,8 +1044,13 @@ PR_IMPLEMENT(PRStatus) PR_GetHostByAddr( h = getipnodebyaddr(addr, addrlen, af, &error_num); #elif defined(_PR_HAVE_GETIPNODEBYADDR) && defined(_PR_INET6_PROBE) if (_pr_ipv6_is_present == PR_TRUE) + { +#ifdef PR_GETIPNODE_NOT_THREADSAFE + LOCK_DNS(); +#endif h = (*((_pr_getipnodebyaddr_t)_pr_getipnodebyaddr_fp))(addr, addrlen, af, &error_num); + } else { LOCK_DNS(); @@ -1092,8 +1106,12 @@ PR_IMPLEMENT(PRStatus) PR_GetHostByAddr( /* Must match the convoluted logic above for LOCK_DNS() */ #if defined(_PR_HAVE_GETIPNODEBYADDR) && defined(_PR_INET6) #elif defined(_PR_HAVE_GETIPNODEBYADDR) && defined(_PR_INET6_PROBE) +#ifdef PR_GETIPNODE_NOT_THREADSAFE + UNLOCK_DNS(); +#else if (_pr_ipv6_is_present == PR_FALSE) UNLOCK_DNS(); +#endif #else /* _PR_HAVE_GETIPNODEBYADDR */ UNLOCK_DNS(); #endif /* _PR_HAVE_GETIPNODEBYADDR */ |