Home || Visual Search || Applications || Architecture || Important Messages || OGL || Src

void Impala::Process::Manager4Posix::SetExitCode ( int  pid,
int  status,
int  ret 
) [inline, private]

Definition at line 280 of file Manager4Posix.h.

References ILOG_DEBUG, ILOG_ERROR, mProcesses, Impala::Process::Manager::STATE_TERM_ABNORMAL, Impala::Process::Manager::STATE_TERM_ERROR, and Impala::Process::Manager::STATE_TERM_SUCCESS.

Referenced by IsRunning().

00281     {
00282         //If ret==pid, process finished
00283         if(ret==pid)
00284         {
00285             if(WIFEXITED(status))//Process exited normally
00286             {   
00287                 ILOG_DEBUG("Process exited normally!");
00288                 
00289                 //Collect the exit and termcodes
00290                 mProcesses[pid].exitCode = WEXITSTATUS(status);
00291 
00292                 if(WEXITSTATUS(status)==0)
00293                     mProcesses[pid].stateCode = STATE_TERM_SUCCESS;
00294                 else
00295                     mProcesses[pid].stateCode = STATE_TERM_ERROR;
00296             }
00297             else if(WIFSIGNALED(status)) //Process has been signalled
00298             {   
00299                 ILOG_ERROR("Process received a signal!");
00300                 //Add the signal number as exit code.
00301                 mProcesses[pid].stateCode = STATE_TERM_ABNORMAL;
00302                 mProcesses[pid].exitCode = WTERMSIG(status);
00303             }
00304         }else{//ret==-1 ERROR
00305             //This will happen when the process exited already, and this is
00306             //reported by a previous call to waitpid.
00307             //Since SetExitCode should set the stateCode to something other than
00308             //STATE_RUNNING, we should only fall here if there was some
00309             //other error, please see man 2 waitpid
00310             //
00311             char buff[256];
00312             if( strerror_r( errno, buff, 256 ) == 0 ) {
00313                 ILOG_ERROR("waitpid failed:"<<buff);
00314             }
00315         }
00316     }


Generated on Thu Jan 13 09:23:59 2011 for ImpalaSrc by  doxygen 1.5.1