[前][次][番号順一覧][スレッド一覧]

ruby-changes:40391

From: ngoto <ko1@a...>
Date: Sat, 7 Nov 2015 02:07:28 +0900 (JST)
Subject: [ruby-changes:40391] ngoto:r52472 (trunk): * dir.c (dir_fileno, dirfd): support of Dir#fileno on Solaris 10.

ngoto	2015-11-07 02:07:08 +0900 (Sat, 07 Nov 2015)

  New Revision: 52472

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52472

  Log:
    * 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.

  Modified files:
    trunk/ChangeLog
    trunk/configure.in
    trunk/dir.c
Index: configure.in
===================================================================
--- configure.in	(revision 52471)
+++ configure.in	(revision 52472)
@@ -2660,6 +2660,14 @@ if test "$ac_cv_func_setpgid:$ac_cv_func https://github.com/ruby/ruby/blob/trunk/configure.in#L2660
 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,
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 52471)
+++ ChangeLog	(revision 52472)
@@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Nov  7 01:32:06 2015  Naohisa Goto  <ngotogenome@g...>
+
+	* 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@r...>
 
 	* array.c: clarifies Array#reject! documentation.
Index: dir.c
===================================================================
--- dir.c	(revision 52471)
+++ dir.c	(revision 52472)
@@ -619,6 +619,19 @@ dir_inspect(VALUE dir) https://github.com/ruby/ruby/blob/trunk/dir.c#L619
     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:

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]