Haskell Core Libraries (unix package)ParentContentsIndex
System.Posix.Process
Portability non-portable (requires POSIX)
Stability provisional
Maintainer libraries@haskell.org
Contents
Processes
Forking and executing
Exiting
Process environment
Process groups
Sessions
Process times
Scheduling priority
Process status
Description
POSIX process support
Synopsis
forkProcess :: IO (Maybe ProcessID)
forkProcessAll :: IO (Maybe ProcessID)
executeFile :: FilePath -> Bool -> [String] -> Maybe [(String, String)] -> IO ()
exitImmediately :: ExitCode -> IO ()
getProcessID :: IO ProcessID
getParentProcessID :: IO ProcessID
getProcessGroupID :: IO ProcessGroupID
createProcessGroup :: ProcessID -> IO ProcessGroupID
joinProcessGroup :: ProcessGroupID -> IO ()
setProcessGroupID :: ProcessID -> ProcessGroupID -> IO ()
createSession :: IO ProcessGroupID
data ProcessTimes
getProcessTimes :: IO ProcessTimes
nice :: Int -> IO ()
getProcessPriority :: ProcessID -> IO Int
getProcessGroupPriority :: ProcessGroupID -> IO Int
getUserPriority :: UserID -> IO Int
setProcessPriority :: ProcessID -> Int -> IO ()
setProcessGroupPriority :: ProcessGroupID -> Int -> IO ()
setUserPriority :: UserID -> Int -> IO ()
data ProcessStatus
= Exited ExitCode
| Terminated Signal
| Stopped Signal
getProcessStatus :: Bool -> Bool -> ProcessID -> IO (Maybe ProcessStatus)
getAnyProcessStatus :: Bool -> Bool -> IO (Maybe (ProcessID, ProcessStatus))
getGroupProcessStatus :: Bool -> Bool -> ProcessGroupID -> IO (Maybe (ProcessID, ProcessStatus))
Processes
Forking and executing
forkProcess :: IO (Maybe ProcessID)

forkProcess is a wrapper around forkProcessPrim similar to forkProcessAll which returns a Maybe-type. The child receives Nothing, the parent Just (pid::ProcessID). In case of an error, an exception is thrown.

NOTE: currently, main threads are not stopped in the child process. To work around this problem, call forkProcess from the main thread.

If you really want to copy all threads into the new process, use forkProcessAll instead.

forkProcessAll :: IO (Maybe ProcessID)
forkProcessAll is the low-level wrapper for the fork system-call. Standard disclaimer for lazy I/O, shared file handles etc. apply. Notice that all Concurrent Haskell threads will be copied into the new process. See forkProcess on how to start a new process with only one active thread.
executeFile :: FilePath -> Bool -> [String] -> Maybe [(String, String)] -> IO ()
Exiting
exitImmediately :: ExitCode -> IO ()
Process environment
getProcessID :: IO ProcessID
getParentProcessID :: IO ProcessID
getProcessGroupID :: IO ProcessGroupID
Process groups
createProcessGroup :: ProcessID -> IO ProcessGroupID
joinProcessGroup :: ProcessGroupID -> IO ()
setProcessGroupID :: ProcessID -> ProcessGroupID -> IO ()
Sessions
createSession :: IO ProcessGroupID
Process times
data ProcessTimes
getProcessTimes :: IO ProcessTimes
Scheduling priority
nice :: Int -> IO ()
getProcessPriority :: ProcessID -> IO Int
getProcessGroupPriority :: ProcessGroupID -> IO Int
getUserPriority :: UserID -> IO Int
setProcessPriority :: ProcessID -> Int -> IO ()
setProcessGroupPriority :: ProcessGroupID -> Int -> IO ()
setUserPriority :: UserID -> Int -> IO ()
Process status
data ProcessStatus
Constructors
Exited ExitCode
Terminated Signal
Stopped Signal
Instances
Eq ProcessStatus
Ord ProcessStatus
Show ProcessStatus
getProcessStatus :: Bool -> Bool -> ProcessID -> IO (Maybe ProcessStatus)
getAnyProcessStatus :: Bool -> Bool -> IO (Maybe (ProcessID, ProcessStatus))
getGroupProcessStatus :: Bool -> Bool -> ProcessGroupID -> IO (Maybe (ProcessID, ProcessStatus))
Produced by Haddock version 0.4