summaryrefslogtreecommitdiffstats
path: root/logforwarder/src/apps/vespa-logforwarder-start/sig-catch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'logforwarder/src/apps/vespa-logforwarder-start/sig-catch.cpp')
-rw-r--r--logforwarder/src/apps/vespa-logforwarder-start/sig-catch.cpp41
1 files changed, 0 insertions, 41 deletions
diff --git a/logforwarder/src/apps/vespa-logforwarder-start/sig-catch.cpp b/logforwarder/src/apps/vespa-logforwarder-start/sig-catch.cpp
deleted file mode 100644
index b10275d515e..00000000000
--- a/logforwarder/src/apps/vespa-logforwarder-start/sig-catch.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#include "sig-catch.h"
-#include <csignal>
-#include <unistd.h>
-#include <string.h>
-
-static int sigPermanent(int sig, void(*handler)(int));
-static void setStopFlag(int sig);
-sig_atomic_t stop = 0;
-
-SigCatch::SigCatch()
-{
- sigPermanent(SIGPIPE, SIG_IGN);
- sigPermanent(SIGTERM, setStopFlag);
- sigPermanent(SIGINT, setStopFlag);
-}
-
-bool
-SigCatch::receivedStopSignal() {
- return stop != 0;
-}
-
-static void
-setStopFlag(int sig)
-{
- (void)sig;
- stop = 1;
-}
-
-static int
-sigPermanent(int sig, void(*handler)(int))
-{
- struct sigaction sa;
-
- memset(&sa, 0, sizeof(sa));
- sigemptyset(&sa.sa_mask);
- sa.sa_flags = 0; // no SA_RESTART!
- sa.sa_handler = handler;
- return sigaction(sig, &sa, nullptr);
-}