[MLton-commit] r7395

Matthew Fluet fluet at mlton.org
Tue Jan 19 10:58:31 PST 2010


Default and ignore signal handlers don't need to run on alternate signal stack.
----------------------------------------------------------------------

U   mlton/trunk/runtime/basis/Posix/Signal.c

----------------------------------------------------------------------

Modified: mlton/trunk/runtime/basis/Posix/Signal.c
===================================================================
--- mlton/trunk/runtime/basis/Posix/Signal.c	2010-01-19 14:01:14 UTC (rev 7394)
+++ mlton/trunk/runtime/basis/Posix/Signal.c	2010-01-19 18:58:30 UTC (rev 7395)
@@ -6,21 +6,12 @@
   GC_handler (&gcState, signum);
 }
 
-enum {
-#if (defined (SA_ONSTACK))
-  SA_FLAGS = SA_ONSTACK,
-#else
-  SA_FLAGS = 0,
-#endif
-};
-
 C_Errno_t(C_Int_t) Posix_Signal_default (C_Signal_t signum) {
   struct sigaction sa;
 
   sigdelset (GC_getSignalsHandledAddr (&gcState), signum);
   memset (&sa, 0, sizeof(sa));
   sa.sa_handler = SIG_DFL;
-  sa.sa_flags = SA_FLAGS;
   return sigaction (signum, &sa, NULL);
 }
 
@@ -28,7 +19,7 @@
   int res;
   struct sigaction sa;
 
-  sa.sa_flags = SA_FLAGS;
+  memset (&sa, 0, sizeof(sa));
   res = sigaction (signum, NULL, &sa);
   *((C_Int_t*)isDef) = sa.sa_handler == SIG_DFL;
   return res;
@@ -40,7 +31,6 @@
   sigdelset (GC_getSignalsHandledAddr (&gcState), signum);
   memset (&sa, 0, sizeof(sa));
   sa.sa_handler = SIG_IGN;
-  sa.sa_flags = SA_FLAGS;
   return sigaction (signum, &sa, NULL);
 }
 
@@ -48,7 +38,7 @@
   int res;
   struct sigaction sa;
 
-  sa.sa_flags = SA_FLAGS;
+  memset (&sa, 0, sizeof(sa));
   res = sigaction (signum, NULL, &sa);
   *((C_Int_t*)isIgn) = sa.sa_handler == SIG_IGN;
   return res;
@@ -63,8 +53,10 @@
    * s->signalsPending (else there is a race condition).
    */
   sigfillset (&sa.sa_mask);
+#if HAS_SIGALTSTACK
+  sa.sa_flags = SA_ONSTACK;
+#endif
   sa.sa_handler = handler;
-  sa.sa_flags = SA_FLAGS;
   return sigaction (signum, &sa, NULL);
 }
 




More information about the MLton-commit mailing list