Check for the sched.h header and include it on gthread/gthread-posix.c if

2000-11-15  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>

	* configure.in: Check for the sched.h header and include it on
	gthread/gthread-posix.c if available.

	* gthread-posix.c: Include <sched.h> if available.

	* configure.in: Add -D_POSIX4_DRAFT_SOURCE to
	GTHREAD_COMPILE_IMPL_DEFINES. Also add -D_POSIX4A_DRAFT10_SOURCE
	to G_THREAD_CFLAGS. Really deploy GTHREAD_COMPILE_IMPL_DEFINES,
	when searching for thread libs. Look for sched_* functions in
	-lrte as well. All of that is necessary on DG/UX.

	* configure.in: Use AC_TRY_COMPILE instead of AC_EGREP_HEADERS in
	various places to make it work more reliable, to make it accept
	macros instead of functions etc.

	* configure.in: Replace some NULL's for checks with 0 to make it
	work without stdio.h everywhere.

	* configure.in, gutils.c: changed the test for getpwuid_r to first
	test for a posix version and then for a non-posix version. No code
	change in gutils.c. Again this change deals better with getpwuid_r
	being a macro and not a function. Most of the above with kind help
	from Tethys <tet@isengard.europe.dg.com>. This fixes Bug #13403.
This commit is contained in:
Sebastian Wilhelmi 2000-11-15 17:48:43 +00:00 committed by Sebastian Wilhelmi
parent 760845b183
commit b9731eb861
13 changed files with 263 additions and 52 deletions

View File

@ -1,3 +1,27 @@
2000-11-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Check for the sched.h header and include it on
gthread/gthread-posix.c if available.
* configure.in: Add -D_POSIX4_DRAFT_SOURCE to
GTHREAD_COMPILE_IMPL_DEFINES. Also add -D_POSIX4A_DRAFT10_SOURCE
to G_THREAD_CFLAGS. Really deploy GTHREAD_COMPILE_IMPL_DEFINES,
when searching for thread libs. Look for sched_* functions in
-lrte as well. All of that is necessary on DG/UX.
* configure.in: Use AC_TRY_COMPILE instead of AC_EGREP_HEADERS in
various places to make it work more reliable, to make it accept
macros instead of functions etc.
* configure.in: Replace some NULL's for checks with 0 to make it
work without stdio.h everywhere.
* configure.in, gutils.c: changed the test for getpwuid_r to first
test for a posix version and then for a non-posix version. No code
change in gutils.c. Again this change deals better with getpwuid_r
being a macro and not a function. Most of the above with kind help
from Tethys <tet@isengard.europe.dg.com>. This fixes Bug #13403.
2000-11-14 Tor Lillqvist <tml@iki.fi> 2000-11-14 Tor Lillqvist <tml@iki.fi>
* gwin32.h: Make #endif comment match #ifdef. * gwin32.h: Make #endif comment match #ifdef.

View File

@ -1,3 +1,27 @@
2000-11-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Check for the sched.h header and include it on
gthread/gthread-posix.c if available.
* configure.in: Add -D_POSIX4_DRAFT_SOURCE to
GTHREAD_COMPILE_IMPL_DEFINES. Also add -D_POSIX4A_DRAFT10_SOURCE
to G_THREAD_CFLAGS. Really deploy GTHREAD_COMPILE_IMPL_DEFINES,
when searching for thread libs. Look for sched_* functions in
-lrte as well. All of that is necessary on DG/UX.
* configure.in: Use AC_TRY_COMPILE instead of AC_EGREP_HEADERS in
various places to make it work more reliable, to make it accept
macros instead of functions etc.
* configure.in: Replace some NULL's for checks with 0 to make it
work without stdio.h everywhere.
* configure.in, gutils.c: changed the test for getpwuid_r to first
test for a posix version and then for a non-posix version. No code
change in gutils.c. Again this change deals better with getpwuid_r
being a macro and not a function. Most of the above with kind help
from Tethys <tet@isengard.europe.dg.com>. This fixes Bug #13403.
2000-11-14 Tor Lillqvist <tml@iki.fi> 2000-11-14 Tor Lillqvist <tml@iki.fi>
* gwin32.h: Make #endif comment match #ifdef. * gwin32.h: Make #endif comment match #ifdef.

