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

ruby-changes:15893

From: yugui <ko1@a...>
Date: Sun, 16 May 2010 21:17:40 +0900 (JST)
Subject: [ruby-changes:15893] Ruby:r27840 (ruby_1_9_2): merges r27789 from trunk into ruby_1_9_2.

yugui	2010-05-16 21:15:59 +0900 (Sun, 16 May 2010)

  New Revision: 27840

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

  Log:
    merges r27789 from trunk into ruby_1_9_2.
    --
    * vm_core.c (rb_thread_struct): add a field for sigaltstack.
    
    * thread_pthread.c (thread_start_func_1): initialize machine stack
      information.
    
    * thread.c (thread_start_func_2): set sigaltstack for each sub thread.
      [ruby-core:24540] [ruby-core:30207]

  Modified files:
    branches/ruby_1_9_2/ChangeLog
    branches/ruby_1_9_2/signal.c
    branches/ruby_1_9_2/thread.c
    branches/ruby_1_9_2/thread_pthread.c
    branches/ruby_1_9_2/vm_core.h

Index: ruby_1_9_2/ChangeLog
===================================================================
--- ruby_1_9_2/ChangeLog	(revision 27839)
+++ ruby_1_9_2/ChangeLog	(revision 27840)
@@ -1,3 +1,13 @@
+Fri May 14 01:17:10 2010  Yusuke Endoh  <mame@t...>
+
+	* vm_core.c (rb_thread_struct): add a field for sigaltstack.
+
+	* thread_pthread.c (thread_start_func_1): initialize machine stack
+	  information.
+
+	* thread.c (thread_start_func_2): set sigaltstack for each sub thread.
+	  [ruby-core:24540] [ruby-core:30207]
+
 Thu May 13 07:37:49 2010  Tanaka Akira  <akr@f...>
 
 	* ext/sdbm/_sdbm.c: include unistd.h before sdbm.h for off_t.
Index: ruby_1_9_2/thread_pthread.c
===================================================================
--- ruby_1_9_2/thread_pthread.c	(revision 27839)
+++ ruby_1_9_2/thread_pthread.c	(revision 27840)
@@ -344,6 +344,7 @@
 	rb_thread_t *th = th_ptr;
 	VALUE stack_start;
 
+	native_thread_init_stack(th);
 	/* run */
 	thread_start_func_2(th, &stack_start, rb_ia64_bsp());
     }
Index: ruby_1_9_2/vm_core.h
===================================================================
--- ruby_1_9_2/vm_core.h	(revision 27839)
+++ ruby_1_9_2/vm_core.h	(revision 27840)
@@ -63,6 +63,10 @@
 #define va_init_list(a,b) va_start(a)
 #endif
 
+#if defined(SIGSEGV) && defined(HAVE_SIGALTSTACK) && defined(SA_SIGINFO) && !defined(__NetBSD__)
+#define USE_SIGALTSTACK
+#endif
+
 /*****************/
 /* configuration */
 /*****************/
@@ -473,6 +477,9 @@
     /* misc */
     int method_missing_reason;
     int abort_on_exception;
+#ifdef USE_SIGALTSTACK
+    void *altstack;
+#endif
 } rb_thread_t;
 
 /* iseq.c */
Index: ruby_1_9_2/thread.c
===================================================================
--- ruby_1_9_2/thread.c	(revision 27839)
+++ ruby_1_9_2/thread.c	(revision 27840)
@@ -417,7 +417,12 @@
     rb_thread_t *join_th;
     rb_thread_t *main_th;
     VALUE errinfo = Qnil;
+# ifdef USE_SIGALTSTACK
+    void rb_register_sigaltstack(rb_thread_t *th);
 
+    rb_register_sigaltstack(th);
+# endif
+
     ruby_thread_set_native(th);
 
     th->machine_stack_start = stack_start;
Index: ruby_1_9_2/signal.c
===================================================================
--- ruby_1_9_2/signal.c	(revision 27839)
+++ ruby_1_9_2/signal.c	(revision 27840)
@@ -420,10 +420,6 @@
 #define sighandler_t sh_t
 #endif
 
-#if defined(SIGSEGV) && defined(HAVE_SIGALTSTACK) && defined(SA_SIGINFO) && !defined(__NetBSD__)
-#define USE_SIGALTSTACK
-#endif
-
 typedef RETSIGTYPE (*sighandler_t)(int);
 #ifdef USE_SIGALTSTACK
 typedef void ruby_sigaction_t(int, siginfo_t*, void*);
@@ -442,18 +438,17 @@
 #define ALT_STACK_SIZE (4*1024)
 #endif
 /* alternate stack for SIGSEGV */
-static void
-register_sigaltstack(void)
+void
+rb_register_sigaltstack(rb_thread_t *th)
 {
-    static void *altstack = 0;
     stack_t newSS, oldSS;
 
-    if (altstack) return;
+    if (th->altstack) return;
 
-    newSS.ss_sp = altstack = malloc(ALT_STACK_SIZE);
+    newSS.ss_sp = th->altstack = malloc(ALT_STACK_SIZE);
     if (newSS.ss_sp == NULL)
 	/* should handle error */
-	rb_bug("register_sigaltstack. malloc error\n");
+	rb_bug("rb_register_sigaltstack. malloc error\n");
     newSS.ss_size = ALT_STACK_SIZE;
     newSS.ss_flags = 0;
 
@@ -737,7 +732,7 @@
       case SIGSEGV:
         func = (sighandler_t)sigsegv;
 # ifdef USE_SIGALTSTACK
-        register_sigaltstack();
+        rb_register_sigaltstack(GET_THREAD());
 # endif
         break;
 #endif
@@ -1130,7 +1125,7 @@
 #endif
 #ifdef SIGSEGV
 # ifdef USE_SIGALTSTACK
-    register_sigaltstack();
+    rb_register_sigaltstack(GET_THREAD());
 # endif
     install_sighandler(SIGSEGV, (sighandler_t)sigsegv);
 #endif

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

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