[Gc] [PATCH] GNU/Hurd lacks SA_SIGINFO

Samuel Thibault samuel.thibault at ens-lyon.org
Wed Aug 8 16:35:40 PDT 2007


Hi,

GNU/Hurd doesn't have SA_SIGINFO, here is a patch.

Samuel
-------------- next part --------------
Index: pthread_stop_world.c
===================================================================
RCS file: /cvsroot/bdwgc/bdwgc/pthread_stop_world.c,v
retrieving revision 1.6
diff -u -p -r1.6 pthread_stop_world.c
--- pthread_stop_world.c	15 May 2007 18:57:47 -0000	1.6
+++ pthread_stop_world.c	8 Aug 2007 23:31:12 -0000
@@ -113,10 +113,18 @@ sem_t GC_suspend_ack_sem;
   sem_t GC_restart_ack_sem;
 #endif
 
+#ifdef SA_SIGINFO
 void GC_suspend_handler_inner(ptr_t sig_arg, void *context);
+#else
+void GC_suspend_handler_inner(ptr_t sig_arg);
+#endif
 
 #if defined(IA64) || defined(HP_PA) || defined(M68K)
+#ifdef SA_SIGINFO
 void GC_suspend_handler(int sig, siginfo_t *info, void *context)
+#else
+void GC_suspend_handler(int sig)
+#endif
 {
   int old_errno = errno;
   GC_with_callee_saves_pushed(GC_suspend_handler_inner, (ptr_t)(word)sig);
@@ -125,15 +133,27 @@ void GC_suspend_handler(int sig, siginfo
 #else
 /* We believe that in all other cases the full context is already	*/
 /* in the signal handler frame.						*/
+#ifdef SA_SIGINFO
 void GC_suspend_handler(int sig, siginfo_t *info, void *context)
+#else
+void GC_suspend_handler(int sig)
+#endif
 {
   int old_errno = errno;
+# ifdef SA_SIGINFO
   GC_suspend_handler_inner((ptr_t)(word)sig, context);
+# else
+  GC_suspend_handler_inner((ptr_t)(word)sig);
+# endif
   errno = old_errno;
 }
 #endif
 
+#ifdef SA_SIGINFO
 void GC_suspend_handler_inner(ptr_t sig_arg, void *context)
+#else
+void GC_suspend_handler_inner(ptr_t sig_arg)
+#endif
 {
     int sig = (int)(word)sig_arg;
     int dummy;
@@ -498,19 +518,29 @@ void GC_stop_init() {
 	ABORT("sem_init failed");
 #   endif
 
-    act.sa_flags = SA_RESTART | SA_SIGINFO;
+    act.sa_flags = SA_RESTART
+#   ifdef SA_SIGINFO
+    	| SA_SIGINFO
+#   endif
+	;
     if (sigfillset(&act.sa_mask) != 0) {
     	ABORT("sigfillset() failed");
     }
     GC_remove_allowed_signals(&act.sa_mask);
     /* SIG_THR_RESTART is set in the resulting mask.		*/
     /* It is unmasked by the handler when necessary. 		*/
+#   ifdef SA_SIGINFO
     act.sa_sigaction = GC_suspend_handler;
+#   else
+    act.sa_handler = GC_suspend_handler;
+#   endif
     if (sigaction(SIG_SUSPEND, &act, NULL) != 0) {
     	ABORT("Cannot set SIG_SUSPEND handler");
     }
 
+#   ifdef SA_SIGINFO
     act.sa_flags &= ~ SA_SIGINFO;
+#   endif
     act.sa_handler = GC_restart_handler;
     if (sigaction(SIG_THR_RESTART, &act, NULL) != 0) {
     	ABORT("Cannot set SIG_THR_RESTART handler");


More information about the Gc mailing list