View File

@ -1,3 +1,27 @@
2000-11-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Check for the sched.h header and include it on
gthread/gthread-posix.c if available.
* configure.in: Add -D_POSIX4_DRAFT_SOURCE to
GTHREAD_COMPILE_IMPL_DEFINES. Also add -D_POSIX4A_DRAFT10_SOURCE
to G_THREAD_CFLAGS. Really deploy GTHREAD_COMPILE_IMPL_DEFINES,
when searching for thread libs. Look for sched_* functions in
-lrte as well. All of that is necessary on DG/UX.
* configure.in: Use AC_TRY_COMPILE instead of AC_EGREP_HEADERS in
various places to make it work more reliable, to make it accept
macros instead of functions etc.
* configure.in: Replace some NULL's for checks with 0 to make it
work without stdio.h everywhere.
* configure.in, gutils.c: changed the test for getpwuid_r to first
test for a posix version and then for a non-posix version. No code
change in gutils.c. Again this change deals better with getpwuid_r
being a macro and not a function. Most of the above with kind help
from Tethys <tet@isengard.europe.dg.com>. This fixes Bug #13403.
2000-11-14 Tor Lillqvist <tml@iki.fi> 2000-11-14 Tor Lillqvist <tml@iki.fi>
* gwin32.h: Make #endif comment match #ifdef. * gwin32.h: Make #endif comment match #ifdef.

View File

@ -1,3 +1,27 @@
2000-11-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Check for the sched.h header and include it on
gthread/gthread-posix.c if available.
* configure.in: Add -D_POSIX4_DRAFT_SOURCE to
GTHREAD_COMPILE_IMPL_DEFINES. Also add -D_POSIX4A_DRAFT10_SOURCE
to G_THREAD_CFLAGS. Really deploy GTHREAD_COMPILE_IMPL_DEFINES,
when searching for thread libs. Look for sched_* functions in
-lrte as well. All of that is necessary on DG/UX.
* configure.in: Use AC_TRY_COMPILE instead of AC_EGREP_HEADERS in
various places to make it work more reliable, to make it accept
macros instead of functions etc.
* configure.in: Replace some NULL's for checks with 0 to make it
work without stdio.h everywhere.
* configure.in, gutils.c: changed the test for getpwuid_r to first
test for a posix version and then for a non-posix version. No code
change in gutils.c. Again this change deals better with getpwuid_r
being a macro and not a function. Most of the above with kind help
from Tethys <tet@isengard.europe.dg.com>. This fixes Bug #13403.
2000-11-14 Tor Lillqvist <tml@iki.fi> 2000-11-14 Tor Lillqvist <tml@iki.fi>
* gwin32.h: Make #endif comment match #ifdef. * gwin32.h: Make #endif comment match #ifdef.

View File

@ -1,3 +1,27 @@
2000-11-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Check for the sched.h header and include it on
gthread/gthread-posix.c if available.
* configure.in: Add -D_POSIX4_DRAFT_SOURCE to
GTHREAD_COMPILE_IMPL_DEFINES. Also add -D_POSIX4A_DRAFT10_SOURCE
to G_THREAD_CFLAGS. Really deploy GTHREAD_COMPILE_IMPL_DEFINES,
when searching for thread libs. Look for sched_* functions in
-lrte as well. All of that is necessary on DG/UX.
* configure.in: Use AC_TRY_COMPILE instead of AC_EGREP_HEADERS in
various places to make it work more reliable, to make it accept
macros instead of functions etc.
* configure.in: Replace some NULL's for checks with 0 to make it
work without stdio.h everywhere.
* configure.in, gutils.c: changed the test for getpwuid_r to first
test for a posix version and then for a non-posix version. No code
change in gutils.c. Again this change deals better with getpwuid_r
being a macro and not a function. Most of the above with kind help
from Tethys <tet@isengard.europe.dg.com>. This fixes Bug #13403.
2000-11-14 Tor Lillqvist <tml@iki.fi> 2000-11-14 Tor Lillqvist <tml@iki.fi>
* gwin32.h: Make #endif comment match #ifdef. * gwin32.h: Make #endif comment match #ifdef.

