signal_i386 (resubmit)

Ove Kaaven ovek at arcticnet.no
Fri Jun 15 06:36:59 CDT 2001


(OK, since I had to go back to the good ol' Wine tree anyway to clean up
some of the DirectX regressions in it before we dare to merge WineHQ
again, I thought about bringing up again some of the patches I had lying
around in my old Wine tree... here, the restructured DOS support.)

This patch was submitted a while ago (Jan 2001), but apparently never
applied, but I can't find any comment/objection to it either in the
mailing list archives, so here's a resubmit.

"(I have to remove SA_NOMASK, or else Linux ignores the sa_mask
completely... and since I can't use SA_NOMASK, I still unblock all
signals, in order to be sure to unblock the original signal.)"

Log:
Block SIGINT and SIGALRM in signal handlers.

Index: dlls/ntdll/exception.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/exception.c,v
retrieving revision 1.33
diff -u -r1.33 exception.c
--- dlls/ntdll/exception.c	2001/02/27 02:09:17	1.33
+++ dlls/ntdll/exception.c	2001/06/15 11:16:22
@@ -37,6 +37,8 @@
 # error You must define GET_IP for this CPU
 #endif
 
+extern void SIGNAL_Unblock(void);
+
 void WINAPI EXC_RtlRaiseException( PEXCEPTION_RECORD, PCONTEXT );
 void WINAPI EXC_RtlUnwind( PEXCEPTION_FRAME, LPVOID, 
                            PEXCEPTION_RECORD, DWORD, PCONTEXT );
@@ -173,6 +175,8 @@
     TRACE( "code=%lx flags=%lx\n", rec->ExceptionCode, rec->ExceptionFlags );
 
     if (send_debug_event( rec, TRUE, context ) == DBG_CONTINUE) return;  /* continue execution */
+
+    SIGNAL_Unblock(); /* we may be in a signal handler, and exception handlers may jump out */
 
     frame = NtCurrentTeb()->except;
     nested_frame = NULL;
Index: dlls/ntdll/signal_i386.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/signal_i386.c,v
retrieving revision 1.23
diff -u -r1.23 signal_i386.c
--- dlls/ntdll/signal_i386.c	2001/05/09 19:45:07	1.23
+++ dlls/ntdll/signal_i386.c	2001/06/15 11:16:23
@@ -346,7 +346,9 @@
 
 DEFAULT_DEBUG_CHANNEL(seh);
 
+static sigset_t all_sigs;
 
+
 /***********************************************************************
  *           get_trap_code
  *
@@ -617,6 +619,17 @@
 }
 
 
+/***********************************************************************
+ *           SIGNAL_Unblock
+ *
+ * Unblock signals. Called from EXC_RtlRaiseException.
+ */
+void SIGNAL_Unblock( void )
+{
+    sigprocmask( SIG_UNBLOCK, &all_sigs, NULL );
+}
+
+
 /**********************************************************************
  *		do_segv
  *
@@ -840,8 +853,9 @@
     {
         struct kernel_sigaction sig_act;
         sig_act.ksa_handler = func;
-        sig_act.ksa_flags   = SA_RESTART | SA_NOMASK;
-        sig_act.ksa_mask    = 0;
+        sig_act.ksa_flags   = SA_RESTART;
+        sig_act.ksa_mask    = (1 << (SIGINT-1)) |
+                              (1 << (SIGALRM-1));
         /* point to the top of the stack */
         sig_act.ksa_restorer = (char *)NtCurrentTeb()->signal_stack + SIGNAL_STACK_SIZE;
         return wine_sigaction( sig, &sig_act, NULL );
@@ -849,9 +863,11 @@
 #endif  /* linux */
     sig_act.sa_handler = func;
     sigemptyset( &sig_act.sa_mask );
+    sigaddset( &sig_act.sa_mask, SIGINT );
+    sigaddset( &sig_act.sa_mask, SIGALRM );
 
 #ifdef linux
-    sig_act.sa_flags = SA_RESTART | SA_NOMASK;
+    sig_act.sa_flags = SA_RESTART;
 #elif defined (__svr4__) || defined(_SCO_DS)
     sig_act.sa_flags = SA_SIGINFO | SA_RESTART;
 #else
@@ -887,7 +903,9 @@
 #endif  /* linux */
     }
 #endif  /* HAVE_SIGALTSTACK */
-    
+
+    sigfillset( &all_sigs );
+
     /* automatic child reaping to avoid zombies */
     signal( SIGCHLD, SIG_IGN );
 





More information about the wine-patches mailing list