From bdf83bc546ef5ea8128a4126f5116c0e1df5aa50 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sun, 1 Aug 1999 14:54:16 +0000 Subject: [PATCH] Removed SIGNAL_MaskAsyncEvents and cleaned up signal handling. --- dlls/ntdll/exception.c | 12 +++++------ include/miscemu.h | 3 +-- loader/dos/module.c | 2 -- loader/signal.c | 48 ++++-------------------------------------- 4 files changed, 11 insertions(+), 54 deletions(-) diff --git a/dlls/ntdll/exception.c b/dlls/ntdll/exception.c index e3728f300d5..ddf538696d3 100644 --- a/dlls/ntdll/exception.c +++ b/dlls/ntdll/exception.c @@ -690,15 +690,15 @@ static HANDLER_DEF(EXC_int) */ void EXC_InitHandlers(void) { - SIGNAL_SetHandler( SIGINT, (void (*)())EXC_int, 1 ); - SIGNAL_SetHandler( SIGFPE, (void (*)())EXC_fpe, 1 ); - SIGNAL_SetHandler( SIGSEGV, (void (*)())EXC_segv, 1 ); - SIGNAL_SetHandler( SIGILL, (void (*)())EXC_segv, 1 ); + SIGNAL_SetHandler( SIGINT, (void (*)())EXC_int ); + SIGNAL_SetHandler( SIGFPE, (void (*)())EXC_fpe ); + SIGNAL_SetHandler( SIGSEGV, (void (*)())EXC_segv ); + SIGNAL_SetHandler( SIGILL, (void (*)())EXC_segv ); #ifdef SIGBUS - SIGNAL_SetHandler( SIGBUS, (void (*)())EXC_segv, 1 ); + SIGNAL_SetHandler( SIGBUS, (void (*)())EXC_segv ); #endif #ifdef SIGTRAP - SIGNAL_SetHandler( SIGTRAP, (void (*)())EXC_trap, 1 ); + SIGNAL_SetHandler( SIGTRAP, (void (*)())EXC_trap ); #endif return; } diff --git a/include/miscemu.h b/include/miscemu.h index 16d98b240e3..d6648a6ca0f 100644 --- a/include/miscemu.h +++ b/include/miscemu.h @@ -186,8 +186,7 @@ extern void WINAPI XMS_Handler(CONTEXT86*); /* loader/signal.c */ extern BOOL SIGNAL_Init(void); -extern void SIGNAL_SetHandler( int sig, void (*func)(), int flags ); -extern void SIGNAL_MaskAsyncEvents( BOOL flag ); +extern void SIGNAL_SetHandler( int sig, void (*func)() ); /* misc/aspi.c */ extern void ASPI_DOS_HandleInt(CONTEXT86 *context); diff --git a/loader/dos/module.c b/loader/dos/module.c index 630d67d5286..4acebc00fdf 100644 --- a/loader/dos/module.c +++ b/loader/dos/module.c @@ -423,8 +423,6 @@ BOOL MZ_InitTask( LPDOSTASK lpDosTask ) /* put our pipes somewhere dosmod can find them */ dup2(write_fd[0],0); /* stdin */ dup2(x_fd,1); /* stdout */ - /* enable signals */ - SIGNAL_MaskAsyncEvents(FALSE); /* now load dosmod */ /* check argv[0]-derived paths first, since the newest dosmod is most likely there * (at least it was once for Andreas Mohr, so I decided to make it easier for him) */ diff --git a/loader/signal.c b/loader/signal.c index 7ac942f1511..ab67c24180b 100644 --- a/loader/signal.c +++ b/loader/signal.c @@ -87,31 +87,12 @@ static inline int wine_sigaction( int sig, struct kernel_sigaction *new, /* Signal stack */ static char SIGNAL_Stack[16384]; -static sigset_t async_signal_set; - -/********************************************************************** - * SIGNAL_child - * - * wait4 terminated child processes - */ -static HANDLER_DEF(SIGNAL_child) -{ - HANDLER_INIT(); -#ifdef HAVE_WAIT4 - wait4( 0, NULL, WNOHANG, NULL); -#elif defined (HAVE_WAITPID) - /* I am sort-of guessing that this is the same as the wait4 call. */ - waitpid (0, NULL, WNOHANG); -#else - wait(NULL); -#endif -} /********************************************************************** * SIGNAL_SetHandler */ -void SIGNAL_SetHandler( int sig, void (*func)(), int flags ) +void SIGNAL_SetHandler( int sig, void (*func)() ) { int ret; @@ -119,7 +100,7 @@ void SIGNAL_SetHandler( int sig, void (*func)(), int flags ) struct kernel_sigaction sig_act; sig_act.sa_handler = func; - sig_act.sa_flags = SA_RESTART | (flags) ? SA_NOMASK : 0; + sig_act.sa_flags = SA_RESTART | SA_NOMASK; sig_act.sa_mask = 0; /* Point to the top of the stack, minus 4 just in case, and make it aligned */ @@ -153,19 +134,6 @@ void SIGNAL_SetHandler( int sig, void (*func)(), int flags ) } } -extern void stop_wait(int a); -extern void WINSOCK_sigio(int a); -extern void ASYNC_sigio(int a); - - -/********************************************************************** - * SIGNAL_MaskAsyncEvents - */ -void SIGNAL_MaskAsyncEvents( BOOL flag ) -{ - sigprocmask( (flag) ? SIG_BLOCK : SIG_UNBLOCK , &async_signal_set, NULL); -} - /********************************************************************** * SIGNAL_Init @@ -184,18 +152,10 @@ BOOL SIGNAL_Init(void) } #endif /* HAVE_SIGALTSTACK */ - sigemptyset(&async_signal_set); - - SIGNAL_SetHandler( SIGCHLD, (void (*)())SIGNAL_child, 1); -#ifdef SIGIO - sigaddset(&async_signal_set, SIGIO); -/* SIGNAL_SetHandler( SIGIO, (void (*)())WINSOCK_sigio, 0); */ - SIGNAL_SetHandler( SIGIO, (void (*)())ASYNC_sigio, 0); -#endif - sigaddset(&async_signal_set, SIGALRM); - /* ignore SIGPIPE so that WINSOCK can get a EPIPE error instead */ signal (SIGPIPE, SIG_IGN); + /* automatic child reaping to avoid zombies */ + signal (SIGCHLD, SIG_IGN); EXC_InitHandlers(); return TRUE; }