Added --with-nptl configure option and necessary changes to support

running on top of NPTL threads.
This commit is contained in:
Alexandre Julliard 2003-04-03 02:54:54 +00:00
parent 3200c02b9c
commit 6a9cea957a
7 changed files with 65 additions and 7 deletions

20
configure vendored
View File

@ -308,7 +308,7 @@ ac_includes_default="\
# include <unistd.h> # include <unistd.h>
#endif" #endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS OPTIONS WIN16_FILES WIN16_INSTALL build build_cpu build_vendor build_os host host_cpu host_vendor host_os SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP TOOLSDIR X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS YACC LEX LEXLIB LEX_OUTPUT_ROOT XYACC XLEX AS ac_ct_AS LD ac_ct_LD AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP WINDRES ac_ct_WINDRES LN_S LN C2MAN LDCONFIG INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LINT LINTFLAGS DB2HTML DB2PDF DB2PS JPEGLIB EGREP GIFLIB XLIB XFILES OPENGLFILES GLU32FILES OPENGL_LIBS NASLIBS CURSESLIBS sane_devel SANELIBS SANEINCL ft_devel ft_devel2 FREETYPEINCL ARTSCCONFIG ARTSLIBS ARTSINCL ALSALIBS AUDIOIOLIBS DLLEXT DLLFLAGS DLLIBS LDDLLFLAGS LDSHARED LIBEXT IMPLIBEXT DLLTOOL ac_ct_DLLTOOL DLLWRAP ac_ct_DLLWRAP LDEXECFLAGS CROSSTEST CROSSCC LDPATH CRTLIBS LDD ALLOCA LIBOBJS LTLIBOBJS' ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS OPTIONS WIN16_FILES WIN16_INSTALL LIBPTHREAD build build_cpu build_vendor build_os host host_cpu host_vendor host_os SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP TOOLSDIR X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS YACC LEX LEXLIB LEX_OUTPUT_ROOT XYACC XLEX AS ac_ct_AS LD ac_ct_LD AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP WINDRES ac_ct_WINDRES LN_S LN C2MAN LDCONFIG INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LINT LINTFLAGS DB2HTML DB2PDF DB2PS JPEGLIB EGREP GIFLIB XLIB XFILES OPENGLFILES GLU32FILES OPENGL_LIBS NASLIBS CURSESLIBS sane_devel SANELIBS SANEINCL ft_devel ft_devel2 FREETYPEINCL ARTSCCONFIG ARTSLIBS ARTSINCL ALSALIBS AUDIOIOLIBS DLLEXT DLLFLAGS DLLIBS LDDLLFLAGS LDSHARED LIBEXT IMPLIBEXT DLLTOOL ac_ct_DLLTOOL DLLWRAP ac_ct_DLLWRAP LDEXECFLAGS CROSSTEST CROSSCC LDPATH CRTLIBS LDD ALLOCA LIBOBJS LTLIBOBJS'
ac_subst_files='MAKE_RULES MAKE_DLL_RULES MAKE_TEST_RULES MAKE_PROG_RULES' ac_subst_files='MAKE_RULES MAKE_DLL_RULES MAKE_TEST_RULES MAKE_PROG_RULES'
# Initialize some variables set by options. # Initialize some variables set by options.
@ -858,6 +858,7 @@ Optional Packages:
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--without-opengl do not use OpenGL --without-opengl do not use OpenGL
--without-curses do not use curses --without-curses do not use curses
--with-nptl use glibc NPTL threading support
--with-wine-tools=<dir> use Wine tools from directory <dir> --with-wine-tools=<dir> use Wine tools from directory <dir>
--with-x use the X Window System --with-x use the X Window System
@ -1345,6 +1346,12 @@ if test "${with_curses+set}" = set; then
fi; fi;
# Check whether --with-nptl or --without-nptl was given.
if test "${with_nptl+set}" = set; then
withval="$with_nptl"
fi;
# Check whether --with-wine-tools or --without-wine-tools was given. # Check whether --with-wine-tools or --without-wine-tools was given.
if test "${with_wine_tools+set}" = set; then if test "${with_wine_tools+set}" = set; then
withval="$with_wine_tools" withval="$with_wine_tools"
@ -1377,6 +1384,16 @@ cat >>confdefs.h <<\_ACEOF
_ACEOF _ACEOF
fi fi
if test "x$with_nptl" = "xyes"
then
cat >>confdefs.h <<\_ACEOF
#define HAVE_NPTL 1
_ACEOF
LIBPTHREAD="-lpthread"
fi
# Make sure we can run config.sub. # Make sure we can run config.sub.
@ -16739,6 +16756,7 @@ s,@LIBS@,$LIBS,;t t
s,@OPTIONS@,$OPTIONS,;t t s,@OPTIONS@,$OPTIONS,;t t
s,@WIN16_FILES@,$WIN16_FILES,;t t s,@WIN16_FILES@,$WIN16_FILES,;t t
s,@WIN16_INSTALL@,$WIN16_INSTALL,;t t s,@WIN16_INSTALL@,$WIN16_INSTALL,;t t
s,@LIBPTHREAD@,$LIBPTHREAD,;t t
s,@build@,$build,;t t s,@build@,$build,;t t
s,@build_cpu@,$build_cpu,;t t s,@build_cpu@,$build_cpu,;t t
s,@build_vendor@,$build_vendor,;t t s,@build_vendor@,$build_vendor,;t t

