-void CatchUSR1(int)
-{
-
-}
-//-----------------------------------------------------------------------------
-void CatchTERM(int sig)
-{
-/*
- *Function Name:CatchINT
- *Parameters: sig_num - ÎÏÍÅÒ ÓÉÇÎÁÌÁ
- *Description: ïÂÒÁÂÏÔÞÉË ÓÉÇÎÁÌÁ INT
- *Returns: îÉÞÅÇÏ
- */
-STG_LOGGER & WriteServLog = GetStgLogger();
-WriteServLog("Shutting down... %d", sig);
-
-//nonstop = false;
-nonstop.Stop(__FILE__, __LINE__);
-
-struct sigaction newsa, oldsa;
-sigset_t sigmask;
-
-sigemptyset(&sigmask);
-sigaddset(&sigmask, SIGTERM);
-newsa.sa_handler = SIG_IGN;
-newsa.sa_mask = sigmask;
-newsa.sa_flags = 0;
-sigaction(SIGTERM, &newsa, &oldsa);
-
-sigemptyset(&sigmask);
-sigaddset(&sigmask, SIGINT);
-newsa.sa_handler = SIG_IGN;
-newsa.sa_mask = sigmask;
-newsa.sa_flags = 0;
-sigaction(SIGINT, &newsa, &oldsa);
-}
-//-----------------------------------------------------------------------------
-void CatchPIPE(int)
-{
-STG_LOGGER & WriteServLog = GetStgLogger();
-WriteServLog("Broken pipe!");
-}
-//-----------------------------------------------------------------------------
-void CatchHUP(int)
-{
-needRulesReloading = true;
-}
-//-----------------------------------------------------------------------------
-void CatchCHLD(int)
-{
-int status;
-pid_t childPid;
-childPid = waitpid(-1, &status, WNOHANG);
-
-set<pid_t>::iterator pid;
-pid = executersPid.find(childPid);
-if (pid != executersPid.end())
- {
- executersPid.erase(pid);
- if (executersPid.empty() && nonstop.GetStatus())
- {
- nonstop.Stop(__FILE__, __LINE__);
- }
- }
-if (childPid == stgChildPid)
- {
- childExited = true;
- }
-}
-/*//-----------------------------------------------------------------------------
-void CatchSEGV(int, siginfo_t *, void *)
-{
-char fileName[50];
-sprintf(fileName, "/tmp/stg_segv.%d", getpid());
-FILE * f = fopen(fileName, "wt");
-if (f)
- {
- fprintf(f, "\nSignal info:\n~~~~~~~~~~~~\n");
- fprintf(f, "numb:\t %d (%d)\n", sinfo->si_signo, sig);
- fprintf(f, "errn:\t %d\n", sinfo->si_errno);
- fprintf(f, "code:\t %d ", sinfo->si_code);
-
- switch (sinfo->si_code)
- {
- case SEGV_MAPERR:
- fprintf(f, "(SEGV_MAPERR - address not mapped to object)\n");
- break;
-
- case SEGV_ACCERR:
- fprintf(f, "(SEGV_ACCERR - invalid permissions for mapped object)\n");
- break;
-
- default:
- fprintf(f, "???\n");
- }
-
- fprintf(f, "addr:\t 0x%.8X\n",
- (unsigned int)sinfo->si_addr);
-
- Dl_info dlinfo;
- //asm("movl %eip, eip");
- if (dladdr((void*)CatchCHLD, &dlinfo))
- {
- fprintf(f, "SEGV point: %s %s\n", dlinfo.dli_fname, dlinfo.dli_sname);
- }
- else
- {
- fprintf(f, "Cannot find SEGV point\n");
- }
-
- fclose(f);
- }
-
-struct sigaction segv_action, segv_action_old;
-
-segv_action.sa_handler = SIG_DFL;
-segv_action.sa_sigaction = NULL;
-segv_action.sa_flags = SA_SIGINFO;
-segv_action.sa_restorer = NULL;
-
-sigaction(SIGSEGV, &segv_action, &segv_action_old);
-}*/
-//-----------------------------------------------------------------------------
-static void SetSignalHandlers()
-{
-struct sigaction newsa, oldsa;
-sigset_t sigmask;
-///////
-sigemptyset(&sigmask);
-sigaddset(&sigmask, SIGTERM);
-newsa.sa_handler = CatchTERM;
-newsa.sa_mask = sigmask;
-newsa.sa_flags = 0;
-sigaction(SIGTERM, &newsa, &oldsa);
-///////
-sigemptyset(&sigmask);
-sigaddset(&sigmask, SIGUSR1);
-newsa.sa_handler = CatchUSR1;
-newsa.sa_mask = sigmask;
-newsa.sa_flags = 0;
-sigaction(SIGUSR1, &newsa, &oldsa);
-///////
-sigemptyset(&sigmask);
-sigaddset(&sigmask, SIGINT);
-newsa.sa_handler = CatchTERM;
-newsa.sa_mask = sigmask;
-newsa.sa_flags = 0;
-sigaction(SIGINT, &newsa, &oldsa);
-//////
-sigemptyset(&sigmask);
-sigaddset(&sigmask, SIGPIPE);
-newsa.sa_handler = CatchPIPE;
-newsa.sa_mask = sigmask;
-newsa.sa_flags = 0;
-sigaction(SIGPIPE, &newsa, &oldsa);
-//////
-sigemptyset(&sigmask);
-sigaddset(&sigmask, SIGHUP);
-newsa.sa_handler = CatchHUP;
-newsa.sa_mask = sigmask;
-newsa.sa_flags = 0;
-sigaction(SIGHUP, &newsa, &oldsa);
-//////
-sigemptyset(&sigmask);
-sigaddset(&sigmask, SIGCHLD);
-newsa.sa_handler = CatchCHLD;
-newsa.sa_mask = sigmask;
-newsa.sa_flags = 0;
-sigaction(SIGCHLD, &newsa, &oldsa);
-
-/*newsa.sa_handler = NULL;
-newsa.sa_sigaction = CatchSEGV;
-newsa.sa_flags = SA_SIGINFO;
-newsa.sa_restorer = NULL;
-sigaction(SIGSEGV, &newsa, &oldsa);*/
-
-return;
-}
-//-----------------------------------------------------------------------------
-int StartScriptExecuter(char * procName, int msgKey, int * msgID, SETTINGS * settings)