aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--configure.in8
-rw-r--r--dir.c13
3 files changed, 30 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 6aa1d6fb8a..61d384a436 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Sat Nov 7 01:32:06 2015 Naohisa Goto <ngotogenome@gmail.com>
+
+ * dir.c (dir_fileno, dirfd): support of Dir#fileno on Solaris 10.
+ Solaris 10 does not have dirfd, but the file descriptor of a
+ directory is stored in the d_fd or dd_fd member in the DIR struct.
+ Note that Solaris 11 has dirfd(3C).
+
+ * configure.in: checks for DIR.d_fd and DIR.dd_fd on Solaris 10.
+
Fri Nov 6 23:13:53 2015 Kazuki Tanaka <gogotanaka@ruby-lang.org>
* array.c: clarifies Array#reject! documentation.
diff --git a/configure.in b/configure.in
index 786b538b89..0d253a9547 100644
--- a/configure.in
+++ b/configure.in
@@ -2660,6 +2660,14 @@ if test "$ac_cv_func_setpgid:$ac_cv_func_setpgrp" = no:yes; then
AC_FUNC_SETPGRP
fi
+if test x"$ac_cv_func_dirfd" = xno; then
+ AS_CASE(["$target_os"],[solaris*],
+ [AC_CHECK_MEMBERS([DIR.d_fd, DIR.dd_fd],,,[
+#include <sys/types.h>
+#include <dirent.h>
+])])
+fi
+
if test x"$target_cpu" = xia64; then
AC_LIBOBJ([ia64])
AC_CACHE_CHECK(for __libc_ia64_register_backing_store_base,
diff --git a/dir.c b/dir.c
index 59057b4908..05ad656fda 100644
--- a/dir.c
+++ b/dir.c
@@ -619,6 +619,19 @@ dir_inspect(VALUE dir)
return rb_funcallv(dir, rb_intern("to_s"), 0, 0);
}
+/* Workaround for Solaris 10 that does not have dirfd.
+ Note: Solaris 11 (POSIX.1-2008 compliant) has dirfd(3C).
+ */
+#if defined(__sun) && !defined(HAVE_DIRFD)
+# if defined(HAVE_DIR_D_FD)
+# define dirfd(x) ((x)->d_fd)
+# define HAVE_DIRFD 1
+# elif defined(HAVE_DIR_DD_FD)
+# define dirfd(x) ((x)->dd_fd)
+# define HAVE_DIRFD 1
+# endif
+#endif
+
#ifdef HAVE_DIRFD
/*
* call-seq: