From fa5d3b74b00bbe76f893b7a83b5a48084c015a18 Mon Sep 17 00:00:00 2001 From: Sebastian Wilhelmi Date: Mon, 8 Feb 1999 17:14:44 +0000 Subject: [PATCH] Changed the test for getpwuid_r to exclude those systems (i.e. IRIX), that 1999-02-08 Sebastian Wilhelmi * configure.in, acconfig.h: Changed the test for getpwuid_r to exclude those systems (i.e. IRIX), that set ENOSYS after the call. Test, if pthread_getspecific is posix like or something different, as on PCThreads. * gthread/gthread-posix.c (g_private_get_posix_impl): Use the HAVE_PTHREAD_GETSPECIFIC_POSIX macro to determine, which signature to use for pthread_getspecific. --- ChangeLog | 7 +++++++ ChangeLog.pre-2-0 | 7 +++++++ ChangeLog.pre-2-10 | 7 +++++++ ChangeLog.pre-2-12 | 7 +++++++ ChangeLog.pre-2-2 | 7 +++++++ ChangeLog.pre-2-4 | 7 +++++++ ChangeLog.pre-2-6 | 7 +++++++ ChangeLog.pre-2-8 | 7 +++++++ acconfig.h | 4 +++- configure.in | 32 +++++++++++++++++++++++++++++--- gthread/ChangeLog | 6 ++++++ gthread/gthread-posix.c | 9 ++++++++- 12 files changed, 102 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 860f80a88..949397848 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +1999-02-08 Sebastian Wilhelmi + + * configure.in, acconfig.h: Changed the test for getpwuid_r to + exclude those systems (i.e. IRIX), that set ENOSYS after the call. + Test, if pthread_getspecific is posix like or something different, + as on PCThreads. + Sun Feb 7 21:56:00 1999 Owen Taylor * gmem.c (g_mem_profile): Copy all elements diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 860f80a88..949397848 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,10 @@ +1999-02-08 Sebastian Wilhelmi + + * configure.in, acconfig.h: Changed the test for getpwuid_r to + exclude those systems (i.e. IRIX), that set ENOSYS after the call. + Test, if pthread_getspecific is posix like or something different, + as on PCThreads. + Sun Feb 7 21:56:00 1999 Owen Taylor * gmem.c (g_mem_profile): Copy all elements diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 860f80a88..949397848 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +1999-02-08 Sebastian Wilhelmi + + * configure.in, acconfig.h: Changed the test for getpwuid_r to + exclude those systems (i.e. IRIX), that set ENOSYS after the call. + Test, if pthread_getspecific is posix like or something different, + as on PCThreads. + Sun Feb 7 21:56:00 1999 Owen Taylor * gmem.c (g_mem_profile): Copy all elements diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 860f80a88..949397848 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,10 @@ +1999-02-08 Sebastian Wilhelmi + + * configure.in, acconfig.h: Changed the test for getpwuid_r to + exclude those systems (i.e. IRIX), that set ENOSYS after the call. + Test, if pthread_getspecific is posix like or something different, + as on PCThreads. + Sun Feb 7 21:56:00 1999 Owen Taylor * gmem.c (g_mem_profile): Copy all elements diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 860f80a88..949397848 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,10 @@ +1999-02-08 Sebastian Wilhelmi + + * configure.in, acconfig.h: Changed the test for getpwuid_r to + exclude those systems (i.e. IRIX), that set ENOSYS after the call. + Test, if pthread_getspecific is posix like or something different, + as on PCThreads. + Sun Feb 7 21:56:00 1999 Owen Taylor * gmem.c (g_mem_profile): Copy all elements diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 860f80a88..949397848 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,10 @@ +1999-02-08 Sebastian Wilhelmi + + * configure.in, acconfig.h: Changed the test for getpwuid_r to + exclude those systems (i.e. IRIX), that set ENOSYS after the call. + Test, if pthread_getspecific is posix like or something different, + as on PCThreads. + Sun Feb 7 21:56:00 1999 Owen Taylor * gmem.c (g_mem_profile): Copy all elements diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 860f80a88..949397848 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,10 @@ +1999-02-08 Sebastian Wilhelmi + + * configure.in, acconfig.h: Changed the test for getpwuid_r to + exclude those systems (i.e. IRIX), that set ENOSYS after the call. + Test, if pthread_getspecific is posix like or something different, + as on PCThreads. + Sun Feb 7 21:56:00 1999 Owen Taylor * gmem.c (g_mem_profile): Copy all elements diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 860f80a88..949397848 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,10 @@ +1999-02-08 Sebastian Wilhelmi + + * configure.in, acconfig.h: Changed the test for getpwuid_r to + exclude those systems (i.e. IRIX), that set ENOSYS after the call. + Test, if pthread_getspecific is posix like or something different, + as on PCThreads. + Sun Feb 7 21:56:00 1999 Owen Taylor * gmem.c (g_mem_profile): Copy all elements diff --git a/acconfig.h b/acconfig.h index 6b2910ef4..6c4c1b777 100644 --- a/acconfig.h +++ b/acconfig.h @@ -46,9 +46,12 @@ #undef HAVE_BROKEN_WCTYPE #undef HAVE_DOPRNT #undef HAVE_FLOAT_H +#undef HAVE_GETPWUID_R +#undef HAVE_GETPWUID_R_POSIX #undef HAVE_LIMITS_H #undef HAVE_LONG_DOUBLE #undef HAVE_POLL +#undef HAVE_PTHREAD_GETSPECIFIC_POSIX #undef HAVE_PWD_H #undef HAVE_SYS_PARAM_H #undef HAVE_SYS_POLL_H @@ -92,7 +95,6 @@ #undef G_THREAD_SOURCE -#undef HAVE_GETPWUID_R_POSIX /* #undef PACKAGE */ /* #undef VERSION */ diff --git a/configure.in b/configure.in index 196dd0b3b..f27c96bf6 100644 --- a/configure.in +++ b/configure.in @@ -573,12 +573,12 @@ LIBS_NOT_FOUND_1="I can't find the libraries for the thread implementation LIBS_NOT_FOUND_2=". Please choose another thread implementation or provide information on your thread implementation. - You can also use the '--disable-threads' flag for configure + You can also run 'configure --disable-threads' to compile without thread support." FUNC_NO_GETPWUID_R="the 'g_get_(user_name|real_name|home_dir|tmp_dir)' functions will not be MT-safe during their first call because - there is no 'getpwuid_r' on your system." + there is no working 'getpwuid_r' on your system." FUNC_NO_LOCALTIME_R="the 'g_date_set_time' function will not be MT-safe because there is no 'localtime_r' on your system." @@ -734,7 +734,24 @@ if test x"$have_threads" != xnone; then CFLAGS="$CFLAGS $G_THREAD_CFLAGS" AC_CHECK_FUNCS(localtime_r rand_r) if test "$ac_cv_header_pwd_h" = "yes"; then - AC_CHECK_FUNCS(getpwuid_r) + AC_MSG_CHECKING([for getpwuid_r]) + AC_CACHE_VAL(ac_cv_func_getpwuid_r, + [AC_TRY_RUN([#include + int main () { char buffer[10000], *pointer; + char getpwuid_r (long, void*, void*, + int, void*); + errno = 0; + getpwuid_r (0, &buffer, &buffer, + sizeof (buffer), &pointer); + return errno == ENOSYS;}], + [ac_cv_func_getpwuid_r=yes], + [ac_cv_func_getpwuid_r=no])]) + if test "$ac_cv_func_getpwuid_r" = yes; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_GETPWUID_R) + else + AC_MSG_RESULT(no) + fi if test "$ac_cv_func_getpwuid_r" = "yes"; then AC_MSG_CHECKING(whether getpwuid_r is posix like) # getpwuid_r(0, NULL, NULL, 0) is the signature on @@ -748,6 +765,15 @@ if test x"$have_threads" != xnone; then AC_DEFINE(HAVE_GETPWUID_R_POSIX)]) fi fi + if test x"$have_threads" = xposix; then + AC_MSG_CHECKING(whether pthread_getspecific is posix like) + # PCThreads has pthread_getspecific(pthread_key_t, void **); + AC_TRY_COMPILE([#include ], + [pthread_getspecific(0,NULL);], + [AC_MSG_RESULT(no)], + [AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_PTHREAD_GETSPECIFIC_POSIX)]) + fi LIBS="$glib_save_LIBS" CFLAGS="$glib_save_CFLAGS" fi diff --git a/gthread/ChangeLog b/gthread/ChangeLog index c46243772..414426681 100644 --- a/gthread/ChangeLog +++ b/gthread/ChangeLog @@ -1,3 +1,9 @@ +1999-02-08 Sebastian Wilhelmi + + * gthread-posix.c (g_private_get_posix_impl): Use the + HAVE_PTHREAD_GETSPECIFIC_POSIX macro to determine, which signature + to use for pthread_getspecific. + Tue Jan 19 20:56:02 1999 Tor Lillqvist * Makefile.am (EXTRA_DIST): Added gthread.def. diff --git a/gthread/gthread-posix.c b/gthread/gthread-posix.c index e35acbdd5..33a520a8a 100644 --- a/gthread/gthread-posix.c +++ b/gthread/gthread-posix.c @@ -155,8 +155,15 @@ g_private_get_posix_impl (GPrivate * private_key) { if (!private_key) return NULL; - +#ifdef HAVE_PTHREAD_GETSPECIFIC_POSIX return pthread_getspecific (*(pthread_key_t *) private_key); +#else /* HAVE_PTHREAD_GETSPECIFIC_POSIX */ + { + void* data; + pthread_getspecific (*(pthread_key_t *) private_key, &data); + return data; + } +#endif /* HAVE_PTHREAD_GETSPECIFIC_POSIX */ } static GThreadFunctions g_thread_functions_for_glib_use_default =