From 799e2d46923728ac670d7110f764868b82333a0b Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 20 May 2014 04:32:00 +0200 Subject: Modify mds-server to use mds-base (some regression...) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/mds-server/signals.c | 65 ++++++++++-------------------------------------- 1 file changed, 13 insertions(+), 52 deletions(-) (limited to 'src/mds-server/signals.c') diff --git a/src/mds-server/signals.c b/src/mds-server/signals.c index b16b28a..325fa35 100644 --- a/src/mds-server/signals.c +++ b/src/mds-server/signals.c @@ -15,20 +15,16 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#include "signals.h" #include "globals.h" #include "client.h" #include #include -#include #include -#include -#include #include -#include +#include /** @@ -58,12 +54,14 @@ static void signal_all(int signo) /** - * Called with the signal SIGUSR1 is caught. - * This function should cue a re-exec of the program. + * This function is called when a signal that + * signals the server to re-exec has been received * - * @param signo The caught signal + * When this function is invoked, it should set `reexecing` to a non-zero value + * + * @param signo The signal that has been received */ -static void sigusr1_trap(int signo) +void received_reexec(int signo) { if (reexecing == 0) { @@ -75,57 +73,20 @@ static void sigusr1_trap(int signo) /** - * Called with the signal SIGTERM is caught. - * This function should cue a termination of the program. + * This function is called when a signal that + * signals the server to re-exec has been received * - * @param signo The caught signal - */ -static void sigterm_trap(int signo) -{ - if (terminating == 0) - { - terminating = 1; - eprint("terminate signal received."); - signal_all(signo); - } -} - - -/** - * Called with the signal SIGINT is caught. - * This function should cue a termination of the program. + * When this function is invoked, it should set `terminating` to a non-zero value * - * @param signo The caught signal + * @param signo The signal that has been received */ -static void sigint_trap(int signo) +void received_terminate(int signo) { if (terminating == 0) { terminating = 1; - eprint("terminal interrupt signal received."); + eprint("terminate signal received."); signal_all(signo); } } - -/** - * Set up signal traps for all especially handled signals - * - * @return Zero on success, -1 on error - */ -int trap_signals(void) -{ - /* Make the server update without all slaves dying on SIGUSR1. */ - fail_if (xsigaction(SIGUSR1, sigusr1_trap) < 0); - - /* Implement clean exit on SIGTERM. */ - fail_if (xsigaction(SIGTERM, sigterm_trap) < 0); - - /* Implement clean exit on SIGINT. */ - fail_if (xsigaction(SIGINT, sigint_trap) < 0); - - return 0; - pfail: - return -1; -} - -- cgit v1.2.3-70-g09d2