server: Use SIGQUIT instead of SIGTERM to terminate a thread.
This allows keeping the default SIGTERM behavior of killing the whole process.
This commit is contained in:
parent
e2a366ce33
commit
3b244b95b2
|
@ -1289,11 +1289,11 @@ static void abrt_handler( int signal, siginfo_t *siginfo, void *sigcontext )
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* term_handler
|
* quit_handler
|
||||||
*
|
*
|
||||||
* Handler for SIGTERM.
|
* Handler for SIGQUIT.
|
||||||
*/
|
*/
|
||||||
static void term_handler( int signal, siginfo_t *siginfo, void *sigcontext )
|
static void quit_handler( int signal, siginfo_t *siginfo, void *sigcontext )
|
||||||
{
|
{
|
||||||
WORD fs, gs;
|
WORD fs, gs;
|
||||||
init_handler( sigcontext, &fs, &gs );
|
init_handler( sigcontext, &fs, &gs );
|
||||||
|
@ -1392,8 +1392,8 @@ BOOL SIGNAL_Init(void)
|
||||||
if (sigaction( SIGFPE, &sig_act, NULL ) == -1) goto error;
|
if (sigaction( SIGFPE, &sig_act, NULL ) == -1) goto error;
|
||||||
sig_act.sa_sigaction = abrt_handler;
|
sig_act.sa_sigaction = abrt_handler;
|
||||||
if (sigaction( SIGABRT, &sig_act, NULL ) == -1) goto error;
|
if (sigaction( SIGABRT, &sig_act, NULL ) == -1) goto error;
|
||||||
sig_act.sa_sigaction = term_handler;
|
sig_act.sa_sigaction = quit_handler;
|
||||||
if (sigaction( SIGTERM, &sig_act, NULL ) == -1) goto error;
|
if (sigaction( SIGQUIT, &sig_act, NULL ) == -1) goto error;
|
||||||
sig_act.sa_sigaction = usr1_handler;
|
sig_act.sa_sigaction = usr1_handler;
|
||||||
if (sigaction( SIGUSR1, &sig_act, NULL ) == -1) goto error;
|
if (sigaction( SIGUSR1, &sig_act, NULL ) == -1) goto error;
|
||||||
|
|
||||||
|
|
|
@ -581,11 +581,11 @@ static HANDLER_DEF(abrt_handler)
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* term_handler
|
* quit_handler
|
||||||
*
|
*
|
||||||
* Handler for SIGTERM.
|
* Handler for SIGQUIT.
|
||||||
*/
|
*/
|
||||||
static HANDLER_DEF(term_handler)
|
static HANDLER_DEF(quit_handler)
|
||||||
{
|
{
|
||||||
server_abort_thread(0);
|
server_abort_thread(0);
|
||||||
}
|
}
|
||||||
|
@ -657,7 +657,7 @@ BOOL SIGNAL_Init(void)
|
||||||
if (set_handler( SIGSEGV, (void (*)())segv_handler ) == -1) goto error;
|
if (set_handler( SIGSEGV, (void (*)())segv_handler ) == -1) goto error;
|
||||||
if (set_handler( SIGILL, (void (*)())segv_handler ) == -1) goto error;
|
if (set_handler( SIGILL, (void (*)())segv_handler ) == -1) goto error;
|
||||||
if (set_handler( SIGABRT, (void (*)())abrt_handler ) == -1) goto error;
|
if (set_handler( SIGABRT, (void (*)())abrt_handler ) == -1) goto error;
|
||||||
if (set_handler( SIGTERM, (void (*)())term_handler ) == -1) goto error;
|
if (set_handler( SIGQUIT, (void (*)())quit_handler ) == -1) goto error;
|
||||||
if (set_handler( SIGUSR1, (void (*)())usr1_handler ) == -1) goto error;
|
if (set_handler( SIGUSR1, (void (*)())usr1_handler ) == -1) goto error;
|
||||||
#ifdef SIGBUS
|
#ifdef SIGBUS
|
||||||
if (set_handler( SIGBUS, (void (*)())segv_handler ) == -1) goto error;
|
if (set_handler( SIGBUS, (void (*)())segv_handler ) == -1) goto error;
|
||||||
|
|
|
@ -389,11 +389,11 @@ static HANDLER_DEF(abrt_handler)
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* term_handler
|
* quit_handler
|
||||||
*
|
*
|
||||||
* Handler for SIGTERM.
|
* Handler for SIGQUIT.
|
||||||
*/
|
*/
|
||||||
static HANDLER_DEF(term_handler)
|
static HANDLER_DEF(quit_handler)
|
||||||
{
|
{
|
||||||
server_abort_thread(0);
|
server_abort_thread(0);
|
||||||
}
|
}
|
||||||
|
@ -468,7 +468,7 @@ BOOL SIGNAL_Init(void)
|
||||||
if (set_handler( SIGBUS, (void (*)())bus_handler ) == -1) goto error;
|
if (set_handler( SIGBUS, (void (*)())bus_handler ) == -1) goto error;
|
||||||
if (set_handler( SIGTRAP, (void (*)())trap_handler ) == -1) goto error;
|
if (set_handler( SIGTRAP, (void (*)())trap_handler ) == -1) goto error;
|
||||||
if (set_handler( SIGABRT, (void (*)())abrt_handler ) == -1) goto error;
|
if (set_handler( SIGABRT, (void (*)())abrt_handler ) == -1) goto error;
|
||||||
if (set_handler( SIGTERM, (void (*)())term_handler ) == -1) goto error;
|
if (set_handler( SIGQUIT, (void (*)())quit_handler ) == -1) goto error;
|
||||||
if (set_handler( SIGUSR1, (void (*)())usr1_handler ) == -1) goto error;
|
if (set_handler( SIGUSR1, (void (*)())usr1_handler ) == -1) goto error;
|
||||||
/* 'ta 6' tells the kernel to synthesize any unaligned accesses this
|
/* 'ta 6' tells the kernel to synthesize any unaligned accesses this
|
||||||
process makes, instead of just signalling an error and terminating
|
process makes, instead of just signalling an error and terminating
|
||||||
|
|
|
@ -414,11 +414,11 @@ static HANDLER_DEF(abrt_handler)
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* term_handler
|
* quit_handler
|
||||||
*
|
*
|
||||||
* Handler for SIGTERM.
|
* Handler for SIGQUIT.
|
||||||
*/
|
*/
|
||||||
static HANDLER_DEF(term_handler)
|
static HANDLER_DEF(quit_handler)
|
||||||
{
|
{
|
||||||
server_abort_thread(0);
|
server_abort_thread(0);
|
||||||
}
|
}
|
||||||
|
@ -490,7 +490,7 @@ BOOL SIGNAL_Init(void)
|
||||||
if (set_handler( SIGSEGV, (void (*)())segv_handler ) == -1) goto error;
|
if (set_handler( SIGSEGV, (void (*)())segv_handler ) == -1) goto error;
|
||||||
if (set_handler( SIGILL, (void (*)())segv_handler ) == -1) goto error;
|
if (set_handler( SIGILL, (void (*)())segv_handler ) == -1) goto error;
|
||||||
if (set_handler( SIGABRT, (void (*)())abrt_handler ) == -1) goto error;
|
if (set_handler( SIGABRT, (void (*)())abrt_handler ) == -1) goto error;
|
||||||
if (set_handler( SIGTERM, (void (*)())term_handler ) == -1) goto error;
|
if (set_handler( SIGQUIT, (void (*)())quit_handler ) == -1) goto error;
|
||||||
if (set_handler( SIGUSR1, (void (*)())usr1_handler ) == -1) goto error;
|
if (set_handler( SIGUSR1, (void (*)())usr1_handler ) == -1) goto error;
|
||||||
#ifdef SIGBUS
|
#ifdef SIGBUS
|
||||||
if (set_handler( SIGBUS, (void (*)())segv_handler ) == -1) goto error;
|
if (set_handler( SIGBUS, (void (*)())segv_handler ) == -1) goto error;
|
||||||
|
|
|
@ -920,14 +920,14 @@ void kill_thread( struct thread *thread, int violent_death )
|
||||||
{
|
{
|
||||||
while (thread->wait) end_wait( thread );
|
while (thread->wait) end_wait( thread );
|
||||||
send_thread_wakeup( thread, NULL, STATUS_PENDING );
|
send_thread_wakeup( thread, NULL, STATUS_PENDING );
|
||||||
/* if it is waiting on the socket, we don't need to send a SIGTERM */
|
/* if it is waiting on the socket, we don't need to send a SIGQUIT */
|
||||||
violent_death = 0;
|
violent_death = 0;
|
||||||
}
|
}
|
||||||
kill_console_processes( thread, 0 );
|
kill_console_processes( thread, 0 );
|
||||||
debug_exit_thread( thread );
|
debug_exit_thread( thread );
|
||||||
abandon_mutexes( thread );
|
abandon_mutexes( thread );
|
||||||
wake_up( &thread->obj, 0 );
|
wake_up( &thread->obj, 0 );
|
||||||
if (violent_death) send_thread_signal( thread, SIGTERM );
|
if (violent_death) send_thread_signal( thread, SIGQUIT );
|
||||||
cleanup_thread( thread );
|
cleanup_thread( thread );
|
||||||
remove_process_thread( thread->process, thread );
|
remove_process_thread( thread->process, thread );
|
||||||
release_object( thread );
|
release_object( thread );
|
||||||
|
|
Loading…
Reference in New Issue