Supervisor improvments by Allan Sandfeld Jensen: display child's normal exit code, send SIGABRT to an unresponsive child if -C was used.

git-svn-id: http://yate.null.ro/svn/yate/trunk@3379 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2010-06-16 08:35:42 +00:00
parent 4eb1b4bbfe
commit a5a06cb5ad
1 changed files with 6 additions and 0 deletions

View File

@ -779,6 +779,7 @@ static int supervise(void)
// Child exited for some reason
if (WIFEXITED(status)) {
retcode = WEXITSTATUS(status);
::fprintf(stderr,"Supervisor: child %d exited with code %d\n",s_childpid,retcode);
if (retcode <= 127)
s_runagain = false;
else
@ -819,8 +820,13 @@ static int supervise(void)
if (s_childpid > 0) {
// Child failed to proof sanity. Kill it - no need to be gentle.
::fprintf(stderr,"Supervisor: killing unresponsive child %d\n",s_childpid);
#ifdef RLIMIT_CORE
// If -Da or -C were specified try to get a corefile
if (s_sigabrt || s_coredump) {
#else
// If -Da was specified try to get a corefile
if (s_sigabrt) {
#endif
::kill(s_childpid,SIGABRT);
::usleep(500000);
}