summary refs log tree commit diff
path: root/bounce.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-10-27 03:11:49 -0400
committerJune McEnroe <june@causal.agency>2019-10-27 03:11:49 -0400
commitcc4f823bf4c27fa9efeeeef7cfe7e5fb62117163 (patch)
treedd724c2473d61197e61e6734e188bf88f6864c31 /bounce.c
parentImprove client/server error messages (diff)
downloadpounce-cc4f823bf4c27fa9efeeeef7cfe7e5fb62117163.tar.gz
pounce-cc4f823bf4c27fa9efeeeef7cfe7e5fb62117163.zip
Output ring info on SIGINFO
Diffstat (limited to '')
-rw-r--r--bounce.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/bounce.c b/bounce.c
index 1015625..dcf9eab 100644
--- a/bounce.c
+++ b/bounce.c
@@ -30,6 +30,10 @@
 
 #include "bounce.h"
 
+#ifndef SIGINFO
+#define SIGINFO SIGUSR2
+#endif
+
 static volatile sig_atomic_t signals[NSIG];
 static void signalHandler(int signal) {
 	signals[signal] = 1;
@@ -159,6 +163,7 @@ int main(int argc, char *argv[]) {
 
 	signal(SIGINT, signalHandler);
 	signal(SIGTERM, signalHandler);
+	signal(SIGINFO, signalHandler);
 	signal(SIGUSR1, signalHandler);
 
 	size_t clients = 0;
@@ -167,6 +172,10 @@ int main(int argc, char *argv[]) {
 		if (nfds < 0 && errno != EINTR) err(EX_IOERR, "poll");
 
 		if (signals[SIGINT] || signals[SIGTERM]) break;
+		if (signals[SIGINFO]) {
+			ringInfo();
+			signals[SIGINFO] = 0;
+		}
 		if (signals[SIGUSR1]) {
 			listenConfig(certPath, privPath);
 			signals[SIGUSR1] = 0;