diff --git a/lib/base/application.cpp b/lib/base/application.cpp index 880af34a2..3e1408542 100644 --- a/lib/base/application.cpp +++ b/lib/base/application.cpp @@ -680,29 +680,6 @@ void Application::AttachDebugger(const String& filename, bool interactive) #endif /* _WIN32 */ } -#ifndef _WIN32 -/** - * Signal handler for SIGINT and SIGTERM. Prepares the application for cleanly - * shutting down during the next execution of the event loop. - * - * @param - The signal number. - */ -void Application::SigIntTermHandler(int signum) -{ - struct sigaction sa; - memset(&sa, 0, sizeof(sa)); - sa.sa_handler = SIG_DFL; - sigaction(signum, &sa, nullptr); - - Application::Ptr instance = Application::GetInstance(); - - if (!instance) - return; - - instance->RequestShutdown(); -} -#endif /* _WIN32 */ - /** * Signal handler for SIGUSR1. This signal causes Icinga to re-open * its log files and is mainly for use by logrotate. @@ -717,42 +694,6 @@ void Application::SigUsr1Handler(int) RequestReopenLogs(); } -/** - * Signal handler for SIGUSR2. Hands over PID to child and commits suicide - * - * @param - The signal number. - */ -void Application::SigUsr2Handler(int) -{ - Log(LogInformation, "Application", "Reload requested, letting new process take over."); -#ifdef HAVE_SYSTEMD - sd_notifyf(0, "MAINPID=%lu", (unsigned long) m_ReloadProcess); -#endif /* HAVE_SYSTEMD */ - - /* Write the PID of the new process to the pidfile before this - * process exits to keep systemd happy. - */ - Application::Ptr instance = GetInstance(); - try { - instance->UpdatePidFile(Configuration::PidPath, m_ReloadProcess); - } catch (const std::exception&) { - /* abort restart */ - Log(LogCritical, "Application", "Cannot update PID file. Aborting restart operation."); - return; - } - - instance->ClosePidFile(false); - - /* Ensure to dump the program state on reload. */ - ConfigObject::StopObjects(); - instance->OnShutdown(); - - Log(LogInformation, "Application") - << "Reload done, parent process shutting down. Child process with PID '" << m_ReloadProcess << "' is taking over."; - - Exit(0); -} - /** * Signal handler for SIGABRT. Helps with debugging ASSERT()s. * @@ -999,15 +940,8 @@ int Application::Run() #ifndef _WIN32 struct sigaction sa; memset(&sa, 0, sizeof(sa)); - sa.sa_handler = &Application::SigIntTermHandler; - sigaction(SIGINT, &sa, nullptr); - sigaction(SIGTERM, &sa, nullptr); - sa.sa_handler = &Application::SigUsr1Handler; sigaction(SIGUSR1, &sa, nullptr); - - sa.sa_handler = &Application::SigUsr2Handler; - sigaction(SIGUSR2, &sa, nullptr); #else /* _WIN32 */ SetConsoleCtrlHandler(&Application::CtrlHandler, TRUE); #endif /* _WIN32 */ diff --git a/lib/base/application.hpp b/lib/base/application.hpp index 92f627e75..ad7fd9606 100644 --- a/lib/base/application.hpp +++ b/lib/base/application.hpp @@ -132,9 +132,7 @@ private: static bool m_ScriptDebuggerEnabled; static double m_LastReloadFailed; -#ifndef _WIN32 - static void SigIntTermHandler(int signum); -#else /* _WIN32 */ +#ifdef _WIN32 static BOOL WINAPI CtrlHandler(DWORD type); static LONG WINAPI SEHUnhandledExceptionFilter(PEXCEPTION_POINTERS exi); #endif /* _WIN32 */ @@ -143,7 +141,6 @@ private: static void SigAbrtHandler(int signum); static void SigUsr1Handler(int signum); - static void SigUsr2Handler(int signum); static void ExceptionHandler(); static String GetCrashReportFilename(); diff --git a/lib/cli/daemoncommand.cpp b/lib/cli/daemoncommand.cpp index 9fbe486ba..38938bf19 100644 --- a/lib/cli/daemoncommand.cpp +++ b/lib/cli/daemoncommand.cpp @@ -27,13 +27,6 @@ static po::variables_map g_AppParams; REGISTER_CLICOMMAND("daemon", DaemonCommand); -#ifndef _WIN32 -static void SigHupHandler(int) -{ - Application::RequestRestart(); -} -#endif /* _WIN32 */ - /* * Daemonize(). On error, this function logs by itself and exits (i.e. does not return). * @@ -299,13 +292,6 @@ int DaemonCommand::Run(const po::variables_map& vm, const std::vectorRun();