aboutsummaryrefslogtreecommitdiffstats
path: root/dir.c
diff options
context:
space:
mode:
authorngoto <ngoto@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-06 17:07:08 +0000
committerngoto <ngoto@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-06 17:07:08 +0000
commit7ceb0f9eb4c5eea155e27a29a6e86a63229979d8 (patch)
tree6c17b41c3e6b980a1b4935a6b5b841b0beebdfc2 /dir.c
parente48bf65db30ae2b85eeaab6c8947a218762b07cb (diff)
downloadruby-7ceb0f9eb4c5eea155e27a29a6e86a63229979d8.tar.gz
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c13
1 files changed, 13 insertions, 0 deletions
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: