console separation 2/4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



dispatching signals from ntdll
Name:          con_sighook
ChangeLog:     added a generic mechanism to set up hooks for dispatching signal handlers outside ntdll
License:       X11
GenDate:       2002/07/30 19:17:12 UTC
ModifiedFiles: dlls/ntdll/Makefile.in dlls/ntdll/ntdll.spec dlls/ntdll/signal_i386.c dlls/ntdll/signal_sparc.c dlls/kernel/kernel_main.c
AddedFiles:    dlls/ntdll/signal.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/ntdll/Makefile.in,v
retrieving revision 1.29
diff -u -u -r1.29 Makefile.in
--- dlls/ntdll/Makefile.in	10 Jul 2002 23:22:29 -0000	1.29
+++ dlls/ntdll/Makefile.in	30 Jul 2002 12:17:13 -0000
@@ -110,6 +108,7 @@
 	rtlstr.c \
 	string.c \
 	sec.c \
+	signal.c \
 	signal_i386.c \
 	signal_sparc.c \
 	sync.c \
Index: dlls/ntdll/ntdll.spec
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/ntdll/ntdll.spec,v
retrieving revision 1.71
diff -u -u -r1.71 ntdll.spec
--- dlls/ntdll/ntdll.spec	28 Jul 2002 17:49:26 -0000	1.71
+++ dlls/ntdll/ntdll.spec	30 Jul 2002 09:12:02 -0000
@@ -1026,3 +1026,6 @@
 
 # Codepages
 @ cdecl __wine_init_codepages(ptr ptr) __wine_init_codepages
+
+# signal handling
+@ cdecl __wine_set_signal_handler(long ptr) __wine_set_signal_handler
Index: dlls/ntdll/signal_i386.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/ntdll/signal_i386.c,v
retrieving revision 1.40
diff -u -u -r1.40 signal_i386.c
--- dlls/ntdll/signal_i386.c	22 Jul 2002 20:47:11 -0000	1.40
+++ dlls/ntdll/signal_i386.c	30 Jul 2002 09:17:25 -0000
@@ -54,6 +54,8 @@
 
 #include "selectors.h"
 
+extern int     wine_dispatch_signal(unsigned sig);
+
 /***********************************************************************
  * signal context platform-specific definitions
  */
@@ -974,8 +976,7 @@
  */
 static HANDLER_DEF(int_handler)
 {
-    extern int CONSOLE_HandleCtrlC(void);
-    if (!CONSOLE_HandleCtrlC())
+    if (!wine_dispatch_signal(SIGINT))
     {
         EXCEPTION_RECORD rec;
         CONTEXT context;
Index: dlls/ntdll/signal_sparc.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/ntdll/signal_sparc.c,v
retrieving revision 1.15
diff -u -u -r1.15 signal_sparc.c
--- dlls/ntdll/signal_sparc.c	21 Jun 2002 20:10:07 -0000	1.15
+++ dlls/ntdll/signal_sparc.c	30 Jul 2002 09:17:22 -0000
@@ -38,6 +38,8 @@
 
 #include "wine/debug.h"
 
+extern int     wine_dispatch_signal(unsigned sig);
+
 WINE_DEFAULT_DEBUG_CHANNEL(seh);
 
 static sigset_t all_sigs;
@@ -310,8 +312,7 @@
  */
 static void int_handler( int signal, siginfo_t *info, ucontext_t *ucontext )
 {
-    extern int CONSOLE_HandleCtrlC(void);
-    if (!CONSOLE_HandleCtrlC())
+    if (!wine_dispatch_signal(SIGINT))
     {
         EXCEPTION_RECORD rec;
         CONTEXT context;
Index: dlls/kernel/kernel_main.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/kernel/kernel_main.c,v
retrieving revision 1.29
diff -u -u -r1.29 kernel_main.c
--- dlls/kernel/kernel_main.c	16 May 2002 20:32:16 -0000	1.29
+++ dlls/kernel/kernel_main.c	30 Jul 2002 19:13:54 -0000
@@ -24,20 +24,23 @@
 #include <ctype.h>
 #include <string.h>
 #include <sys/stat.h>
+#include <signal.h>
 
 #include "winbase.h"
 
 #include "wine/winbase16.h"
 #include "wine/library.h"
 #include "file.h"
 #include "global.h"
 #include "miscemu.h"
 #include "module.h"
 #include "task.h"
 
 extern void CODEPAGE_Init(void);
 extern BOOL RELAY_Init(void);
 
+extern  int __wine_set_signal_handler(unsigned, int (*)(unsigned));
+extern  int CONSOLE_HandleCtrlC(unsigned);
 
 /***********************************************************************
  *           KERNEL process initialisation routine
@@ -99,6 +105,9 @@
 
     /* Create the shared heap for broken win95 native dlls */
     HeapCreate( HEAP_SHARED, 0, 0 );
+
+    /* finish the process initialisation, if needed */
+    __wine_set_signal_handler(SIGINT, CONSOLE_HandleCtrlC);
 
     return TRUE;
 }
--- /dev/null	Thu Jan  1 01:00:00 1970
+++ dlls/ntdll/signal.c	Tue Jul 30 13:53:55 2002
@@ -0,0 +1,21 @@
+#include <stdlib.h>
+
+typedef int (*wine_signal_handler)(unsigned sig);
+
+static  wine_signal_handler handlers[256];
+
+int     __wine_set_signal_handler(unsigned sig, wine_signal_handler wsh)
+{
+    if (sig > sizeof(handlers) / sizeof(handlers[0])) return -1;
+    if (handlers[sig] != NULL) return -2;
+
+    handlers[sig] = wsh;
+
+    return 0;
+}
+
+int     wine_dispatch_signal(unsigned sig)
+{
+    if (handlers[sig] == NULL) return 0;
+    return handlers[sig](sig);
+}

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux