Commit 25c05ad0 authored by Geoff Simmons's avatar Geoff Simmons

add a signal handler to tell VSL to flush pending transactions

parent 2c47df83
......@@ -99,7 +99,7 @@ static unsigned long seen = 0, submitted = 0, len_overflows = 0, no_data = 0,
static volatile sig_atomic_t flush = 0, term = 0;
static struct sigaction terminate_action, dump_action;
static struct sigaction terminate_action, dump_action, flush_action;
/* Local freelist */
static struct freehead_s reader_freelist =
......@@ -140,6 +140,14 @@ term_s(int sig)
flush = 1;
}
static void
sigflush(int sig)
{
flush = 1;
LOG_Log(LOG_NOTICE, "Received signal %d (%s), "
"flushing pending transactions", sig, strsignal(sig));
}
/*--------------------------------------------------------------------*/
/* efficiently retrieve a single data entry */
......@@ -487,6 +495,10 @@ CHILD_Main(int readconfig)
AZ(sigemptyset(&terminate_action.sa_mask));
terminate_action.sa_flags &= ~SA_RESTART;
flush_action.sa_handler = sigflush;
AZ(sigemptyset(&flush_action.sa_mask));
flush_action.sa_flags |= SA_RESTART;
#define CHILD(SIG,disp) SIGDISP(SIG,disp)
#define PARENT(SIG,disp) ((void) 0)
#include "signals.h"
......
......@@ -44,7 +44,7 @@ CHILD(SIGTERM, terminate_action);
CHILD(SIGINT, terminate_action);
CHILD(SIGUSR1, dump_action);
CHILD(SIGUSR2, ignore_action);
CHILD(SIGHUP, ignore_action);
CHILD(SIGHUP, flush_action);
#ifndef DISABLE_STACKTRACE
CHILD(SIGABRT, stacktrace_action);
CHILD(SIGSEGV, stacktrace_action);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment