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

ruby-changes:21619

From: naruse <ko1@a...>
Date: Tue, 8 Nov 2011 17:26:17 +0900 (JST)
Subject: [ruby-changes:21619] naruse:r33668 (trunk): * ext/pty/pty.c (get_device_once): FreeBSD 8 supported O_CLOEXEC flag

naruse	2011-11-08 17:26:00 +0900 (Tue, 08 Nov 2011)

  New Revision: 33668

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

  Log:
    * ext/pty/pty.c (get_device_once): FreeBSD 8 supported O_CLOEXEC flag
      for posix_openpt, but FreeBSD 9's posix_openpt doesn't support
      O_CLOEXEC and fails if specified.

  Modified files:
    trunk/ChangeLog
    trunk/ext/pty/pty.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 33667)
+++ ChangeLog	(revision 33668)
@@ -6,8 +6,9 @@
 
 Tue Nov  8 11:01:04 2011  NARUSE, Yui  <naruse@r...>
 
-	* ext/pty/pty.c (get_device_once): FreeBSD's posix_openpt doesn't
-	  support O_CLOEXEC and fails if specified.
+	* ext/pty/pty.c (get_device_once): FreeBSD 8 supported O_CLOEXEC flag
+	  for posix_openpt, but FreeBSD 9's posix_openpt doesn't support
+	  O_CLOEXEC and fails if specified.
 
 Tue Nov  8 02:36:45 2011  NAKAMURA Usaku  <usa@r...>
 
Index: ext/pty/pty.c
===================================================================
--- ext/pty/pty.c	(revision 33667)
+++ ext/pty/pty.c	(revision 33668)
@@ -291,19 +291,19 @@
     dfl.sa_flags = 0;
     sigemptyset(&dfl.sa_mask);
 
-#if defined(__sun)
+#if defined(__sun) || defined(__FreeBSD__)
     /* workaround for Solaris 10: grantpt() doesn't work if FD_CLOEXEC is set.  [ruby-dev:44688] */
+    /* FreeBSD 8 supported O_CLOEXEC for posix_openpt, but FreeBSD 9 removed it */
     if ((masterfd = posix_openpt(O_RDWR|O_NOCTTY)) == -1) goto error;
     if (sigaction(SIGCHLD, &dfl, &old) == -1) goto error;
     if (grantpt(masterfd) == -1) goto grantpt_error;
     rb_fd_fix_cloexec(masterfd);
 #else
     flags = O_RDWR|O_NOCTTY;
-# if defined(O_CLOEXEC) && !defined(__FreeBSD__)
+# if defined(O_CLOEXEC)
     /* glibc posix_openpt() in GNU/Linux calls open("/dev/ptmx", flags) internally.
      * So version dependency on GNU/Linux is same as O_CLOEXEC with open().
-     * O_CLOEXEC is available since Linux 2.6.23.  Linux 2.6.18 silently ignore it.
-     * FreeBSD's posix_openpt doesn't support O_CLOEXEC and fails if specified*/
+     * O_CLOEXEC is available since Linux 2.6.23.  Linux 2.6.18 silently ignore it. */
     flags |= O_CLOEXEC;
 # endif
     if ((masterfd = posix_openpt(flags)) == -1) goto error;

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

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