forkProcess :: IO (Maybe ProcessID)
forkProcess = do
pid <-_ccall_ fork
- case pid of
+ case (pid::Int) of
-1 -> syserr "forkProcess"
0 -> return Nothing
_ -> return (Just pid)
wstat <- allocWords 1
pid <-_casm_ ``%r = waitpid(%0, (int *)%1, %2);'' pid wstat
(waitOptions block stopped)
- case pid of
+ case (pid::Int) of
-1 -> syserr "getProcessStatus"
0 -> return Nothing
_ -> do ps <- decipherWaitStatus wstat
wstat <- allocWords 1
pid <-_casm_ ``%r = waitpid(%0, (int *)%1, %2);'' (-pgid) wstat
(waitOptions block stopped)
- case pid of
+ case (pid::Int) of
-1 -> syserr "getGroupProcessStatus"
0 -> return Nothing
_ -> do ps <- decipherWaitStatus wstat
str <- packStringIO name
str <- _ccall_ getenv str
if str == nullAddr
- then fail (IOError Nothing NoSuchThing
- "getEnvVar" "no such environment variable")
+ then ioError (IOError Nothing NoSuchThing "getEnvVar" "no such environment variable")
else strcpy str
setEnvVar :: String -> String -> IO ()
setStoppedChildFlag :: Bool -> IO Bool
setStoppedChildFlag b = do
- rc <- _casm_ ``%r = nocldstop; nocldstop = %0;'' x
- return (rc == 0)
+ rc <- _casm_ ``%r = nocldstop; nocldstop = %0;'' (x::Int)
+ return (rc == (0::Int))
where
x = case b of {True -> 0; False -> 1}
queryStoppedChildFlag :: IO Bool
queryStoppedChildFlag = do
rc <- _casm_ ``%r = nocldstop;''
- return (rc == 0)
+ return (rc == (0::Int))
data Handler = Default
| Ignore
inSignalSet :: Signal -> SignalSet -> Bool
inSignalSet int sigset = unsafePerformPrimIO $ do
rc <- _casm_ ``%r = sigismember((sigset_t *)%0, %1);'' sigset int
- return (rc == 1)
+ return (rc == (1::Int))
deleteSignal :: Signal -> SignalSet -> SignalSet
deleteSignal int oldset = unsafePerformPrimIO $ do
-> IO Handler -- old handler
#ifdef __PARALLEL_HASKELL__
-installHandler = fail (userError "installHandler: not available for Parallel Haskell")
+installHandler = ioError (userError "installHandler: not available for Parallel Haskell")
#else
installHandler int handler maybe_mask = (
case handler of
_ccall_ stg_sig_catch int sptr mask
) >>= \rc ->
- if rc >= 0 then do
+ if rc >= (0::Int) then do
osptr <- _casm_ ``%r = (StgStablePtr) (%0);'' rc
m <- deRefStablePtr osptr
return (Catch m)
getSignalMask = do
bytes <- allocChars sigSetSize
rc <- _casm_ ``%r = sigprocmask(0, NULL, (sigset_t *)%0);'' bytes
- if rc == 0
+ if rc == (0::Int)
then freeze bytes
else syserr "getSignalMask"
bytes <- allocChars sigSetSize
rc <- _casm_ ``%r = sigprocmask(%0, (sigset_t *)%1, (sigset_t *)%2);''
how sigset bytes
- if rc == 0
+ if rc == (0::Int)
then freeze bytes
else syserr name
getPendingSignals = do
bytes <- allocChars sigSetSize
rc <- _casm_ ``%r = sigpending((sigset_t *)%0);'' bytes
- if rc == 0
+ if rc == (0::Int)
then freeze bytes
else syserr "getPendingSignals"
decipherWaitStatus :: MutableByteArray s x -> IO ProcessStatus
decipherWaitStatus wstat = do
exited <- _casm_ ``%r = WIFEXITED(*(int *)%0);'' wstat
- if exited /= 0
+ if exited /= (0::Int)
then do
exitstatus <- _casm_ ``%r = WEXITSTATUS(*(int *)%0);'' wstat
- if exitstatus == 0
+ if exitstatus == (0::Int)
then return (Exited ExitSuccess)
else return (Exited (ExitFailure exitstatus))
else do
signalled <- _casm_ ``%r = WIFSIGNALED(*(int *)%0);'' wstat
- if signalled /= 0
+ if signalled /= (0::Int)
then do
termsig <- _casm_ ``%r = WTERMSIG(*(int *)%0);'' wstat
return (Terminated termsig)