View File

@ -18,6 +18,7 @@ AC_ARG_ENABLE(trace, AC_HELP_STRING([--disable-trace],[compile out TRACE message
AC_ARG_WITH(opengl, AC_HELP_STRING([--without-opengl],[do not use OpenGL])) AC_ARG_WITH(opengl, AC_HELP_STRING([--without-opengl],[do not use OpenGL]))
AC_ARG_WITH(curses, AC_HELP_STRING([--without-curses],[do not use curses])) AC_ARG_WITH(curses, AC_HELP_STRING([--without-curses],[do not use curses]))
AC_ARG_WITH(nptl, AC_HELP_STRING([--with-nptl],[use glibc NPTL threading support]))
AC_ARG_WITH(wine-tools,AC_HELP_STRING([--with-wine-tools=<dir>],[use Wine tools from directory <dir>])) AC_ARG_WITH(wine-tools,AC_HELP_STRING([--with-wine-tools=<dir>],[use Wine tools from directory <dir>]))
AC_SUBST(OPTIONS) AC_SUBST(OPTIONS)
@ -36,6 +37,11 @@ if test "x$enable_trace" = "xno" -o "x$enable_debug" = "xno"
then then
AC_DEFINE(NO_TRACE_MSGS,1,[Define to disable trace messages.]) AC_DEFINE(NO_TRACE_MSGS,1,[Define to disable trace messages.])
fi fi
if test "x$with_nptl" = "xyes"
then
AC_DEFINE(HAVE_NPTL,1,[Define to use glibc NPTL threading support.])
AC_SUBST(LIBPTHREAD,"-lpthread")
fi
dnl **** Check for some programs **** dnl **** Check for some programs ****

View File

@ -4,7 +4,7 @@ TOPOBJDIR = ../..
SRCDIR = @srcdir@ SRCDIR = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
MODULE = ntdll.dll MODULE = ntdll.dll
EXTRALIBS = $(LIBUNICODE) EXTRALIBS = $(LIBUNICODE) @LIBPTHREAD@
C_SRCS = \ C_SRCS = \
$(TOPOBJDIR)/files/directory.c \ $(TOPOBJDIR)/files/directory.c \

View File

@ -341,6 +341,9 @@
/* Define to 1 if you have the <net/if.h> header file. */ /* Define to 1 if you have the <net/if.h> header file. */
#undef HAVE_NET_IF_H #undef HAVE_NET_IF_H
/* Define to use glibc NPTL threading support. */
#undef HAVE_NPTL
/* Define to 1 if the system has the type `off_t'. */ /* Define to 1 if the system has the type `off_t'. */
#undef HAVE_OFF_T #undef HAVE_OFF_T

View File

@ -22,8 +22,12 @@
#include <assert.h> #include <assert.h>
#ifndef HAVE_NPTL
/*********************************************************************** /***********************************************************************
* pthread functions * pthread functions
*
* FIXME: should find a better place for these
*/ */
#ifndef HAVE_PTHREAD_GETSPECIFIC #ifndef HAVE_PTHREAD_GETSPECIFIC
void pthread_getspecific() { assert(0); } void pthread_getspecific() { assert(0); }
@ -44,3 +48,5 @@ void pthread_mutex_unlock() { assert(0); }
#ifndef HAVE_PTHREAD_SETSPECIFIC #ifndef HAVE_PTHREAD_SETSPECIFIC
void pthread_setspecific() { assert(0); } void pthread_setspecific() { assert(0); }
#endif #endif
#endif /* HAVE_NPTL */

View File

@ -46,7 +46,7 @@ struct _pthread_cleanup_buffer;
* If they are not available, the libc defaults to * If they are not available, the libc defaults to
* non-threadsafe operation (not good). */ * non-threadsafe operation (not good). */
#if defined(__GLIBC__) || defined(__FreeBSD__) #if (defined(__GLIBC__) || defined(__FreeBSD__)) && !defined(HAVE_NPTL)
#ifndef __USE_UNIX98 #ifndef __USE_UNIX98
#define __USE_UNIX98 #define __USE_UNIX98

View File

@ -45,6 +45,10 @@
#include <sched.h> #include <sched.h>
#endif #endif
#ifdef HAVE_NPTL
#include <pthread.h>
#endif
#include "thread.h" #include "thread.h"
#include "wine/server.h" #include "wine/server.h"
#include "winbase.h" #include "winbase.h"
@ -175,9 +179,18 @@ static void SYSDEPS_StartThread( TEB *teb )
*/ */
int SYSDEPS_SpawnThread( TEB *teb ) int SYSDEPS_SpawnThread( TEB *teb )
{ {
#ifdef HAVE_CLONE #ifdef HAVE_NPTL
pthread_t id;
pthread_attr_t attr;
pthread_attr_init( &attr );
pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED );
pthread_attr_setstack( &attr, teb->stack_base, (char *)teb->stack_top - (char *)teb->stack_base );
if (pthread_create( &id, &attr, (void * (*)(void *))SYSDEPS_StartThread, teb )) return -1;
return 0;
#elif defined(HAVE_CLONE)
if (clone( (int (*)(void *))SYSDEPS_StartThread, teb->stack_top, if (clone( (int (*)(void *))SYSDEPS_StartThread, teb->stack_top,
CLONE_VM | CLONE_FS | CLONE_FILES, teb ) < 0) CLONE_VM | CLONE_FS | CLONE_FILES | SIGCHLD, teb ) < 0)
return -1; return -1;
return 0; return 0;
#elif defined(HAVE_RFORK) #elif defined(HAVE_RFORK)
@ -284,8 +297,11 @@ void SYSDEPS_ExitThread( int status )
info.status = status; info.status = status;
SIGNAL_Block(); SIGNAL_Block();
SIGNAL_Reset();
#ifdef HAVE_NPTL
SYSDEPS_AbortThread( status );
#else
SIGNAL_Reset();
VirtualFree( teb->stack_base, 0, MEM_RELEASE | MEM_SYSTEM ); VirtualFree( teb->stack_base, 0, MEM_RELEASE | MEM_SYSTEM );
close( teb->wait_fd[0] ); close( teb->wait_fd[0] );
close( teb->wait_fd[1] ); close( teb->wait_fd[1] );
@ -294,6 +310,7 @@ void SYSDEPS_ExitThread( int status )
teb->stack_low = get_temp_stack(); teb->stack_low = get_temp_stack();
teb->stack_top = (char *) teb->stack_low + TEMP_STACK_SIZE; teb->stack_top = (char *) teb->stack_low + TEMP_STACK_SIZE;
SYSDEPS_CallOnStack( cleanup_thread, &info ); SYSDEPS_CallOnStack( cleanup_thread, &info );
#endif
} }
@ -305,11 +322,14 @@ void SYSDEPS_ExitThread( int status )
void SYSDEPS_AbortThread( int status ) void SYSDEPS_AbortThread( int status )
{ {
SIGNAL_Block(); SIGNAL_Block();
SIGNAL_Reset();
close( NtCurrentTeb()->wait_fd[0] ); close( NtCurrentTeb()->wait_fd[0] );
close( NtCurrentTeb()->wait_fd[1] ); close( NtCurrentTeb()->wait_fd[1] );
close( NtCurrentTeb()->reply_fd ); close( NtCurrentTeb()->reply_fd );
close( NtCurrentTeb()->request_fd ); close( NtCurrentTeb()->request_fd );
#ifdef HAVE_NPTL
pthread_exit( (void *)status );
#endif
SIGNAL_Reset();
#ifdef HAVE__LWP_CREATE #ifdef HAVE__LWP_CREATE
_lwp_exit(); _lwp_exit();
#endif #endif
@ -337,6 +357,8 @@ int SYSDEPS_GetUnixTid(void)
} }
#ifndef HAVE_NPTL
/* default errno before threading is initialized */ /* default errno before threading is initialized */
static int *default_errno_location(void) static int *default_errno_location(void)
{ {
@ -387,6 +409,7 @@ int *__h_errno_location(void)
return h_errno_location_ptr(); return h_errno_location_ptr();
} }
#endif /* HAVE_NPTL */
/*********************************************************************** /***********************************************************************
* SYSDEPS_InitErrno * SYSDEPS_InitErrno
@ -395,8 +418,10 @@ int *__h_errno_location(void)
*/ */
void SYSDEPS_InitErrno(void) void SYSDEPS_InitErrno(void)
{ {
#ifndef HAVE_NPTL
errno_location_ptr = thread_errno_location; errno_location_ptr = thread_errno_location;
h_errno_location_ptr = thread_h_errno_location; h_errno_location_ptr = thread_h_errno_location;
#endif
} }