Cleaned up the various errno location tests in configure.
Added (h_)errno_location pointers in the library that allow remapping
the calls in higher level dlls.
Moved X11DRV_CritSection out of sysdeps.c and into x11drv.dll.
diff --git a/configure b/configure
index 93aa8e1..793fd21 100755
--- a/configure
+++ b/configure
@@ -5218,31 +5218,34 @@
+
+
wine_cv_libc_reentrant=no
-echo $ac_n "checking "for reentrant libc: __errno_location"""... $ac_c" 1>&6
-echo "configure:5224: checking "for reentrant libc: __errno_location"" >&5
-if eval "test \"`echo '$''{'wine_cv_libc_r__errno_location'+set}'`\" = set"; then
+
+ echo $ac_n "checking for reentrant libc: __errno_location""... $ac_c" 1>&6
+echo "configure:5227: checking for reentrant libc: __errno_location" >&5
+if eval "test \"`echo '$''{'wine_cv_libc_r___errno_location'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
- wine_cv_libc_r__errno_location=yes
+ wine_cv_libc_r___errno_location=yes
else
cat > conftest.$ac_ext <<EOF
-#line 5232 "configure"
+#line 5235 "configure"
#include "confdefs.h"
int myerrno = 0;
char buf[256];
int *__errno_location(){return &myerrno;}
main(){connect(0,buf,255); exit(!myerrno);}
EOF
-if { (eval echo configure:5239: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5242: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
- wine_cv_libc_r__errno_location=yes
+ wine_cv_libc_r___errno_location=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -fr conftest*
- wine_cv_libc_r__errno_location=no
+ wine_cv_libc_r___errno_location=no
fi
rm -fr conftest*
fi
@@ -5250,39 +5253,37 @@
fi
-echo "$ac_t""$wine_cv_libc_r__errno_location" 1>&6
-if test "$wine_cv_libc_r__errno_location" = "yes"
+echo "$ac_t""$wine_cv_libc_r___errno_location" 1>&6
+if test "$wine_cv_libc_r___errno_location" = "yes"
then
- cat >> confdefs.h <<\EOF
-#define HAVE__ERRNO_LOCATION 1
-EOF
-
wine_cv_libc_reentrant=__errno_location
fi
-echo $ac_n "checking "for reentrant libc: __error"""... $ac_c" 1>&6
-echo "configure:5264: checking "for reentrant libc: __error"" >&5
-if eval "test \"`echo '$''{'wine_cv_libc_r__error'+set}'`\" = set"; then
+
+
+ echo $ac_n "checking for reentrant libc: __error""... $ac_c" 1>&6
+echo "configure:5265: checking for reentrant libc: __error" >&5
+if eval "test \"`echo '$''{'wine_cv_libc_r___error'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
- wine_cv_libc_r__error=yes
+ wine_cv_libc_r___error=yes
else
cat > conftest.$ac_ext <<EOF
-#line 5272 "configure"
+#line 5273 "configure"
#include "confdefs.h"
int myerrno = 0;
char buf[256];
int *__error(){return &myerrno;}
main(){connect(0,buf,255); exit(!myerrno);}
EOF
-if { (eval echo configure:5279: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5280: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
- wine_cv_libc_r__error=yes
+ wine_cv_libc_r___error=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -fr conftest*
- wine_cv_libc_r__error=no
+ wine_cv_libc_r___error=no
fi
rm -fr conftest*
fi
@@ -5290,39 +5291,37 @@
fi
-echo "$ac_t""$wine_cv_libc_r__error" 1>&6
-if test "$wine_cv_libc_r__error" = "yes"
+echo "$ac_t""$wine_cv_libc_r___error" 1>&6
+if test "$wine_cv_libc_r___error" = "yes"
then
- cat >> confdefs.h <<\EOF
-#define HAVE__ERROR 1
-EOF
-
wine_cv_libc_reentrant=__error
fi
-echo $ac_n "checking "for reentrant libc: ___errno"""... $ac_c" 1>&6
-echo "configure:5304: checking "for reentrant libc: ___errno"" >&5
-if eval "test \"`echo '$''{'wine_cv_libc_r___errno'+set}'`\" = set"; then
+
+
+ echo $ac_n "checking for reentrant libc: ___errno""... $ac_c" 1>&6
+echo "configure:5303: checking for reentrant libc: ___errno" >&5
+if eval "test \"`echo '$''{'wine_cv_libc_r____errno'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
- wine_cv_libc_r___errno=yes
+ wine_cv_libc_r____errno=yes
else
cat > conftest.$ac_ext <<EOF
-#line 5312 "configure"
+#line 5311 "configure"
#include "confdefs.h"
int myerrno = 0;
char buf[256];
int *___errno(){return &myerrno;}
main(){connect(0,buf,255); exit(!myerrno);}
EOF
-if { (eval echo configure:5319: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
- wine_cv_libc_r___errno=yes
+ wine_cv_libc_r____errno=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -fr conftest*
- wine_cv_libc_r___errno=no
+ wine_cv_libc_r____errno=no
fi
rm -fr conftest*
fi
@@ -5330,39 +5329,37 @@
fi
-echo "$ac_t""$wine_cv_libc_r___errno" 1>&6
-if test "$wine_cv_libc_r___errno" = "yes"
+echo "$ac_t""$wine_cv_libc_r____errno" 1>&6
+if test "$wine_cv_libc_r____errno" = "yes"
then
- cat >> confdefs.h <<\EOF
-#define HAVE___ERRNO 1
-EOF
-
wine_cv_libc_reentrant=___errno
fi
-echo $ac_n "checking "for reentrant libc: __thr_errno"""... $ac_c" 1>&6
-echo "configure:5344: checking "for reentrant libc: __thr_errno"" >&5
-if eval "test \"`echo '$''{'wine_cv_libc_r__thr_errno'+set}'`\" = set"; then
+
+
+ echo $ac_n "checking for reentrant libc: __thr_errno""... $ac_c" 1>&6
+echo "configure:5341: checking for reentrant libc: __thr_errno" >&5
+if eval "test \"`echo '$''{'wine_cv_libc_r___thr_errno'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
- wine_cv_libc_r__thr_errno=yes
+ wine_cv_libc_r___thr_errno=yes
else
cat > conftest.$ac_ext <<EOF
-#line 5352 "configure"
+#line 5349 "configure"
#include "confdefs.h"
int myerrno = 0;
char buf[256];
int *__thr_errno(){return &myerrno;}
main(){connect(0,buf,255); exit(!myerrno);}
EOF
-if { (eval echo configure:5359: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
- wine_cv_libc_r__thr_errno=yes
+ wine_cv_libc_r___thr_errno=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -fr conftest*
- wine_cv_libc_r__thr_errno=no
+ wine_cv_libc_r___thr_errno=no
fi
rm -fr conftest*
fi
@@ -5370,19 +5367,17 @@
fi
-echo "$ac_t""$wine_cv_libc_r__thr_errno" 1>&6
-if test "$wine_cv_libc_r__thr_errno" = "yes"
+echo "$ac_t""$wine_cv_libc_r___thr_errno" 1>&6
+if test "$wine_cv_libc_r___thr_errno" = "yes"
then
- cat >> confdefs.h <<\EOF
-#define HAVE__THR_ERRNO 1
-EOF
-
wine_cv_libc_reentrant=__thr_errno
fi
-if test "$wine_cv_libc_reentrant" = "no"
+
+
+if test "$wine_cv_libc_reentrant" != "no"
then
- cat >> confdefs.h <<\EOF
-#define NO_REENTRANT_LIBC 1
+ cat >> confdefs.h <<EOF
+#define ERRNO_LOCATION $wine_cv_libc_reentrant
EOF
fi
@@ -5391,7 +5386,7 @@
if test "$have_x" = "yes" -a "$wine_cv_libc_reentrant" != "no"
then
echo $ac_n "checking "for reentrant X libraries"""... $ac_c" 1>&6
-echo "configure:5395: checking "for reentrant X libraries"" >&5
+echo "configure:5390: checking "for reentrant X libraries"" >&5
if eval "test \"`echo '$''{'wine_cv_x_reentrant'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -5440,19 +5435,19 @@
# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
# for constant arguments. Useless!
echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
-echo "configure:5444: checking for working alloca.h" >&5
+echo "configure:5439: checking for working alloca.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5449 "configure"
+#line 5444 "configure"
#include "confdefs.h"
#include <alloca.h>
int main() {
void *p = alloca(2 * sizeof(int));
; return 0; }
EOF
-if { (eval echo configure:5456: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5451: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_header_alloca_h=yes
else
@@ -5473,12 +5468,12 @@
fi
echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:5477: checking for alloca" >&5
+echo "configure:5472: checking for alloca" >&5
if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5482 "configure"
+#line 5477 "configure"
#include "confdefs.h"
#ifdef __GNUC__
@@ -5506,7 +5501,7 @@
char *p = (char *) alloca(1);
; return 0; }
EOF
-if { (eval echo configure:5510: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5505: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_func_alloca_works=yes
else
@@ -5538,12 +5533,12 @@
echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:5542: checking whether alloca needs Cray hooks" >&5
+echo "configure:5537: checking whether alloca needs Cray hooks" >&5
if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5547 "configure"
+#line 5542 "configure"
#include "confdefs.h"
#if defined(CRAY) && ! defined(CRAY2)
webecray
@@ -5568,12 +5563,12 @@
if test $ac_cv_os_cray = yes; then
for ac_func in _getb67 GETB67 getb67; do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5572: checking for $ac_func" >&5
+echo "configure:5567: 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 5577 "configure"
+#line 5572 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -5596,7 +5591,7 @@
; return 0; }
EOF
-if { (eval echo configure:5600: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5595: \"$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
@@ -5623,7 +5618,7 @@
fi
echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:5627: checking stack direction for C alloca" >&5
+echo "configure:5622: checking stack direction for C alloca" >&5
if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -5631,7 +5626,7 @@
ac_cv_c_stack_direction=0
else
cat > conftest.$ac_ext <<EOF
-#line 5635 "configure"
+#line 5630 "configure"
#include "confdefs.h"
find_stack_direction ()
{
@@ -5650,7 +5645,7 @@
exit (find_stack_direction() < 0);
}
EOF
-if { (eval echo configure:5654: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_c_stack_direction=1
else
@@ -5708,12 +5703,12 @@
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5712: checking for $ac_func" >&5
+echo "configure:5707: 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 5717 "configure"
+#line 5712 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -5736,7 +5731,7 @@
; return 0; }
EOF
-if { (eval echo configure:5740: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5735: \"$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
@@ -5818,17 +5813,17 @@
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5822: checking for $ac_hdr" >&5
+echo "configure:5817: checking for $ac_hdr" >&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 5827 "configure"
+#line 5822 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5832: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5827: \"$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*
@@ -5855,12 +5850,12 @@
done
echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6
-echo "configure:5859: checking whether stat file-mode macros are broken" >&5
+echo "configure:5854: checking whether stat file-mode macros are broken" >&5
if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5864 "configure"
+#line 5859 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -5913,12 +5908,12 @@
echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:5917: checking for working const" >&5
+echo "configure:5912: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5922 "configure"
+#line 5917 "configure"
#include "confdefs.h"
int main() {
@@ -5967,7 +5962,7 @@
; return 0; }
EOF
-if { (eval echo configure:5971: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5966: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@@ -5988,21 +5983,21 @@
fi
echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:5992: checking for inline" >&5
+echo "configure:5987: checking for inline" >&5
if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
cat > conftest.$ac_ext <<EOF
-#line 5999 "configure"
+#line 5994 "configure"
#include "confdefs.h"
int main() {
} int $ac_kw foo() {
; return 0; }
EOF
-if { (eval echo configure:6006: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6001: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_inline=$ac_kw; break
else
@@ -6028,12 +6023,12 @@
esac
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:6032: checking for ANSI C header files" >&5
+echo "configure:6027: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6037 "configure"
+#line 6032 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -6041,7 +6036,7 @@
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6045: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6040: \"$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*
@@ -6058,7 +6053,7 @@
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 6062 "configure"
+#line 6057 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -6076,7 +6071,7 @@
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 6080 "configure"
+#line 6075 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -6097,7 +6092,7 @@
:
else
cat > conftest.$ac_ext <<EOF
-#line 6101 "configure"
+#line 6096 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -6108,7 +6103,7 @@
exit (0); }
EOF
-if { (eval echo configure:6112: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6107: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -6132,12 +6127,12 @@
fi
echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:6136: checking for size_t" >&5
+echo "configure:6131: checking for size_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6141 "configure"
+#line 6136 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -6165,7 +6160,7 @@
fi
echo $ac_n "checking size of long long""... $ac_c" 1>&6
-echo "configure:6169: checking size of long long" >&5
+echo "configure:6164: checking size of long long" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -6173,7 +6168,7 @@
ac_cv_sizeof_long_long=0
else
cat > conftest.$ac_ext <<EOF
-#line 6177 "configure"
+#line 6172 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
@@ -6184,7 +6179,7 @@
exit(0);
}
EOF
-if { (eval echo configure:6188: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6183: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_long_long=`cat conftestval`
else
@@ -6206,12 +6201,12 @@
echo $ac_n "checking "whether we can use re-entrant gethostbyname_r Linux style"""... $ac_c" 1>&6
-echo "configure:6210: checking "whether we can use re-entrant gethostbyname_r Linux style"" >&5
+echo "configure:6205: checking "whether we can use re-entrant gethostbyname_r Linux style"" >&5
if eval "test \"`echo '$''{'wine_cv_linux_gethostbyname_r_6'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6215 "configure"
+#line 6210 "configure"
#include "confdefs.h"
#include <netdb.h>
@@ -6232,7 +6227,7 @@
; return 0; }
EOF
-if { (eval echo configure:6236: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6231: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_linux_gethostbyname_r_6=yes
else
@@ -6258,12 +6253,12 @@
if test "$ac_cv_header_linux_joystick_h" = "yes"
then
echo $ac_n "checking "whether linux/joystick.h uses the Linux 2.2+ API"""... $ac_c" 1>&6
-echo "configure:6262: checking "whether linux/joystick.h uses the Linux 2.2+ API"" >&5
+echo "configure:6257: checking "whether linux/joystick.h uses the Linux 2.2+ API"" >&5
if eval "test \"`echo '$''{'wine_cv_linux_joystick_22_api'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6267 "configure"
+#line 6262 "configure"
#include "confdefs.h"
#include <sys/ioctl.h>
@@ -6278,7 +6273,7 @@
/*empty*/
; return 0; }
EOF
-if { (eval echo configure:6282: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6277: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_linux_joystick_22_api=yes
else
@@ -6305,12 +6300,12 @@
if test "$ac_cv_header_sys_vfs_h" = "yes"
then
echo $ac_n "checking "whether sys/vfs.h defines statfs"""... $ac_c" 1>&6
-echo "configure:6309: checking "whether sys/vfs.h defines statfs"" >&5
+echo "configure:6304: checking "whether sys/vfs.h defines statfs"" >&5
if eval "test \"`echo '$''{'wine_cv_sys_vfs_has_statfs'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6314 "configure"
+#line 6309 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -6327,7 +6322,7 @@
; return 0; }
EOF
-if { (eval echo configure:6331: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6326: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_sys_vfs_has_statfs=yes
else
@@ -6354,12 +6349,12 @@
if test "$ac_cv_header_sys_statfs_h" = "yes"
then
echo $ac_n "checking "whether sys/statfs.h defines statfs"""... $ac_c" 1>&6
-echo "configure:6358: checking "whether sys/statfs.h defines statfs"" >&5
+echo "configure:6353: checking "whether sys/statfs.h defines statfs"" >&5
if eval "test \"`echo '$''{'wine_cv_sys_statfs_has_statfs'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6363 "configure"
+#line 6358 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -6374,7 +6369,7 @@
; return 0; }
EOF
-if { (eval echo configure:6378: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6373: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_sys_statfs_has_statfs=yes
else
@@ -6401,12 +6396,12 @@
if test "$ac_cv_header_sys_mount_h" = "yes"
then
echo $ac_n "checking "whether sys/mount.h defines statfs"""... $ac_c" 1>&6
-echo "configure:6405: checking "whether sys/mount.h defines statfs"" >&5
+echo "configure:6400: checking "whether sys/mount.h defines statfs"" >&5
if eval "test \"`echo '$''{'wine_cv_sys_mount_has_statfs'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6410 "configure"
+#line 6405 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -6421,7 +6416,7 @@
; return 0; }
EOF
-if { (eval echo configure:6425: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6420: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_sys_mount_has_statfs=yes
else
@@ -6447,7 +6442,7 @@
echo $ac_n "checking "for statfs.f_bfree"""... $ac_c" 1>&6
-echo "configure:6451: checking "for statfs.f_bfree"" >&5
+echo "configure:6446: checking "for statfs.f_bfree"" >&5
if eval "test \"`echo '$''{'wine_cv_statfs_bfree'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -6456,7 +6451,7 @@
wine_cv_statfs_bfree=no
else
cat > conftest.$ac_ext <<EOF
-#line 6460 "configure"
+#line 6455 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -6483,7 +6478,7 @@
; return 0; }
EOF
-if { (eval echo configure:6487: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6482: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_statfs_bfree=yes
else
@@ -6507,7 +6502,7 @@
fi
echo $ac_n "checking "for statfs.f_bavail"""... $ac_c" 1>&6
-echo "configure:6511: checking "for statfs.f_bavail"" >&5
+echo "configure:6506: checking "for statfs.f_bavail"" >&5
if eval "test \"`echo '$''{'wine_cv_statfs_bavail'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -6516,7 +6511,7 @@
wine_cv_statfs_bavail=no
else
cat > conftest.$ac_ext <<EOF
-#line 6520 "configure"
+#line 6515 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -6543,7 +6538,7 @@
; return 0; }
EOF
-if { (eval echo configure:6547: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6542: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_statfs_bavail=yes
else
@@ -6568,12 +6563,12 @@
echo $ac_n "checking "for msg_accrights in struct msghdr"""... $ac_c" 1>&6
-echo "configure:6572: checking "for msg_accrights in struct msghdr"" >&5
+echo "configure:6567: checking "for msg_accrights in struct msghdr"" >&5
if eval "test \"`echo '$''{'ac_cv_c_msg_accrights'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6577 "configure"
+#line 6572 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
@@ -6581,7 +6576,7 @@
struct msghdr hdr; hdr.msg_accrights=0
; return 0; }
EOF
-if { (eval echo configure:6585: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6580: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_msg_accrights="yes"
else
@@ -6604,12 +6599,12 @@
echo $ac_n "checking "for sun_len in struct sockaddr_un"""... $ac_c" 1>&6
-echo "configure:6608: checking "for sun_len in struct sockaddr_un"" >&5
+echo "configure:6603: checking "for sun_len in struct sockaddr_un"" >&5
if eval "test \"`echo '$''{'ac_cv_c_sun_len'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6613 "configure"
+#line 6608 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
@@ -6618,7 +6613,7 @@
static struct sockaddr_un addr; addr.sun_len = 1
; return 0; }
EOF
-if { (eval echo configure:6622: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6617: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_sun_len="yes"
else
@@ -6641,12 +6636,12 @@
echo $ac_n "checking "whether we need to define __i386__"""... $ac_c" 1>&6
-echo "configure:6645: checking "whether we need to define __i386__"" >&5
+echo "configure:6640: checking "whether we need to define __i386__"" >&5
if eval "test \"`echo '$''{'ac_cv_cpp_def_i386'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6650 "configure"
+#line 6645 "configure"
#include "confdefs.h"
#if (defined(i386) || defined(__i386)) && !defined(__i386__)
yes
diff --git a/configure.in b/configure.in
index a414b2c..a6e0198 100644
--- a/configure.in
+++ b/configure.in
@@ -660,74 +660,35 @@
dnl For cross-compiling we blindly assume that libc is reentrant. This is
dnl ok since non-reentrant libc is quite rare (mostly old libc5 versions).
+AC_DEFUN(WINE_CHECK_ERRNO,
+[
+ AC_CACHE_CHECK(for reentrant libc: $1, wine_cv_libc_r_$1,
+ [AC_TRY_RUN([int myerrno = 0;
+char buf[256];
+int *$1(){return &myerrno;}
+main(){connect(0,buf,255); exit(!myerrno);}],
+ wine_cv_libc_r_$1=yes, wine_cv_libc_r_$1=no,
+ wine_cv_libc_r_$1=yes )
+])
+if test "$wine_cv_libc_r_$1" = "yes"
+then
+ wine_cv_libc_reentrant=$1
+fi
+])
+
wine_cv_libc_reentrant=no
-dnl
dnl Linux style errno location
-dnl
-AC_CACHE_CHECK("for reentrant libc: __errno_location", wine_cv_libc_r__errno_location,
- [AC_TRY_RUN([int myerrno = 0;
-char buf[256];
-int *__errno_location(){return &myerrno;}
-main(){connect(0,buf,255); exit(!myerrno);}],
- wine_cv_libc_r__errno_location=yes, wine_cv_libc_r__errno_location=no,
- wine_cv_libc_r__errno_location=yes )
-])
-if test "$wine_cv_libc_r__errno_location" = "yes"
-then
- AC_DEFINE(HAVE__ERRNO_LOCATION)
- wine_cv_libc_reentrant=__errno_location
-fi
-dnl
+WINE_CHECK_ERRNO(__errno_location)
dnl FreeBSD style errno location
-dnl
-AC_CACHE_CHECK("for reentrant libc: __error", wine_cv_libc_r__error,
- [AC_TRY_RUN([int myerrno = 0;
-char buf[256];
-int *__error(){return &myerrno;}
-main(){connect(0,buf,255); exit(!myerrno);}],
- wine_cv_libc_r__error=yes, wine_cv_libc_r__error=no,
- wine_cv_libc_r__error=yes )
-])
-if test "$wine_cv_libc_r__error" = "yes"
-then
- AC_DEFINE(HAVE__ERROR)
- wine_cv_libc_reentrant=__error
-fi
-dnl
+WINE_CHECK_ERRNO(__error)
dnl Solaris style errno location
-dnl
-AC_CACHE_CHECK("for reentrant libc: ___errno", wine_cv_libc_r___errno,
- [AC_TRY_RUN([int myerrno = 0;
-char buf[256];
-int *___errno(){return &myerrno;}
-main(){connect(0,buf,255); exit(!myerrno);}],
- wine_cv_libc_r___errno=yes, wine_cv_libc_r___errno=no,
- wine_cv_libc_r___errno=yes )
-])
-if test "$wine_cv_libc_r___errno" = "yes"
-then
- AC_DEFINE(HAVE___ERRNO)
- wine_cv_libc_reentrant=___errno
-fi
-dnl
+WINE_CHECK_ERRNO(___errno)
dnl UnixWare style errno location
-dnl
-AC_CACHE_CHECK("for reentrant libc: __thr_errno", wine_cv_libc_r__thr_errno,
- [AC_TRY_RUN([int myerrno = 0;
-char buf[256];
-int *__thr_errno(){return &myerrno;}
-main(){connect(0,buf,255); exit(!myerrno);}],
- wine_cv_libc_r__thr_errno=yes, wine_cv_libc_r__thr_errno=no,
- wine_cv_libc_r__thr_errno=yes )
-])
-if test "$wine_cv_libc_r__thr_errno" = "yes"
+WINE_CHECK_ERRNO(__thr_errno)
+
+if test "$wine_cv_libc_reentrant" != "no"
then
- AC_DEFINE(HAVE__THR_ERRNO)
- wine_cv_libc_reentrant=__thr_errno
-fi
-if test "$wine_cv_libc_reentrant" = "no"
-then
- AC_DEFINE(NO_REENTRANT_LIBC)
+ AC_DEFINE_UNQUOTED(ERRNO_LOCATION,$wine_cv_libc_reentrant)
fi
dnl **** Check for reentrant X libraries ****
diff --git a/dlls/x11drv/x11drv_main.c b/dlls/x11drv/x11drv_main.c
index 1bb2f37..c8be929 100644
--- a/dlls/x11drv/x11drv_main.c
+++ b/dlls/x11drv/x11drv_main.c
@@ -7,6 +7,15 @@
#include "config.h"
+#ifdef NO_REENTRANT_X11
+/* Get pointers to the static errno and h_errno variables used by Xlib. This
+ must be done before including <errno.h> makes the variables invisible. */
+extern int errno;
+static int *perrno = &errno;
+extern int h_errno;
+static int *ph_errno = &h_errno;
+#endif /* NO_REENTRANT_X11 */
+
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
@@ -36,6 +45,8 @@
static void (*old_tsx11_lock)(void);
static void (*old_tsx11_unlock)(void);
+static CRITICAL_SECTION X11DRV_CritSection = CRITICAL_SECTION_INIT;
+
Display *display;
Screen *screen;
Visual *visual;
@@ -46,6 +57,35 @@
unsigned int X11DRV_server_startticks;
+#ifdef NO_REENTRANT_X11
+static int* (*old_errno_location)(void);
+static int* (*old_h_errno_location)(void);
+
+/***********************************************************************
+ * x11_errno_location
+ *
+ * Get the per-thread errno location.
+ */
+static int *x11_errno_location(void)
+{
+ /* Use static libc errno while running in Xlib. */
+ if (X11DRV_CritSection.OwningThread == GetCurrentThreadId()) return perrno;
+ return old_errno_location();
+}
+
+/***********************************************************************
+ * x11_h_errno_location
+ *
+ * Get the per-thread h_errno location.
+ */
+static int *x11_h_errno_location(void)
+{
+ /* Use static libc h_errno while running in Xlib. */
+ if (X11DRV_CritSection.OwningThread == GetCurrentThreadId()) return ph_errno;
+ return old_h_errno_location();
+}
+#endif /* NO_REENTRANT_X11 */
+
/***********************************************************************
* error_handler
*/
@@ -268,6 +308,12 @@
setup_options();
/* setup TSX11 locking */
+#ifdef NO_REENTRANT_X11
+ old_errno_location = (void *)InterlockedExchange( (PLONG)&wine_errno_location,
+ (LONG)x11_errno_location );
+ old_h_errno_location = (void *)InterlockedExchange( (PLONG)&wine_h_errno_location,
+ (LONG)x11_h_errno_location );
+#endif /* NO_REENTRANT_X11 */
old_tsx11_lock = wine_tsx11_lock;
old_tsx11_unlock = wine_tsx11_unlock;
wine_tsx11_lock = lock_tsx11;
@@ -359,6 +405,10 @@
/* restore TSX11 locking */
wine_tsx11_lock = old_tsx11_lock;
wine_tsx11_unlock = old_tsx11_unlock;
+#ifdef NO_REENTRANT_X11
+ wine_errno_location = old_errno_location;
+ wine_h_errno_location = old_h_errno_location;
+#endif /* NO_REENTRANT_X11 */
#if 0 /* FIXME */
/* close the display */
diff --git a/include/acconfig.h b/include/acconfig.h
index 66a8603..d895b45 100644
--- a/include/acconfig.h
+++ b/include/acconfig.h
@@ -48,20 +48,8 @@
/* Define if X libraries are not reentrant (compiled without -D_REENTRANT). */
#undef NO_REENTRANT_X11
-/* Define if libc is not reentrant */
-#undef NO_REENTRANT_LIBC
-
-/* Define if libc uses __errno_location for reentrant errno */
-#undef HAVE__ERRNO_LOCATION
-
-/* Define if libc uses __error for reentrant errno */
-#undef HAVE__ERROR
-
-/* Define if libc uses ___errno for reentrant errno */
-#undef HAVE___ERRNO
-
-/* Define if libc uses __thr_errno for reentrant errno */
-#undef HAVE__THR_ERRNO
+/* Define to the name of the function returning erro for reentrant libc */
+#undef ERRNO_LOCATION
/* Define if all debug messages are to be compiled out */
#undef NO_DEBUG_MSGS
diff --git a/include/config.h.in b/include/config.h.in
index 932810c..d24fb8a 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -88,20 +88,8 @@
/* Define if X libraries are not reentrant (compiled without -D_REENTRANT). */
#undef NO_REENTRANT_X11
-/* Define if libc is not reentrant */
-#undef NO_REENTRANT_LIBC
-
-/* Define if libc uses __errno_location for reentrant errno */
-#undef HAVE__ERRNO_LOCATION
-
-/* Define if libc uses __error for reentrant errno */
-#undef HAVE__ERROR
-
-/* Define if libc uses ___errno for reentrant errno */
-#undef HAVE___ERRNO
-
-/* Define if libc uses __thr_errno for reentrant errno */
-#undef HAVE__THR_ERRNO
+/* Define to the name of the function returning erro for reentrant libc */
+#undef ERRNO_LOCATION
/* Define if all debug messages are to be compiled out */
#undef NO_DEBUG_MSGS
diff --git a/include/wine/library.h b/include/wine/library.h
index bde09f8..7f4e62c 100644
--- a/include/wine/library.h
+++ b/include/wine/library.h
@@ -27,6 +27,10 @@
extern void *wine_anon_mmap( void *start, size_t size, int prot, int flags );
+/* errno support */
+extern int* (*wine_errno_location)(void);
+extern int* (*wine_h_errno_location)(void);
+
/* LDT management */
extern void wine_ldt_get_entry( unsigned short sel, LDT_ENTRY *entry );
diff --git a/include/x11drv.h b/include/x11drv.h
index 8de3196..4c1f5fc 100644
--- a/include/x11drv.h
+++ b/include/x11drv.h
@@ -191,10 +191,6 @@
extern const int X11DRV_XROPfunction[];
-/* Xlib critical section */
-
-extern CRITICAL_SECTION X11DRV_CritSection;
-
extern void _XInitImageFuncPtrs(XImage *);
#define XCREATEIMAGE(image,width,height,bpp) \
diff --git a/library/Makefile.in b/library/Makefile.in
index f2ad202..7cc80f5 100644
--- a/library/Makefile.in
+++ b/library/Makefile.in
@@ -10,6 +10,7 @@
C_SRCS = \
debug.c \
+ errno.c \
ldt.c \
loader.c \
port.c
diff --git a/library/errno.c b/library/errno.c
new file mode 100644
index 0000000..63951e8
--- /dev/null
+++ b/library/errno.c
@@ -0,0 +1,46 @@
+/*
+ * Wine library reentrant errno support
+ *
+ * Copyright 1998 Alexandre Julliard
+ */
+
+/* Get pointers to the static errno and h_errno variables used by Xlib. This
+ must be done before including <errno.h> makes the variables invisible. */
+static int *default_errno_location(void)
+{
+ extern int errno;
+ return &errno;
+}
+
+static int *default_h_errno_location(void)
+{
+ extern int h_errno;
+ return &h_errno;
+}
+
+int* (*wine_errno_location)(void) = default_errno_location;
+int* (*wine_h_errno_location)(void) = default_h_errno_location;
+
+#include "config.h"
+
+/***********************************************************************
+ * __errno_location/__error/___errno
+ *
+ * Get the per-thread errno location.
+ */
+#ifdef ERRNO_LOCATION
+int *ERRNO_LOCATION(void)
+{
+ return wine_errno_location();
+}
+#endif /* ERRNO_LOCATION */
+
+/***********************************************************************
+ * __h_errno_location
+ *
+ * Get the per-thread h_errno location.
+ */
+int *__h_errno_location(void)
+{
+ return wine_h_errno_location();
+}
diff --git a/scheduler/sysdeps.c b/scheduler/sysdeps.c
index c734d01..43680f5 100644
--- a/scheduler/sysdeps.c
+++ b/scheduler/sysdeps.c
@@ -6,13 +6,6 @@
#include "config.h"
-/* Get pointers to the static errno and h_errno variables used by Xlib. This
- must be done before including <errno.h> makes the variables invisible. */
-extern int errno;
-static int *perrno = &errno;
-extern int h_errno;
-static int *ph_errno = &h_errno;
-
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
@@ -36,9 +29,6 @@
DEFAULT_DEBUG_CHANNEL(thread);
-/* Xlib critical section (FIXME: does not belong here) */
-CRITICAL_SECTION X11DRV_CritSection = CRITICAL_SECTION_INIT;
-
#ifdef linux
# ifdef HAVE_SCHED_H
# include <sched.h>
@@ -52,55 +42,6 @@
# endif /* CLONE_VM */
#endif /* linux */
-static int init_done;
-
-#ifndef NO_REENTRANT_LIBC
-
-/***********************************************************************
- * __errno_location/__error/___errno
- *
- * Get the per-thread errno location.
- */
-#ifdef HAVE__ERRNO_LOCATION
-int *__errno_location()
-#endif
-#ifdef HAVE__ERROR
-int *__error()
-#endif
-#ifdef HAVE___ERRNO
-int *___errno()
-#endif
-#ifdef HAVE__THR_ERRNO
-int *__thr_errno()
-#endif
-{
- if (!init_done) return perrno;
-#ifdef NO_REENTRANT_X11
- /* Use static libc errno while running in Xlib. */
- if (X11DRV_CritSection.OwningThread == GetCurrentThreadId())
- return perrno;
-#endif
- return &NtCurrentTeb()->thread_errno;
-}
-
-/***********************************************************************
- * __h_errno_location
- *
- * Get the per-thread h_errno location.
- */
-int *__h_errno_location()
-{
- if (!init_done) return ph_errno;
-#ifdef NO_REENTRANT_X11
- /* Use static libc h_errno while running in Xlib. */
- if (X11DRV_CritSection.OwningThread == GetCurrentThreadId())
- return ph_errno;
-#endif
- return &NtCurrentTeb()->thread_h_errno;
-}
-
-#endif /* NO_REENTRANT_LIBC */
-
/***********************************************************************
* SYSDEPS_SetCurThread
*
@@ -115,8 +56,6 @@
/* On non-i386 Solaris, we use the LWP private pointer */
_lwp_setprivate( teb );
#endif
-
- init_done = 1; /* now we can use threading routines */
}
/***********************************************************************
@@ -150,7 +89,7 @@
*/
int SYSDEPS_SpawnThread( TEB *teb )
{
-#ifndef NO_REENTRANT_LIBC
+#ifdef ERRNO_LOCATION
#ifdef linux
const int flags = CLONE_VM | CLONE_FS | CLONE_FILES | SIGCHLD;
@@ -192,7 +131,7 @@
return 0;
#endif
-#endif /* NO_REENTRANT_LIBC */
+#endif /* ERRNO_LOCATION */
FIXME("CreateThread: stub\n" );
return 0;
diff --git a/scheduler/thread.c b/scheduler/thread.c
index 3735a11..fdd5a1d 100644
--- a/scheduler/thread.c
+++ b/scheduler/thread.c
@@ -214,6 +214,26 @@
/***********************************************************************
+ * thread_errno_location
+ *
+ * Get the per-thread errno location.
+ */
+static int *thread_errno_location(void)
+{
+ return &NtCurrentTeb()->thread_errno;
+}
+
+/***********************************************************************
+ * thread_h_errno_location
+ *
+ * Get the per-thread h_errno location.
+ */
+static int *thread_h_errno_location(void)
+{
+ return &NtCurrentTeb()->thread_h_errno;
+}
+
+/***********************************************************************
* THREAD_Init
*
* Setup the initial thread.
@@ -228,6 +248,8 @@
assert( initial_teb.teb_sel );
initial_teb.process = ¤t_process;
SYSDEPS_SetCurThread( &initial_teb );
+ wine_errno_location = thread_errno_location;
+ wine_h_errno_location = thread_h_errno_location;
}
}