aboutsummaryrefslogtreecommitdiff
path: root/signal.c
diff options
context:
space:
mode:
authornicm <nicm>2017-06-04 08:25:57 +0000
committernicm <nicm>2017-06-04 08:25:57 +0000
commitadf5628087829bed2eff635760d7cc456dd1e558 (patch)
treeceb0745ca673fb84658b4ba573ff6b3a04926b5f /signal.c
parent184039044a92b83f38b880b0a4a1c5ebc272af9c (diff)
downloadrtmux-adf5628087829bed2eff635760d7cc456dd1e558.tar.gz
rtmux-adf5628087829bed2eff635760d7cc456dd1e558.tar.bz2
rtmux-adf5628087829bed2eff635760d7cc456dd1e558.zip
Support SIGUSR2 to stop and start logging for an existing server. Also
we currently only have two log levels so just use -v and -vv rather than -v and -vvvv, and clarify the man page entry for -v.
Diffstat (limited to 'signal.c')
-rw-r--r--signal.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/signal.c b/signal.c
index 79d23af0..49360514 100644
--- a/signal.c
+++ b/signal.c
@@ -29,6 +29,7 @@ static struct event ev_sigchld;
static struct event ev_sigcont;
static struct event ev_sigterm;
static struct event ev_sigusr1;
+static struct event ev_sigusr2;
static struct event ev_sigwinch;
void
@@ -59,6 +60,8 @@ set_signals(void (*handler)(int, short, void *), void *arg)
signal_add(&ev_sigterm, NULL);
signal_set(&ev_sigusr1, SIGUSR1, handler, arg);
signal_add(&ev_sigusr1, NULL);
+ signal_set(&ev_sigusr2, SIGUSR2, handler, arg);
+ signal_add(&ev_sigusr2, NULL);
signal_set(&ev_sigwinch, SIGWINCH, handler, arg);
signal_add(&ev_sigwinch, NULL);
}
@@ -92,6 +95,8 @@ clear_signals(int after_fork)
fatal("sigaction failed");
if (sigaction(SIGUSR1, &sigact, NULL) != 0)
fatal("sigaction failed");
+ if (sigaction(SIGUSR2, &sigact, NULL) != 0)
+ fatal("sigaction failed");
if (sigaction(SIGWINCH, &sigact, NULL) != 0)
fatal("sigaction failed");
} else {
@@ -100,6 +105,7 @@ clear_signals(int after_fork)
event_del(&ev_sigcont);
event_del(&ev_sigterm);
event_del(&ev_sigusr1);
+ event_del(&ev_sigusr2);
event_del(&ev_sigwinch);
}
}