diff --git a/engine/Engine.cpp b/engine/Engine.cpp index c30d51bf..b055a685 100644 --- a/engine/Engine.cpp +++ b/engine/Engine.cpp @@ -44,7 +44,7 @@ __declspec(dllimport) BOOL WINAPI SHGetSpecialFolderPathA(HWND,LPSTR,INT,BOOL); #endif -#else +#else // _WINDOWS #include "yatepaths.h" #include @@ -57,7 +57,9 @@ typedef void* HMODULE; #define CFG_DIR ".yate" #endif -#endif +static int s_childsig = 0; + +#endif // _WINDOWS #include #include @@ -332,6 +334,9 @@ bool EngineStatusHandler::received(Message &msg) msg.retValue() << ",messages=" << Engine::self()->messageCount(); msg.retValue() << ",supervised=" << (s_super_handle >= 0); msg.retValue() << ",runattempt=" << s_run_attempt; +#ifndef _WINDOWS + msg.retValue() << ",lastsignal=" << s_childsig; +#endif msg.retValue() << ",threads=" << Thread::count(); msg.retValue() << ",workers=" << EnginePrivate::count; msg.retValue() << ",mutexes=" << Mutex::count(); @@ -819,10 +824,12 @@ static int supervise(void) s_runagain = false; else retcode &= 127; + s_childsig = 0; } else if (WIFSIGNALED(status)) { retcode = WTERMSIG(status); ::fprintf(stderr,"Supervisor: child %d died on signal %d\n",s_childpid,retcode); + s_childsig = retcode; } s_childpid = -1; break; @@ -875,6 +882,7 @@ static int supervise(void) break; } s_childpid = -1; + s_childsig = SIGCHLD; } if (s_logrotator) { copystream(2,logfd[0]); @@ -1080,6 +1088,9 @@ int Engine::run() s_params.addParam("clientmode",String::boolText(clientMode())); s_params.addParam("supervised",String::boolText(s_super_handle >= 0)); s_params.addParam("runattempt",String(s_run_attempt)); +#ifndef _WINDOWS + s_params.addParam("lastsignal",String(s_childsig)); +#endif s_params.addParam("maxworkers",String(s_maxworkers)); #ifdef _WINDOWS {