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

ruby-changes:35359

From: nobu <ko1@a...>
Date: Sun, 7 Sep 2014 10:57:53 +0900 (JST)
Subject: [ruby-changes:35359] nobu:r47441 (trunk): process.c: disable vfork on OS X

nobu	2014-09-07 10:57:44 +0900 (Sun, 07 Sep 2014)

  New Revision: 47441

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

  Log:
    process.c: disable vfork on OS X
    
    * process.c (retry_fork_async_signal_safe): revert r47439 but
      disable use of vfork on OS X instead, as it cause hang-up at
      test_process.rb:test_deadlock_by_signal_at_forking with parallel
      test.

  Modified files:
    trunk/configure.in
    trunk/process.c
Index: configure.in
===================================================================
--- configure.in	(revision 47440)
+++ configure.in	(revision 47441)
@@ -963,6 +963,7 @@ AS_CASE(["$target_os"], https://github.com/ruby/ruby/blob/trunk/configure.in#L963
 		ac_cv_type_getgroups=gid_t # getgroups() on Rosetta fills garbage
 		ac_cv_lib_crypt_crypt=no
 		ac_cv_func_fdatasync=no # Mac OS X wrongly reports it has fdatasync()
+		ac_cv_func_vfork_works=no
                 AC_CACHE_CHECK(for broken crypt with 8bit chars, rb_cv_broken_crypt,
                     [AC_TRY_RUN([
 #include <stdio.h>
@@ -2669,11 +2670,9 @@ if test x"$ac_cv_header_ucontext_h" = xy https://github.com/ruby/ruby/blob/trunk/configure.in#L2670
     fi
 fi
 
-if test "$rb_with_pthread" = "yes"; then
-    for f in fork vfork; do
-	if eval 'test "$ac_cv_func_'$f'_works" = "yes"'; then
-	    AC_CACHE_CHECK([if $f works with pthread], rb_cv_${f}_with_pthread,
-		[AC_TRY_RUN([
+if test "$ac_cv_func_fork_works" = "yes" -a "$rb_with_pthread" = "yes"; then
+    AC_CACHE_CHECK([if fork works with pthread], rb_cv_fork_with_pthread,
+	[AC_TRY_RUN([
 #include <stdlib.h>
 #include <unistd.h>
 #include <pthread.h>
@@ -2712,7 +2711,7 @@ main(int argc, char *argv[]) https://github.com/ruby/ruby/blob/trunk/configure.in#L2711
 {
     pid_t pid;
     if (use_threads()) return EXIT_FAILURE;
-    pid = $f();
+    pid = fork();
 
     if (pid) {
 	int loc;
@@ -2730,14 +2729,10 @@ main(int argc, char *argv[]) https://github.com/ruby/ruby/blob/trunk/configure.in#L2729
 
     return EXIT_SUCCESS;
 }],
-		work=yes,
-		work=no,
-		work=yes)]
-	    eval rb_cv_${f}_with_pthread=$work)
-	fi
-    done
+	rb_cv_fork_with_pthread=yes,
+	rb_cv_fork_with_pthread=no,
+	rb_cv_fork_with_pthread=yes)])
     test x$rb_cv_fork_with_pthread = xyes || AC_DEFINE(CANNOT_FORK_WITH_PTHREAD)
-    test x$rb_cv_vfork_with_pthread = xyes || AC_DEFINE(CANNOT_VFORK_WITH_PTHREAD)
 fi
 
 
Index: process.c
===================================================================
--- process.c	(revision 47440)
+++ process.c	(revision 47441)
@@ -3281,7 +3281,7 @@ recv_child_error(int fd, int *errp, char https://github.com/ruby/ruby/blob/trunk/process.c#L3281
     return size != 0;
 }
 
-#if defined(HAVE_WORKING_VFORK) && !defined(CANNOT_VFORK_WITH_PTHREAD)
+#ifdef HAVE_WORKING_VFORK
 #if !defined(HAVE_GETRESUID) && defined(HAVE_GETUIDX)
 /* AIX 7.1 */
 static int
@@ -3491,7 +3491,7 @@ retry_fork_async_signal_safe(int *status https://github.com/ruby/ruby/blob/trunk/process.c#L3491
     while (1) {
         prefork();
         disable_child_handler_before_fork(&old);
-#if defined(HAVE_WORKING_VFORK) && !defined(CANNOT_VFORK_WITH_PTHREAD)
+#ifdef HAVE_WORKING_VFORK
         if (!has_privilege())
             pid = vfork();
         else

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

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