summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormdejong <mdejong>2004-11-22 22:40:31 (GMT)
committermdejong <mdejong>2004-11-22 22:40:31 (GMT)
commitef4b091cbe98d05b7498a99ef0e793e55986e3e2 (patch)
tree3758dcfd85bf95084418f687dbd39900c691434b
parent586e32dd0e46d891670556611f65277053f070c3 (diff)
downloadtcl-ef4b091cbe98d05b7498a99ef0e793e55986e3e2.zip
tcl-ef4b091cbe98d05b7498a99ef0e793e55986e3e2.tar.gz
tcl-ef4b091cbe98d05b7498a99ef0e793e55986e3e2.tar.bz2
* unix/configure: Regen.
* unix/tcl.m4 (SC_ENABLE_THREADS): Check for a 2 argument version of readdir_r that is known to exists under IRIX 5.3. * unix/tclUnixThrd.c (TclpReaddir): Use either 2 arg or 3 arg version of readdir_r. [Bug 1001325]
-rw-r--r--ChangeLog10
-rwxr-xr-xunix/configure103
-rw-r--r--unix/tcl.m419
-rw-r--r--unix/tclUnixThrd.c6
4 files changed, 137 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 2ac354c..a6fe41d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2004-11-22 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/configure: Regen.
+ * unix/tcl.m4 (SC_ENABLE_THREADS): Check for a 2
+ argument version of readdir_r that is known to
+ exists under IRIX 5.3.
+ * unix/tclUnixThrd.c (TclpReaddir): Use either
+ 2 arg or 3 arg version of readdir_r.
+ [Bug 1001325]
+
2004-11-22 Don Porter <dgp@users.sourceforge.net>
* unix/tclUnixInit.c (TclpInitLibraryPath): Purged dead code that
diff --git a/unix/configure b/unix/configure
index aa80480..8823352 100755
--- a/unix/configure
+++ b/unix/configure
@@ -4965,6 +4965,109 @@ _ACEOF
fi
done
+ if test "x$ac_cv_func_readdir_r" = "xyes"; then
+ # IRIX 5.3 has a 2 arg version of readdir_r
+ # while other systems have a 3 arg version.
+ if test "${tcl_cv_two_arg_readdir_r+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <sys/dir.h>
+int
+main ()
+{
+readdir_r(NULL, NULL);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_cv_two_arg_readdir_r=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_two_arg_readdir_r=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+
+ if test "${tcl_cv_three_arg_readdir_r+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <sys/dir.h>
+int
+main ()
+{
+readdir_r(NULL, NULL, NULL);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_cv_three_arg_readdir_r=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_three_arg_readdir_r=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+
+ if test "x$tcl_cv_two_arg_readdir_r" = "xyes" ; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_TWO_ARG_READDIR_R 1
+_ACEOF
+
+ elif test "x$tcl_cv_three_arg_readdir_r" = "xyes" ; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_THREE_ARG_READDIR_R 1
+_ACEOF
+
+ else
+ { { echo "$as_me:$LINENO: error: unknown number of args for readdir_r" >&5
+echo "$as_me: error: unknown number of args for readdir_r" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ fi
else
TCL_THREADS=0
echo "$as_me:$LINENO: result: no (default)" >&5
diff --git a/unix/tcl.m4 b/unix/tcl.m4
index 4dce1cb..1dbd59f 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -511,6 +511,25 @@ AC_DEFUN(SC_ENABLE_THREADS, [
fi
LIBS=$ac_saved_libs
AC_CHECK_FUNCS(readdir_r)
+ if test "x$ac_cv_func_readdir_r" = "xyes"; then
+ # IRIX 5.3 has a 2 arg version of readdir_r
+ # while other systems have a 3 arg version.
+ AC_CACHE_VAL(tcl_cv_two_arg_readdir_r,
+ AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/dir.h>], [readdir_r(NULL, NULL);],
+ tcl_cv_two_arg_readdir_r=yes, tcl_cv_two_arg_readdir_r=no))
+ AC_CACHE_VAL(tcl_cv_three_arg_readdir_r,
+ AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/dir.h>], [readdir_r(NULL, NULL, NULL);],
+ tcl_cv_three_arg_readdir_r=yes, tcl_cv_three_arg_readdir_r=no))
+ if test "x$tcl_cv_two_arg_readdir_r" = "xyes" ; then
+ AC_DEFINE(HAVE_TWO_ARG_READDIR_R)
+ elif test "x$tcl_cv_three_arg_readdir_r" = "xyes" ; then
+ AC_DEFINE(HAVE_THREE_ARG_READDIR_R)
+ else
+ AC_MSG_ERROR([unknown number of args for readdir_r])
+ fi
+ fi
else
TCL_THREADS=0
AC_MSG_RESULT([no (default)])
diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c
index b79442f..17130a7 100644
--- a/unix/tclUnixThrd.c
+++ b/unix/tclUnixThrd.c
@@ -883,8 +883,12 @@ TclpReaddir(DIR * dir)
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
#ifdef HAVE_READDIR_R
- ent = &tsdPtr->rdbuf.ent;
+ ent = &tsdPtr->rdbuf.ent;
+# ifdef HAVE_TWO_ARG_READDIR_R
+ if (TclOSreaddir_r(dir, ent) != 0) {
+# else /* HAVE_THREE_ARG_READDIR_R */
if (TclOSreaddir_r(dir, ent, &ent) != 0) {
+# endif /* HAVE_TWO_ARG_READDIR_R */
ent = NULL;
}