View File

@ -1,3 +1,27 @@
2000-11-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Check for the sched.h header and include it on
gthread/gthread-posix.c if available.
* configure.in: Add -D_POSIX4_DRAFT_SOURCE to
GTHREAD_COMPILE_IMPL_DEFINES. Also add -D_POSIX4A_DRAFT10_SOURCE
to G_THREAD_CFLAGS. Really deploy GTHREAD_COMPILE_IMPL_DEFINES,
when searching for thread libs. Look for sched_* functions in
-lrte as well. All of that is necessary on DG/UX.
* configure.in: Use AC_TRY_COMPILE instead of AC_EGREP_HEADERS in
various places to make it work more reliable, to make it accept
macros instead of functions etc.
* configure.in: Replace some NULL's for checks with 0 to make it
work without stdio.h everywhere.
* configure.in, gutils.c: changed the test for getpwuid_r to first
test for a posix version and then for a non-posix version. No code
change in gutils.c. Again this change deals better with getpwuid_r
being a macro and not a function. Most of the above with kind help
from Tethys <tet@isengard.europe.dg.com>. This fixes Bug #13403.
2000-11-14 Tor Lillqvist <tml@iki.fi> 2000-11-14 Tor Lillqvist <tml@iki.fi>
* gwin32.h: Make #endif comment match #ifdef. * gwin32.h: Make #endif comment match #ifdef.

View File

@ -1,3 +1,27 @@
2000-11-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Check for the sched.h header and include it on
gthread/gthread-posix.c if available.
* configure.in: Add -D_POSIX4_DRAFT_SOURCE to
GTHREAD_COMPILE_IMPL_DEFINES. Also add -D_POSIX4A_DRAFT10_SOURCE
to G_THREAD_CFLAGS. Really deploy GTHREAD_COMPILE_IMPL_DEFINES,
when searching for thread libs. Look for sched_* functions in
-lrte as well. All of that is necessary on DG/UX.
* configure.in: Use AC_TRY_COMPILE instead of AC_EGREP_HEADERS in
various places to make it work more reliable, to make it accept
macros instead of functions etc.
* configure.in: Replace some NULL's for checks with 0 to make it
work without stdio.h everywhere.
* configure.in, gutils.c: changed the test for getpwuid_r to first
test for a posix version and then for a non-posix version. No code
change in gutils.c. Again this change deals better with getpwuid_r
being a macro and not a function. Most of the above with kind help
from Tethys <tet@isengard.europe.dg.com>. This fixes Bug #13403.
2000-11-14 Tor Lillqvist <tml@iki.fi> 2000-11-14 Tor Lillqvist <tml@iki.fi>
* gwin32.h: Make #endif comment match #ifdef. * gwin32.h: Make #endif comment match #ifdef.

View File

@ -1,3 +1,27 @@
2000-11-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Check for the sched.h header and include it on
gthread/gthread-posix.c if available.
* configure.in: Add -D_POSIX4_DRAFT_SOURCE to
GTHREAD_COMPILE_IMPL_DEFINES. Also add -D_POSIX4A_DRAFT10_SOURCE
to G_THREAD_CFLAGS. Really deploy GTHREAD_COMPILE_IMPL_DEFINES,
when searching for thread libs. Look for sched_* functions in
-lrte as well. All of that is necessary on DG/UX.
* configure.in: Use AC_TRY_COMPILE instead of AC_EGREP_HEADERS in
various places to make it work more reliable, to make it accept
macros instead of functions etc.
* configure.in: Replace some NULL's for checks with 0 to make it
work without stdio.h everywhere.
* configure.in, gutils.c: changed the test for getpwuid_r to first
test for a posix version and then for a non-posix version. No code
change in gutils.c. Again this change deals better with getpwuid_r
being a macro and not a function. Most of the above with kind help
from Tethys <tet@isengard.europe.dg.com>. This fixes Bug #13403.
2000-11-14 Tor Lillqvist <tml@iki.fi> 2000-11-14 Tor Lillqvist <tml@iki.fi>
* gwin32.h: Make #endif comment match #ifdef. * gwin32.h: Make #endif comment match #ifdef.

