MCPcopy Create free account
hub / github.com/Icinga/icinga2 / Run

Method Run

lib/base/application.cpp:997–1022  ·  view source on GitHub ↗

* Runs the application. * * @returns The application's exit code. */

Source from the content-addressed store, hash-verified

995 * @returns The application's exit code.
996 */
997int Application::Run()
998{
999#ifndef _WIN32
1000 struct sigaction sa;
1001 memset(&sa, 0, sizeof(sa));
1002 sa.sa_handler = &Application::SigUsr1Handler;
1003 sa.sa_flags = SA_RESTART;
1004 sigaction(SIGUSR1, &sa, nullptr);
1005#else /* _WIN32 */
1006 SetConsoleCtrlHandler(&Application::CtrlHandler, TRUE);
1007#endif /* _WIN32 */
1008
1009#ifdef _WIN32
1010 try {
1011 UpdatePidFile(Configuration::PidPath);
1012 } catch (const std::exception&) {
1013 Log(LogCritical, "Application")
1014 << "Cannot update PID file '" << Configuration::PidPath << "'. Aborting.";
1015 return EXIT_FAILURE;
1016 }
1017#endif /* _WIN32 */
1018
1019 SetStartTime(Utility::GetTime());
1020
1021 return Main();
1022}
1023
1024void Application::UpdatePidFile(const String& filename)
1025{

Callers 1

StartReloadProcessMethod · 0.45

Calls 2

LogClass · 0.85
sigactionClass · 0.70

Tested by

no test coverage detected