diff --git a/include/proto/mworker.h b/include/proto/mworker.h index 0418782666..595cc19506 100644 --- a/include/proto/mworker.h +++ b/include/proto/mworker.h @@ -22,6 +22,7 @@ void mworker_env_to_proc_list(); void mworker_block_signals(); void mworker_unblock_signals(); +void mworker_broadcast_signal(struct sig_handler *sh); void mworker_catch_sighup(struct sig_handler *sh); void mworker_catch_sigterm(struct sig_handler *sh); void mworker_catch_sigchld(struct sig_handler *sh); diff --git a/src/haproxy.c b/src/haproxy.c index 4e4a7deb71..a7f6a247dd 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -847,12 +847,16 @@ static void mworker_loop() master = 1; + signal_unregister(SIGTTIN); + signal_unregister(SIGTTOU); signal_unregister(SIGUSR1); signal_unregister(SIGHUP); signal_unregister(SIGQUIT); signal_register_fct(SIGTERM, mworker_catch_sigterm, SIGTERM); signal_register_fct(SIGUSR1, mworker_catch_sigterm, SIGUSR1); + signal_register_fct(SIGTTIN, mworker_broadcast_signal, SIGTTIN); + signal_register_fct(SIGTTOU, mworker_broadcast_signal, SIGTTOU); signal_register_fct(SIGINT, mworker_catch_sigterm, SIGINT); signal_register_fct(SIGHUP, mworker_catch_sighup, SIGHUP); signal_register_fct(SIGUSR2, mworker_catch_sighup, SIGUSR2); diff --git a/src/mworker.c b/src/mworker.c index 511d9617dc..ff3e16b8fb 100644 --- a/src/mworker.c +++ b/src/mworker.c @@ -204,6 +204,8 @@ void mworker_block_signals() sigemptyset(&set); sigaddset(&set, SIGUSR1); sigaddset(&set, SIGUSR2); + sigaddset(&set, SIGTTIN); + sigaddset(&set, SIGTTOU); sigaddset(&set, SIGHUP); sigaddset(&set, SIGCHLD); ha_sigmask(SIG_SETMASK, &set, NULL); @@ -216,6 +218,12 @@ void mworker_unblock_signals() /* ----- mworker signal handlers ----- */ +/* broadcast the configured signal to the workers */ +void mworker_broadcast_signal(struct sig_handler *sh) +{ + mworker_kill(sh->arg); +} + /* * When called, this function reexec haproxy with -sf followed by current * children PIDs and possibly old children PIDs if they didn't leave yet.