View File

@ -312,7 +312,7 @@ AC_C_BIGENDIAN
# check for header files # check for header files
AC_CHECK_HEADERS([float.h limits.h pwd.h sys/param.h sys/poll.h sys/select.h]) AC_CHECK_HEADERS([float.h limits.h pwd.h sys/param.h sys/poll.h sys/select.h])
AC_CHECK_HEADERS([sys/time.h sys/times.h unistd.h values.h stdint.h]) AC_CHECK_HEADERS([sys/time.h sys/times.h unistd.h values.h stdint.h sched.h])
AC_MSG_CHECKING(whether make is GNU Make) AC_MSG_CHECKING(whether make is GNU Make)
STRIP_BEGIN= STRIP_BEGIN=
@ -732,20 +732,20 @@ if test "x$want_threads" = xyes || test "x$want_threads" = xsolaris; then
fi fi
if test "x$want_threads" = xyes || test "x$want_threads" = xposix \ if test "x$want_threads" = xyes || test "x$want_threads" = xposix \
|| test "x$want_threads" = xdce; then || test "x$want_threads" = xdce; then
# -D_POSIX4A_DRAFT10_SOURCE is for DG/UX # -D_POSIX4_DRAFT_SOURCE -D_POSIX4A_DRAFT10_SOURCE is for DG/UX
# -U_OSF_SOURCE is for Digital UNIX 4.0d # -U_OSF_SOURCE is for Digital UNIX 4.0d
GTHREAD_COMPILE_IMPL_DEFINES="-D_POSIX4A_DRAFT10_SOURCE -U_OSF_SOURCE" GTHREAD_COMPILE_IMPL_DEFINES="-D_POSIX4_DRAFT_SOURCE -D_POSIX4A_DRAFT10_SOURCE -U_OSF_SOURCE"
glib_save_CPPFLAGS="$CPPFLAGS" glib_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $GTHREAD_COMPILE_IMPL_DEFINES" CPPFLAGS="$CPPFLAGS $GTHREAD_COMPILE_IMPL_DEFINES"
if test "x$have_threads" = xnone; then if test "x$have_threads" = xnone; then
AC_EGREP_HEADER([(^|[^a-zA-Z_])pthread_attr_init[^a-zA-Z_]], AC_TRY_COMPILE([#include <pthread.h>],
pthread.h, [pthread_attr_t attr; pthread_attr_init(&attr);],
have_threads=posix) have_threads=posix)
fi fi
if test "x$have_threads" = xnone; then if test "x$have_threads" = xnone; then
AC_EGREP_HEADER([(^|[^a-zA-Z_])pthread_attr_create[^a-zA-Z_]], AC_TRY_COMPILE([#include <pthread.h>],
pthread.h, [pthread_attr_t attr; pthread_attr_create(&attr);],
have_threads=dce) have_threads=posix)
fi fi
CPPFLAGS="$glib_save_CPPFLAGS" CPPFLAGS="$glib_save_CPPFLAGS"
fi fi
@ -791,6 +791,8 @@ if test x"$have_threads" != xnone; then
G_THREAD_CFLAGS="$G_THREAD_CFLAGS -pthread" G_THREAD_CFLAGS="$G_THREAD_CFLAGS -pthread"
fi fi
;; ;;
*-dg-dgux*) # DG/UX
G_THREAD_CFLAGS="$G_THREAD_CFLAGS -D_POSIX4A_DRAFT10_SOURCE"
esac esac
# if we are not finding the ctime_r function, then we probably are # if we are not finding the ctime_r function, then we probably are
@ -799,9 +801,11 @@ if test x"$have_threads" != xnone; then
glib_save_CPPFLAGS="$CPPFLAGS" glib_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $G_THREAD_CFLAGS" CPPFLAGS="$CPPFLAGS $G_THREAD_CFLAGS"
# Note: Digital UNIX 4.0d #defines ctime_r to _Pctime_r for gcc. AC_TRY_COMPILE([#include <time.h>],
AC_EGREP_HEADER([[^a-zA-Z_](_P)?ctime_r[^a-zA-Z_]], time.h, , [time_t t; char b[30]; ctime_r (&t, b);], ,
AC_MSG_WARN($FLAG_DOES_NOT_WORK)) [AC_TRY_COMPILE([#include <time.h>],
[time_t t; char b[30]; ctime_r (&t, b, 30);], ,
AC_MSG_WARN($FLAG_DOES_NOT_WORK))])
CPPFLAGS="$glib_save_CPPFLAGS" CPPFLAGS="$glib_save_CPPFLAGS"
@ -816,7 +820,9 @@ dnl ******************************
mutex_has_default=no mutex_has_default=no
case $have_threads in case $have_threads in
posix|dce) posix|dce)
G_THREAD_LIBS=error glib_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $GTHREAD_COMPILE_IMPL_DEFINES"
G_THREAD_LIBS=error
glib_save_LIBS="$LIBS" glib_save_LIBS="$LIBS"
case $host in case $host in
*-sysv5uw7*) # UnixWare 7 *-sysv5uw7*) # UnixWare 7
@ -836,7 +842,7 @@ case $have_threads in
IN=" in -l$thread_lib" IN=" in -l$thread_lib"
fi fi
if test x"$have_threads" = xposix; then if test x"$have_threads" = xposix; then
defattr=NULL defattr=0
else else
defattr=pthread_attr_default defattr=pthread_attr_default
fi fi
@ -850,7 +856,7 @@ case $have_threads in
main() main()
{ pthread_t t; { pthread_t t;
void *ret; void *ret;
pthread_create (&t, $defattr, func, NULL); pthread_create (&t, $defattr, func, 0);
pthread_join (t, &ret); pthread_join (t, &ret);
exit (check_me != 42); exit (check_me != 42);
}], }],
@ -862,7 +868,7 @@ case $have_threads in
if test "x$G_THREAD_LIBS" = xerror; then if test "x$G_THREAD_LIBS" = xerror; then
AC_MSG_ERROR($LIBS_NOT_FOUND_1$have_threads$LIBS_NOT_FOUND_2) AC_MSG_ERROR($LIBS_NOT_FOUND_1$have_threads$LIBS_NOT_FOUND_2)
fi fi
for thread_lib in "" rt; do for thread_lib in "" rt rte; do
if test x"$thread_lib" = x; then if test x"$thread_lib" = x; then
add_thread_lib="" add_thread_lib=""
IN="" IN=""
@ -901,6 +907,7 @@ case $have_threads in
have_threads="posix" have_threads="posix"
fi fi
AC_SUBST(GTHREAD_COMPILE_IMPL_DEFINES) AC_SUBST(GTHREAD_COMPILE_IMPL_DEFINES)
CPPFLAGS="$glib_save_CPPFLAGS"
;; ;;
solaris) solaris)
G_THREAD_LIBS=error G_THREAD_LIBS=error
@ -946,33 +953,37 @@ if test x"$have_threads" != xnone; then
# LIBS="$LIBS $G_THREAD_LIBS" # LIBS="$LIBS $G_THREAD_LIBS"
AC_CHECK_FUNCS(localtime_r) AC_CHECK_FUNCS(localtime_r)
if test "$ac_cv_header_pwd_h" = "yes"; then if test "$ac_cv_header_pwd_h" = "yes"; then
AC_CACHE_CHECK([for getpwuid_r],ac_cv_func_getpwuid_r, AC_CACHE_CHECK([for posix getpwuid_r],
ac_cv_func_posix_getpwuid_r,
[AC_TRY_RUN([#include <errno.h> [AC_TRY_RUN([#include <errno.h>
int main () { char buffer[10000], *pointer; #include <pwd.h>
char getpwuid_r (long, void*, void*, int main () { char buffer[10000];
int, void*); struct passwd pwd, *pwptr = &pwd;
int error; int error;
errno = 0; errno = 0;
error = getpwuid_r (0, &buffer, &buffer, error = getpwuid_r (0, &pwd, buffer,
sizeof (buffer), &pointer); sizeof (buffer), &pwptr);
return errno == ENOSYS || error == ENOSYS;}], return (error < 0 && errno == ENOSYS)
[ac_cv_func_getpwuid_r=yes], || error == ENOSYS; }],
[ac_cv_func_getpwuid_r=no])]) [ac_cv_func_posix_getpwuid_r=yes],
if test "$ac_cv_func_getpwuid_r" = yes; then [ac_cv_func_posix_getpwuid_r=no])])
AC_DEFINE(HAVE_GETPWUID_R,1,[Have function getpwuid_r]) if test "$ac_cv_func_posix_getpwuid_r" = yes; then
fi AC_DEFINE(HAVE_POSIX_GETPWUID_R,1,
if test "$ac_cv_func_getpwuid_r" = "yes"; then [Have POSIX function getpwuid_r])
AC_MSG_CHECKING(whether getpwuid_r is posix like) else
# The signature for the POSIX version is: AC_CACHE_CHECK([for nonposix getpwuid_r],
# int getpwuid_r(uid_t, struct passwd *, char *, size_t, struct passwd **) ac_cv_func_nonposix_getpwuid_r,
AC_TRY_COMPILE([#include <pwd.h> [AC_TRY_COMPILE([#include <pwd.h>],
#include <sys/types.h> [char buffer[10000];
#include <stdlib.h>], struct passwd pwd;
[getpwuid_r((uid_t)0, NULL, NULL, (size_t)0, NULL);], getpwuid_r (0, &pwd, buffer,
[AC_DEFINE(HAVE_GETPWUID_R_POSIX,1, sizeof (buffer));],
[Function getpwuid_r has the POSIX signature]) [ac_cv_func_nonposix_getpwuid_r=yes],
AC_MSG_RESULT(yes)], [ac_cv_func_nonposix_getpwuid_r=no])])
[AC_MSG_RESULT(no)]) if test "$ac_cv_func_nonposix_getpwuid_r" = yes; then
AC_DEFINE(HAVE_NONPOSIX_GETPWUID_R,1,
[Have non-POSIX function getpwuid_r])
fi
fi fi
fi fi
LIBS="$LIBS $G_THREAD_LIBS" LIBS="$LIBS $G_THREAD_LIBS"
@ -1042,7 +1053,8 @@ if test x"$have_threads" != xnone; then
LIBS="$glib_save_LIBS" LIBS="$glib_save_LIBS"
# now spit out all the warnings. # now spit out all the warnings.
if test "$ac_cv_func_getpwuid_r" != "yes"; then if test "$ac_cv_func_posix_getpwuid_r" != "yes" &&
test "$ac_cv_func_nonposix_getpwuid_r" != "yes"; then
AC_MSG_WARN($FUNC_NO_GETPWUID_R) AC_MSG_WARN($FUNC_NO_GETPWUID_R)
fi fi
if test "$ac_cv_func_localtime_r" != "yes"; then if test "$ac_cv_func_localtime_r" != "yes"; then

