diff options
Diffstat (limited to 'System')
-rw-r--r-- | System/Posix/Process/Internals.hs | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/System/Posix/Process/Internals.hs b/System/Posix/Process/Internals.hs index 0ff88d8..b5017c5 100644 --- a/System/Posix/Process/Internals.hs +++ b/System/Posix/Process/Internals.hs @@ -12,10 +12,15 @@ import System.Exit import System.IO.Error import GHC.Conc (Signal) -data ProcessStatus = Exited ExitCode - | Terminated Signal - | Stopped Signal - deriving (Eq, Ord, Show) +-- | The exit status of a process +data ProcessStatus + = Exited ExitCode -- ^ the process exited by calling + -- @exit()@ or returning from @main@ + | Terminated Signal Bool -- ^ the process was terminated by a + -- signal, the @Bool@ is @True@ if a core + -- dump was produced + | Stopped Signal -- ^ the process was stopped by a signal + deriving (Eq, Ord, Show) -- this function disables the itimer, which would otherwise cause confusing -- signals to be sent to the new process. @@ -36,8 +41,9 @@ decipherWaitStatus wstat = else do if c_WIFSIGNALED wstat /= 0 then do - let termsig = c_WTERMSIG wstat - return (Terminated termsig) + let termsig = c_WTERMSIG wstat + let coredumped = c_WCOREDUMP wstat /= 0 + return (Terminated termsig coredumped) else do if c_WIFSTOPPED wstat /= 0 then do @@ -65,3 +71,6 @@ foreign import ccall unsafe "__hsunix_wifstopped" foreign import ccall unsafe "__hsunix_wstopsig" c_WSTOPSIG :: CInt -> CInt +foreign import ccall unsafe "__hsunix_wcoredump" + c_WCOREDUMP :: CInt -> CInt + |