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

ruby-changes:21601

From: akr <ko1@a...>
Date: Mon, 7 Nov 2011 19:44:11 +0900 (JST)
Subject: [ruby-changes:21601] akr:r33650 (trunk): * io.c (rb_close_before_exec): use F_MAXFD if available.

akr	2011-11-07 19:44:02 +0900 (Mon, 07 Nov 2011)

  New Revision: 33650

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

  Log:
    * io.c (rb_close_before_exec): use F_MAXFD if available.
      F_MAXFD is available on NetBSD since NetBSD 2.0.

  Modified files:
    trunk/ChangeLog
    trunk/io.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 33649)
+++ ChangeLog	(revision 33650)
@@ -1,3 +1,8 @@
+Mon Nov  7 19:43:10 2011  Tanaka Akira  <akr@f...>
+
+	* io.c (rb_close_before_exec): use F_MAXFD if available.
+	  F_MAXFD is available on NetBSD since NetBSD 2.0.
+
 Mon Nov  7 19:25:16 2011  NAKAMURA Usaku  <usa@r...>
 
 	* test/ruby/test_io_m17n.rb
Index: io.c
===================================================================
--- io.c	(revision 33649)
+++ io.c	(revision 33650)
@@ -5123,6 +5123,13 @@
     int max = max_file_descriptor;
     if (max < maxhint)
         max = maxhint;
+#ifdef F_MAXFD
+    /* F_MAXFD is available since NetBSD 2.0. */
+    ret = fcntl(0, F_MAXFD);
+    if (ret != -1) {
+        max = ret;
+    }
+#endif
     for (fd = lowfd; fd <= max; fd++) {
         if (!NIL_P(noclose_fds) &&
             RTEST(rb_hash_lookup(noclose_fds, INT2FIX(fd))))

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

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