aboutsummaryrefslogtreecommitdiffhomepage
path: root/System/Posix/Process
diff options
context:
space:
mode:
authorGravatar Herbert Valerio Riedel <hvr@gnu.org>2013-11-08 15:48:18 +0100
committerGravatar Herbert Valerio Riedel <hvr@gnu.org>2013-11-08 15:48:18 +0100
commita5aa36d7a86ccfea758fdeec39127d552f322285 (patch)
tree068fce21dd39f5f620fc751885e0d322d22f18aa /System/Posix/Process
parenta6bc389df2b25cbf9340f54b123a08831350d3f0 (diff)
`M-x untabify` & `M-x delete-trailing-whitespace`
...on recently touched files Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
Diffstat (limited to 'System/Posix/Process')
-rw-r--r--System/Posix/Process/ByteString.hsc29
-rw-r--r--System/Posix/Process/Common.hsc34
2 files changed, 31 insertions, 32 deletions
diff --git a/System/Posix/Process/ByteString.hsc b/System/Posix/Process/ByteString.hsc
index 4c6840a..294970e 100644
--- a/System/Posix/Process/ByteString.hsc
+++ b/System/Posix/Process/ByteString.hsc
@@ -6,7 +6,7 @@
-- Module : System.Posix.Process.ByteString
-- Copyright : (c) The University of Glasgow 2002
-- License : BSD-style (see the file libraries/base/LICENSE)
---
+--
-- Maintainer : libraries@haskell.org
-- Stability : provisional
-- Portability : non-portable (requires POSIX)
@@ -25,7 +25,7 @@ module System.Posix.Process.ByteString (
forkProcessWithUnmask,
#endif
executeFile,
-
+
-- ** Exiting
exitImmediately,
@@ -97,10 +97,10 @@ import System.Posix.ByteString.FilePath
-- environment is provided to supersede the process's current
-- environment. The basename (leading directory names suppressed) of
-- the command is passed to @execv*@ as @arg[0]@;
--- the argument list passed to 'executeFile' therefore
+-- the argument list passed to 'executeFile' therefore
-- begins with @arg[1]@.
executeFile :: RawFilePath -- ^ Command
- -> Bool -- ^ Search PATH?
+ -> Bool -- ^ Search PATH?
-> [ByteString] -- ^ Arguments
-> Maybe [(ByteString, ByteString)] -- ^ Environment
-> IO a
@@ -108,10 +108,10 @@ executeFile path search args Nothing = do
withFilePath path $ \s ->
withMany withFilePath (path:args) $ \cstrs ->
withArray0 nullPtr cstrs $ \arr -> do
- pPrPr_disableITimers
- if search
- then throwErrnoPathIfMinus1_ "executeFile" path (c_execvp s arr)
- else throwErrnoPathIfMinus1_ "executeFile" path (c_execv s arr)
+ pPrPr_disableITimers
+ if search
+ then throwErrnoPathIfMinus1_ "executeFile" path (c_execvp s arr)
+ else throwErrnoPathIfMinus1_ "executeFile" path (c_execv s arr)
return undefined -- never reached
executeFile path search args (Just env) = do
@@ -121,12 +121,12 @@ executeFile path search args (Just env) = do
let env' = map (\ (name, val) -> name `BC.append` ('=' `BC.cons` val)) env in
withMany withFilePath env' $ \cenv ->
withArray0 nullPtr cenv $ \env_arr -> do
- pPrPr_disableITimers
- if search
- then throwErrnoPathIfMinus1_ "executeFile" path
- (c_execvpe s arg_arr env_arr)
- else throwErrnoPathIfMinus1_ "executeFile" path
- (c_execve s arg_arr env_arr)
+ pPrPr_disableITimers
+ if search
+ then throwErrnoPathIfMinus1_ "executeFile" path
+ (c_execvpe s arg_arr env_arr)
+ else throwErrnoPathIfMinus1_ "executeFile" path
+ (c_execve s arg_arr env_arr)
return undefined -- never reached
foreign import ccall unsafe "execvp"
@@ -137,4 +137,3 @@ foreign import ccall unsafe "execv"
foreign import ccall unsafe "execve"
c_execve :: CString -> Ptr CString -> Ptr CString -> IO CInt
-
diff --git a/System/Posix/Process/Common.hsc b/System/Posix/Process/Common.hsc
index e8fd415..66e0d20 100644
--- a/System/Posix/Process/Common.hsc
+++ b/System/Posix/Process/Common.hsc
@@ -7,7 +7,7 @@
-- Module : System.Posix.Process.Common
-- Copyright : (c) The University of Glasgow 2002
-- License : BSD-style (see the file libraries/base/LICENSE)
---
+--
-- Maintainer : libraries@haskell.org
-- Stability : provisional
-- Portability : non-portable (requires POSIX)
@@ -83,7 +83,7 @@ import Control.Monad
#ifdef __GLASGOW_HASKELL__
import Control.Exception.Base ( bracket, getMaskingState, MaskingState(..) ) -- used by forkProcess
-import GHC.TopHandler ( runIO )
+import GHC.TopHandler ( runIO )
import GHC.IO ( unsafeUnmask, uninterruptibleMask_ )
#endif
@@ -188,11 +188,11 @@ foreign import ccall unsafe "setsid"
data ProcessTimes
= ProcessTimes { elapsedTime :: ClockTick
- , userTime :: ClockTick
- , systemTime :: ClockTick
- , childUserTime :: ClockTick
- , childSystemTime :: ClockTick
- }
+ , userTime :: ClockTick
+ , systemTime :: ClockTick
+ , childUserTime :: ClockTick
+ , childSystemTime :: ClockTick
+ }
-- | 'getProcessTimes' calls @times@ to obtain time-accounting
-- information for the current process and its children.
@@ -205,11 +205,11 @@ getProcessTimes = do
cut <- (#peek struct tms, tms_cutime) p_tms
cst <- (#peek struct tms, tms_cstime) p_tms
return (ProcessTimes{ elapsedTime = elapsed,
- userTime = ut,
- systemTime = st,
- childUserTime = cut,
- childSystemTime = cst
- })
+ userTime = ut,
+ systemTime = st,
+ childUserTime = cut,
+ childSystemTime = cst
+ })
type CTms = ()
@@ -256,7 +256,7 @@ setProcessPriority :: ProcessID -> Int -> IO ()
setProcessGroupPriority :: ProcessGroupID -> Int -> IO ()
setUserPriority :: UserID -> Int -> IO ()
-setProcessPriority pid val =
+setProcessPriority pid val =
throwErrnoIfMinus1_ "setProcessPriority" $
c_setpriority (#const PRIO_PROCESS) (fromIntegral pid) (fromIntegral val)
@@ -329,11 +329,11 @@ getProcessStatus :: Bool -> Bool -> ProcessID -> IO (Maybe ProcessStatus)
getProcessStatus block stopped pid =
alloca $ \wstatp -> do
pid' <- throwErrnoIfMinus1Retry "getProcessStatus"
- (c_waitpid pid wstatp (waitOptions block stopped))
+ (c_waitpid pid wstatp (waitOptions block stopped))
case pid' of
0 -> return Nothing
_ -> do ps <- readWaitStatus wstatp
- return (Just ps)
+ return (Just ps)
-- safe/interruptible, because this call might block
foreign import ccall interruptible "waitpid"
@@ -356,11 +356,11 @@ getGroupProcessStatus :: Bool
getGroupProcessStatus block stopped pgid =
alloca $ \wstatp -> do
pid <- throwErrnoIfMinus1Retry "getGroupProcessStatus"
- (c_waitpid (-pgid) wstatp (waitOptions block stopped))
+ (c_waitpid (-pgid) wstatp (waitOptions block stopped))
case pid of
0 -> return Nothing
_ -> do ps <- readWaitStatus wstatp
- return (Just (pid, ps))
+ return (Just (pid, ps))
-- | @'getAnyProcessStatus' blk stopped@ calls @waitpid@, returning
-- @'Just' (pid, tc)@, the 'ProcessID' and 'ProcessStatus' for any