View File

@ -715,7 +715,7 @@ g_get_any_init (void)
struct passwd *pw = NULL; struct passwd *pw = NULL;
gpointer buffer = NULL; gpointer buffer = NULL;
# ifdef HAVE_GETPWUID_R # if defined (HAVE_POSIX_GETPWUID_R) || defined (HAVE_NONPOSIX_GETPWUID_R)
struct passwd pwd; struct passwd pwd;
# ifdef _SC_GETPW_R_SIZE_MAX # ifdef _SC_GETPW_R_SIZE_MAX
/* This reurns the maximum length */ /* This reurns the maximum length */
@ -731,10 +731,10 @@ g_get_any_init (void)
buffer = g_malloc (bufsize); buffer = g_malloc (bufsize);
errno = 0; errno = 0;
# ifdef HAVE_GETPWUID_R_POSIX # ifdef HAVE_POSIX_GETPWUID_R
error = getpwuid_r (getuid (), &pwd, buffer, bufsize, &pw); error = getpwuid_r (getuid (), &pwd, buffer, bufsize, &pw);
error = error < 0 ? errno : error; error = error < 0 ? errno : error;
# else /* !HAVE_GETPWUID_R_POSIX */ # else /* HAVE_NONPOSIX_GETPWUID_R */
# ifdef _AIX # ifdef _AIX
error = getpwuid_r (getuid (), &pwd, buffer, bufsize); error = getpwuid_r (getuid (), &pwd, buffer, bufsize);
pw = error == 0 ? &pwd : NULL; pw = error == 0 ? &pwd : NULL;
@ -742,7 +742,7 @@ g_get_any_init (void)
pw = getpwuid_r (getuid (), &pwd, buffer, bufsize); pw = getpwuid_r (getuid (), &pwd, buffer, bufsize);
error = pw ? 0 : errno; error = pw ? 0 : errno;
# endif /* !_AIX */ # endif /* !_AIX */
# endif /* !HAVE_GETPWUID_R_POSIX */ # endif /* HAVE_NONPOSIX_GETPWUID_R */
if (!pw) if (!pw)
{ {
@ -768,7 +768,7 @@ g_get_any_init (void)
} }
} }
while (!pw); while (!pw);
# endif /* !HAVE_GETPWUID_R */ # endif /* HAVE_POSIX_GETPWUID_R || HAVE_NONPOSIX_GETPWUID_R */
if (!pw) if (!pw)
{ {

View File

@ -1,3 +1,7 @@
2000-11-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gthread-posix.c: Include <sched.h> if available.
2000-11-02 Sebastian Wilhelmi <wilhelmi@ira.uka.de> 2000-11-02 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gthread-none.c: Add G_MUTEX_SIZE as needed for gthread-impl.c * gthread-none.c: Add G_MUTEX_SIZE as needed for gthread-impl.c

View File

@ -40,6 +40,9 @@
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifdef HAVE_SCHED_H
#include <sched.h>
#endif
#define posix_check_err(err, name) G_STMT_START{ \ #define posix_check_err(err, name) G_STMT_START{ \
int error = (err); \ int error = (err); \

View File

@ -715,7 +715,7 @@ g_get_any_init (void)
struct passwd *pw = NULL; struct passwd *pw = NULL;
gpointer buffer = NULL; gpointer buffer = NULL;
# ifdef HAVE_GETPWUID_R # if defined (HAVE_POSIX_GETPWUID_R) || defined (HAVE_NONPOSIX_GETPWUID_R)
struct passwd pwd; struct passwd pwd;
# ifdef _SC_GETPW_R_SIZE_MAX # ifdef _SC_GETPW_R_SIZE_MAX
/* This reurns the maximum length */ /* This reurns the maximum length */
@ -731,10 +731,10 @@ g_get_any_init (void)
buffer = g_malloc (bufsize); buffer = g_malloc (bufsize);
errno = 0; errno = 0;
# ifdef HAVE_GETPWUID_R_POSIX # ifdef HAVE_POSIX_GETPWUID_R
error = getpwuid_r (getuid (), &pwd, buffer, bufsize, &pw); error = getpwuid_r (getuid (), &pwd, buffer, bufsize, &pw);
error = error < 0 ? errno : error; error = error < 0 ? errno : error;
# else /* !HAVE_GETPWUID_R_POSIX */ # else /* HAVE_NONPOSIX_GETPWUID_R */
# ifdef _AIX # ifdef _AIX
error = getpwuid_r (getuid (), &pwd, buffer, bufsize); error = getpwuid_r (getuid (), &pwd, buffer, bufsize);
pw = error == 0 ? &pwd : NULL; pw = error == 0 ? &pwd : NULL;
@ -742,7 +742,7 @@ g_get_any_init (void)
pw = getpwuid_r (getuid (), &pwd, buffer, bufsize); pw = getpwuid_r (getuid (), &pwd, buffer, bufsize);
error = pw ? 0 : errno; error = pw ? 0 : errno;
# endif /* !_AIX */ # endif /* !_AIX */
# endif /* !HAVE_GETPWUID_R_POSIX */ # endif /* HAVE_NONPOSIX_GETPWUID_R */
if (!pw) if (!pw)
{ {
@ -768,7 +768,7 @@ g_get_any_init (void)
} }
} }
while (!pw); while (!pw);
# endif /* !HAVE_GETPWUID_R */ # endif /* HAVE_POSIX_GETPWUID_R || HAVE_NONPOSIX_GETPWUID_R */
if (!pw) if (!pw)
{ {