mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
Bug#54667: Unnecessary signal handler redefinition
POSIX requires that a signal handler defined with sigaction() is not reset on delivering a signal unless SA_NODEFER or SA_RESETHAND is set. It is therefore unnecessary to redefine the handler on signal delivery on platforms where sigaction() is used without those flags. include/my_alarm.h: Renamed DONT_REMEMBER_SIGNAL -> SIGNAL_HANDLER_RESET_ON_DELIVERY. include/my_global.h: Renamed DONT_REMEMBER_SIGNAL -> SIGNAL_HANDLER_RESET_ON_DELIVERY. The latter is now defined only on non-BSD platforms missing the POSIX sigaction() function. libmysql/libmysql.c: Renamed DONT_REMEMBER_SIGNAL -> SIGNAL_HANDLER_RESET_ON_DELIVERY mysys/thr_alarm.c: Renamed DONT_REMEMBER_SIGNAL -> SIGNAL_HANDLER_RESET_ON_DELIVERY sql/mysqld.cc: Renamed DONT_REMEMBER_SIGNAL -> SIGNAL_HANDLER_RESET_ON_DELIVERY
This commit is contained in:
parent
b36a028224
commit
f3ccf5061f
5 changed files with 11 additions and 11 deletions
|
@ -36,14 +36,14 @@ extern ulong my_time_to_wait_for_lock;
|
|||
#define ALARM_END VOID(signal(SIGALRM,alarm_signal)); \
|
||||
VOID(alarm(alarm_old));
|
||||
#define ALARM_TEST my_have_got_alarm
|
||||
#ifdef DONT_REMEMBER_SIGNAL
|
||||
#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY
|
||||
#define ALARM_REINIT VOID(alarm(MY_HOW_OFTEN_TO_ALARM)); \
|
||||
VOID(signal(SIGALRM,my_set_alarm_variable));\
|
||||
my_have_got_alarm=0;
|
||||
#else
|
||||
#define ALARM_REINIT VOID(alarm((uint) MY_HOW_OFTEN_TO_ALARM)); \
|
||||
my_have_got_alarm=0;
|
||||
#endif /* DONT_REMEMBER_SIGNAL */
|
||||
#endif /* SIGNAL_HANDLER_RESET_ON_DELIVERY */
|
||||
#else
|
||||
#define ALARM_VARIABLES long alarm_pos=0,alarm_end_pos=MY_HOW_OFTEN_TO_WRITE-1
|
||||
#define ALARM_INIT
|
||||
|
|
|
@ -541,8 +541,8 @@ extern "C" int madvise(void *addr, size_t len, int behav);
|
|||
#endif
|
||||
|
||||
/* Does the system remember a signal handler after a signal ? */
|
||||
#ifndef HAVE_BSD_SIGNALS
|
||||
#define DONT_REMEMBER_SIGNAL
|
||||
#if !defined(HAVE_BSD_SIGNALS) && !defined(HAVE_SIGACTION)
|
||||
#define SIGNAL_HANDLER_RESET_ON_DELIVERY
|
||||
#endif
|
||||
|
||||
/* Define void to stop lint from generating "null effekt" comments */
|
||||
|
|
|
@ -328,7 +328,7 @@ sig_handler
|
|||
my_pipe_sig_handler(int sig __attribute__((unused)))
|
||||
{
|
||||
DBUG_PRINT("info",("Hit by signal %d",sig));
|
||||
#ifdef DONT_REMEMBER_SIGNAL
|
||||
#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY
|
||||
(void) signal(SIGPIPE, my_pipe_sig_handler);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -306,7 +306,7 @@ sig_handler process_alarm(int sig __attribute__((unused)))
|
|||
#if defined(MAIN) && !defined(__bsdi__)
|
||||
printf("thread_alarm in process_alarm\n"); fflush(stdout);
|
||||
#endif
|
||||
#ifdef DONT_REMEMBER_SIGNAL
|
||||
#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY
|
||||
my_sigset(thr_client_alarm, process_alarm); /* int. thread system calls */
|
||||
#endif
|
||||
return;
|
||||
|
@ -325,7 +325,7 @@ sig_handler process_alarm(int sig __attribute__((unused)))
|
|||
#endif
|
||||
process_alarm_part2(sig);
|
||||
#ifndef USE_ALARM_THREAD
|
||||
#if defined(DONT_REMEMBER_SIGNAL) && !defined(USE_ONE_SIGNAL_HAND)
|
||||
#if defined(SIGNAL_HANDLER_RESET_ON_DELIVERY) && !defined(USE_ONE_SIGNAL_HAND)
|
||||
my_sigset(THR_SERVER_ALARM,process_alarm);
|
||||
#endif
|
||||
pthread_mutex_unlock(&LOCK_alarm);
|
||||
|
@ -523,12 +523,12 @@ void thr_alarm_info(ALARM_INFO *info)
|
|||
*/
|
||||
|
||||
|
||||
static sig_handler thread_alarm(int sig)
|
||||
static sig_handler thread_alarm(int sig __attribute__((unused)))
|
||||
{
|
||||
#ifdef MAIN
|
||||
printf("thread_alarm\n"); fflush(stdout);
|
||||
#endif
|
||||
#ifdef DONT_REMEMBER_SIGNAL
|
||||
#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY
|
||||
my_sigset(sig,thread_alarm); /* int. thread system calls */
|
||||
#endif
|
||||
}
|
||||
|
@ -797,7 +797,7 @@ static sig_handler print_signal_warning(int sig)
|
|||
{
|
||||
printf("Warning: Got signal %d from thread %s\n",sig,my_thread_name());
|
||||
fflush(stdout);
|
||||
#ifdef DONT_REMEMBER_SIGNAL
|
||||
#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY
|
||||
my_sigset(sig,print_signal_warning); /* int. thread system calls */
|
||||
#endif
|
||||
if (sig == SIGALRM)
|
||||
|
|
|
@ -1232,7 +1232,7 @@ extern "C" sig_handler print_signal_warning(int sig)
|
|||
{
|
||||
if (global_system_variables.log_warnings)
|
||||
sql_print_warning("Got signal %d from thread %ld", sig,my_thread_id());
|
||||
#ifdef DONT_REMEMBER_SIGNAL
|
||||
#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY
|
||||
my_sigset(sig,print_signal_warning); /* int. thread system calls */
|
||||
#endif
|
||||
#if !defined(__WIN__) && !defined(__NETWARE__)
|
||||
|
|
Loading…
Add table
Reference in a new issue