diff --git a/include/common/hathreads.h b/include/common/hathreads.h index c25f69102..5c4ceca7c 100644 --- a/include/common/hathreads.h +++ b/include/common/hathreads.h @@ -108,6 +108,9 @@ extern THREAD_LOCAL unsigned long tid_bit; /* The bit corresponding to the threa #define HA_RWLOCK_TRYRDLOCK(lbl, l) ({ 0; }) #define HA_RWLOCK_RDUNLOCK(lbl, l) do { /* do nothing */ } while(0) +#define ha_sigmask(how, set, oldset) sigprocmask(how, set, oldset) + + static inline void __ha_barrier_load(void) { } @@ -259,6 +262,9 @@ int thread_need_sync(void); extern unsigned long all_threads_mask; +#define ha_sigmask(how, set, oldset) pthread_sigmask(how, set, oldset) + + #if defined(DEBUG_THREAD) || defined(DEBUG_FULL) /* WARNING!!! if you update this enum, please also keep lock_label() up to date below */ diff --git a/src/checks.c b/src/checks.c index 3f4c0e1b3..3cae94d51 100644 --- a/src/checks.c +++ b/src/checks.c @@ -1618,7 +1618,7 @@ void block_sigchld(void) sigset_t set; sigemptyset(&set); sigaddset(&set, SIGCHLD); - assert(sigprocmask(SIG_BLOCK, &set, NULL) == 0); + assert(ha_sigmask(SIG_BLOCK, &set, NULL) == 0); } void unblock_sigchld(void) @@ -1626,7 +1626,7 @@ void unblock_sigchld(void) sigset_t set; sigemptyset(&set); sigaddset(&set, SIGCHLD); - assert(sigprocmask(SIG_UNBLOCK, &set, NULL) == 0); + assert(ha_sigmask(SIG_UNBLOCK, &set, NULL) == 0); } static struct pid_list *pid_list_add(pid_t pid, struct task *t) diff --git a/src/haproxy.c b/src/haproxy.c index 96b8abcf9..1c0455c56 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -508,7 +508,7 @@ static void mworker_block_signals() sigaddset(&set, SIGHUP); sigaddset(&set, SIGINT); sigaddset(&set, SIGTERM); - sigprocmask(SIG_SETMASK, &set, NULL); + ha_sigmask(SIG_SETMASK, &set, NULL); } static void mworker_unblock_signals() @@ -521,7 +521,7 @@ static void mworker_unblock_signals() sigaddset(&set, SIGHUP); sigaddset(&set, SIGINT); sigaddset(&set, SIGTERM); - sigprocmask(SIG_UNBLOCK, &set, NULL); + ha_sigmask(SIG_UNBLOCK, &set, NULL); } static void mworker_unregister_signals() diff --git a/src/signal.c b/src/signal.c index 0dadd762c..4bee7d70e 100644 --- a/src/signal.c +++ b/src/signal.c @@ -13,6 +13,8 @@ #include #include +#include + #include #include #include @@ -71,7 +73,7 @@ void __signal_process_queue() sigset_t old_sig; /* block signal delivery during processing */ - sigprocmask(SIG_SETMASK, &blocked_sig, &old_sig); + ha_sigmask(SIG_SETMASK, &blocked_sig, &old_sig); /* It is important that we scan the queue forwards so that we can * catch any signal that would have been queued by another signal @@ -95,7 +97,7 @@ void __signal_process_queue() signal_queue_len = 0; /* restore signal delivery */ - sigprocmask(SIG_SETMASK, &old_sig, NULL); + ha_sigmask(SIG_SETMASK, &old_sig, NULL); } /* perform minimal intializations, report 0 in case of error, 1 if OK. */ @@ -116,7 +118,7 @@ int signal_init() * parsing We don't want the process to be killed by an unregistered * USR2 signal when the master-worker is reloading */ sigaddset(&blocked_sig, SIGUSR2); - sigprocmask(SIG_SETMASK, &blocked_sig, NULL); + ha_sigmask(SIG_SETMASK, &blocked_sig, NULL); sigfillset(&blocked_sig); sigdelset(&blocked_sig, SIGPROF);