#if__GLASGOW_HASKELL__>=701{-# LANGUAGE Trustworthy #-}#endifmoduleSystem.Posix.Process.Internals(pPrPr_disableITimers,c_execvpe,decipherWaitStatus,ProcessStatus(..))whereimportForeignimportForeign.CimportSystem.ExitimportSystem.IO.ErrorimportGHC.Conc(Signal)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(Terminatedtermsig)elsedoifc_WIFSTOPPEDwstat/=0thendoletstopsig=c_WSTOPSIGwstatreturn(Stoppedstopsig)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