moduleSystem.Posix.Process.Internals(pPrPr_disableITimers,c_execvpe,decipherWaitStatus,ProcessStatus(..))whereimportForeignimportForeign.CimportSystem.ExitimportSystem.IO.ErrorimportGHC.Conc(Signal)-- we had to move this into GHC.Conc in GHC to avoid recursive dependencies.-- it can be moved back when the signal handling stuff in base is moved out.dataProcessStatus=ExitedExitCode|TerminatedSignal|StoppedSignalderiving(Eq,Ord,Show)-- this function disables the itimer, which would otherwise cause confusing-- signals to be sent to the new process.foreignimportccallunsafe"pPrPr_disableITimers"pPrPr_disableITimers::IO()foreignimportccallunsafe"execvpe"c_execvpe::CString->PtrCString->PtrCString->IOCIntdecipherWaitStatus::CInt->IOProcessStatusdecipherWaitStatuswstat=ifc_WIFEXITEDwstat/=0thendoletexitstatus=c_WEXITSTATUSwstatifexitstatus==0thenreturn(ExitedExitSuccess)elsereturn(Exited(ExitFailure(fromIntegralexitstatus)))elsedoifc_WIFSIGNALEDwstat/=0thendolettermsig=c_WTERMSIGwstatreturn(Terminated(fromIntegraltermsig))elsedoifc_WIFSTOPPEDwstat/=0thendoletstopsig=c_WSTOPSIGwstatreturn(Stopped(fromIntegralstopsig))elsedoioError(mkIOErrorillegalOperationErrorType"waitStatus"NothingNothing)foreignimportccallunsafe"__hsunix_wifexited"c_WIFEXITED::CInt->CIntforeignimportccallunsafe"__hsunix_wexitstatus"c_WEXITSTATUS::CInt->CIntforeignimportccallunsafe"__hsunix_wifsignaled"c_WIFSIGNALED::CInt->CIntforeignimportccallunsafe"__hsunix_wtermsig"c_WTERMSIG::CInt->CIntforeignimportccallunsafe"__hsunix_wifstopped"c_WIFSTOPPED::CInt->CIntforeignimportccallunsafe"__hsunix_wstopsig"c_WSTOPSIG::CInt->CInt