-void InspIRCd::SetSignals()
-{
-#ifndef _WIN32
- signal(SIGALRM, SIG_IGN);
- signal(SIGCHLD, SIG_IGN);
- signal(SIGHUP, InspIRCd::SetSignal);
- signal(SIGPIPE, SIG_IGN);
- signal(SIGUSR1, SIG_IGN);
- signal(SIGUSR2, SIG_IGN);
- signal(SIGXFSZ, SIG_IGN);
-#endif
- signal(SIGTERM, InspIRCd::SetSignal);
-}
-
-bool InspIRCd::DaemonSeed()
-{
-#ifdef _WIN32
- std::cout << "InspIRCd Process ID: " << con_green << GetCurrentProcessId() << con_reset << std::endl;
- return true;
-#else
- // Do not use exit() here: It will exit with status SIGTERM which would break e.g. daemon scripts
- signal(SIGTERM, VoidSignalHandler);
-
- int childpid = fork();
- if (childpid < 0)
- return false;
- else if (childpid > 0)
- {
- /* We wait here for the child process to kill us,
- * so that the shell prompt doesnt come back over
- * the output.
- * Sending a kill with a signal of 0 just checks
- * if the child pid is still around. If theyre not,
- * they threw an error and we should give up.
- */
- while (kill(childpid, 0) != -1)
- sleep(1);
- exit(EXIT_STATUS_NOERROR);
- }
- setsid ();
- std::cout << "InspIRCd Process ID: " << con_green << getpid() << con_reset << std::endl;
-
- signal(SIGTERM, InspIRCd::SetSignal);
- IncreaseCoreDumpSize();
- return true;
-#endif
-}
-