-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | POSIX functionality
--
-- This package gives you access to the set of operating system services
-- standardised by POSIX.1-2008 (or the IEEE Portable Operating
-- System Interface for Computing Environments - IEEE Std. 1003.1).
--
-- The package is not supported under Windows.
@package unix
@version 2.8.2.1
-- | Internal stuff: support for ByteString FilePaths
module System.Posix.ByteString.FilePath
-- | A literal POSIX file path
type RawFilePath = ByteString
withFilePath :: RawFilePath -> (CString -> IO a) -> IO a
peekFilePath :: CString -> IO RawFilePath
peekFilePathLen :: CStringLen -> IO RawFilePath
throwErrnoPathIfMinus1Retry :: (Eq a, Num a) => String -> RawFilePath -> IO a -> IO a
throwErrnoPathIfMinus1Retry_ :: (Eq a, Num a) => String -> RawFilePath -> IO a -> IO ()
throwErrnoPathIfNullRetry :: String -> RawFilePath -> IO (Ptr a) -> IO (Ptr a)
throwErrnoPathIfRetry :: (a -> Bool) -> String -> RawFilePath -> IO a -> IO a
-- | as throwErrno, but exceptions include the given path when
-- appropriate.
throwErrnoPath :: String -> RawFilePath -> IO a
-- | as throwErrnoIf, but exceptions include the given path when
-- appropriate.
throwErrnoPathIf :: (a -> Bool) -> String -> RawFilePath -> IO a -> IO a
-- | as throwErrnoIf_, but exceptions include the given path when
-- appropriate.
throwErrnoPathIf_ :: (a -> Bool) -> String -> RawFilePath -> IO a -> IO ()
-- | as throwErrnoIfNull, but exceptions include the given path when
-- appropriate.
throwErrnoPathIfNull :: String -> RawFilePath -> IO (Ptr a) -> IO (Ptr a)
-- | as throwErrnoIfMinus1, but exceptions include the given path
-- when appropriate.
throwErrnoPathIfMinus1 :: (Eq a, Num a) => String -> RawFilePath -> IO a -> IO a
-- | as throwErrnoIfMinus1_, but exceptions include the given path
-- when appropriate.
throwErrnoPathIfMinus1_ :: (Eq a, Num a) => String -> RawFilePath -> IO a -> IO ()
-- | as throwErrnoTwoPathsIfMinus1_, but exceptions include two
-- paths when appropriate.
throwErrnoTwoPathsIfMinus1_ :: (Eq a, Num a) => String -> RawFilePath -> RawFilePath -> IO a -> IO ()
-- | String-based POSIX directory support
module System.Posix.Directory.ByteString
-- | createDirectory dir mode calls mkdir to create a new
-- directory, dir, with permissions based on mode.
createDirectory :: RawFilePath -> FileMode -> IO ()
removeDirectory :: RawFilePath -> IO ()
data DirStream
-- | openDirStream dir calls opendir to obtain a
-- directory stream for dir.
openDirStream :: RawFilePath -> IO DirStream
-- | readDirStream dp calls readdir to obtain the next
-- directory entry (struct dirent) for the open directory stream
-- dp, and returns the d_name member of that structure.
--
-- Note that this function returns an empty filepath if the end of the
-- directory stream is reached. For a safer alternative use
-- readDirStreamMaybe.
readDirStream :: DirStream -> IO RawFilePath
-- | readDirStreamMaybe dp calls readdir to obtain the
-- next directory entry (struct dirent) for the open directory
-- stream dp. It returns the d_name member of that
-- structure wrapped in a Just d_name if an entry was read and
-- Nothing if the end of the directory stream was reached.
readDirStreamMaybe :: DirStream -> IO (Maybe RawFilePath)
-- | rewindDirStream dp calls rewinddir to reposition the
-- directory stream dp at the beginning of the directory.
rewindDirStream :: DirStream -> IO ()
-- | closeDirStream dp calls closedir to close the
-- directory stream dp.
closeDirStream :: DirStream -> IO ()
data DirStreamOffset
tellDirStream :: DirStream -> IO DirStreamOffset
seekDirStream :: DirStream -> DirStreamOffset -> IO ()
-- | getWorkingDirectory calls getcwd to obtain the name
-- of the current working directory.
getWorkingDirectory :: IO RawFilePath
-- | changeWorkingDirectory dir calls chdir to change the
-- current working directory to dir.
changeWorkingDirectory :: RawFilePath -> IO ()
changeWorkingDirectoryFd :: Fd -> IO ()
module System.Posix.Directory.Fd
-- | Call fdopendir to obtain a directory stream for fd.
-- fd must not be otherwise used after this.
--
-- On success, it is owned by the returned DirStream, which should
-- be closed via closeDirStream when no longer needed. On error,
-- the file descriptor is automatically closed and then an exception is
-- thrown. There is no code path in which the file descriptor remains
-- open and yet not owned by a returned DirStream.
--
-- The input file descriptor must not have been used with
-- threadWaitRead or threadWaitWrite.
unsafeOpenDirStreamFd :: Fd -> IO DirStream
-- | POSIX directory support (internal module, no PVP guarantees)
module System.Posix.Directory.Internals
newtype DirStream
DirStream :: Ptr CDir -> DirStream
data {-# CTYPE "DIR" #-} CDir
data {-# CTYPE "struct dirent" #-} CDirent
newtype DirStreamOffset
DirStreamOffset :: COff -> DirStreamOffset
-- | dlopen(3) and friends Derived from GModule.chs by
-- M.Weber & M.Chakravarty which is part of c2hs. I left the API more
-- or less the same, mostly the flags are different.
module System.Posix.DynamicLinker.Prim
c_dlopen :: CString -> CInt -> IO (Ptr ())
c_dlsym :: Ptr () -> CString -> IO (FunPtr a)
c_dlerror :: IO CString
c_dlclose :: Ptr () -> IO CInt
-- | On some hosts (e.g. SuSe and Ubuntu Linux) RTLD_NEXT (and
-- RTLD_DEFAULT) are not visible without setting the macro
-- _GNU_SOURCE. Since we don't want to define this macro, you
-- can use the function haveRtldNext to check whether the flag
-- Next is available. Ideally, this will be optimized by the
-- compiler so that it should be as efficient as an #ifdef.
--
-- If you fail to test the flag and use it although it is undefined,
-- packDL will throw an error.
haveRtldNext :: Bool
-- | Deprecated: defaults to True
haveRtldLocal :: Bool
packRTLDFlags :: [RTLDFlags] -> CInt
-- | Flags for dlopen.
data RTLDFlags
RTLD_LAZY :: RTLDFlags
RTLD_NOW :: RTLDFlags
RTLD_GLOBAL :: RTLDFlags
RTLD_LOCAL :: RTLDFlags
packDL :: DL -> Ptr ()
-- | Flags for dlsym. Notice that Next might not be available
-- on your particular platform! Use haveRtldNext.
--
-- If RTLD_DEFAULT is not defined on your platform,
-- packDL Default reduces to nullPtr.
data DL
Null :: DL
Next :: DL
Default :: DL
DLHandle :: Ptr () -> DL
instance GHC.Read.Read System.Posix.DynamicLinker.Prim.RTLDFlags
instance GHC.Show.Show System.Posix.DynamicLinker.Prim.RTLDFlags
instance GHC.Show.Show System.Posix.DynamicLinker.Prim.DL
-- | Dynamic linker support through dlopen()
module System.Posix.DynamicLinker.ByteString
dlopen :: RawFilePath -> [RTLDFlags] -> IO DL
-- | dlsym returns the address binding of the symbol described in
-- symbol, as it occurs in the shared object identified by
-- source.
dlsym :: DL -> String -> IO (FunPtr a)
dlerror :: IO String
dlclose :: DL -> IO ()
withDL :: RawFilePath -> [RTLDFlags] -> (DL -> IO a) -> IO a
withDL_ :: RawFilePath -> [RTLDFlags] -> (DL -> IO a) -> IO ()
-- | undl obtains the raw handle. You mustn't do something like
-- withDL mod flags $ liftM undl >>= p -> use p
undl :: DL -> Ptr ()
-- | Dynamic linker support through dlopen()
module System.Posix.DynamicLinker
dlopen :: FilePath -> [RTLDFlags] -> IO DL
-- | dlsym returns the address binding of the symbol described in
-- symbol, as it occurs in the shared object identified by
-- source.
dlsym :: DL -> String -> IO (FunPtr a)
dlerror :: IO String
dlclose :: DL -> IO ()
withDL :: FilePath -> [RTLDFlags] -> (DL -> IO a) -> IO a
withDL_ :: FilePath -> [RTLDFlags] -> (DL -> IO a) -> IO ()
-- | undl obtains the raw handle. You mustn't do something like
-- withDL mod flags $ liftM undl >>= p -> use p
undl :: DL -> Ptr ()
-- | DLOpen support, old API Derived from GModule.chs by M.Weber &
-- M.Chakravarty which is part of c2hs I left the API more or less the
-- same, mostly the flags are different.
module System.Posix.DynamicLinker.Module
data Module
moduleOpen :: String -> [RTLDFlags] -> IO Module
moduleSymbol :: Module -> String -> IO (FunPtr a)
moduleClose :: Module -> IO ()
moduleError :: IO String
withModule :: Maybe String -> String -> [RTLDFlags] -> (Module -> IO a) -> IO a
withModule_ :: Maybe String -> String -> [RTLDFlags] -> (Module -> IO a) -> IO ()
-- | DLOpen support, old API Derived from GModule.chs by M.Weber &
-- M.Chakravarty which is part of c2hs I left the API more or less the
-- same, mostly the flags are different.
module System.Posix.DynamicLinker.Module.ByteString
data Module
moduleOpen :: RawFilePath -> [RTLDFlags] -> IO Module
moduleSymbol :: Module -> String -> IO (FunPtr a)
moduleClose :: Module -> IO ()
moduleError :: IO String
withModule :: Maybe String -> String -> [RTLDFlags] -> (Module -> IO a) -> IO a
withModule_ :: Maybe String -> String -> [RTLDFlags] -> (Module -> IO a) -> IO ()
-- | POSIX environment support
module System.Posix.Env
-- | getEnv looks up a variable in the environment.
getEnv :: String -> IO (Maybe String)
-- | getEnvDefault is a wrapper around getEnv where the
-- programmer can specify a fallback if the variable is not found in the
-- environment.
getEnvDefault :: String -> String -> IO String
getEnvironmentPrim :: IO [String]
-- | getEnvironment retrieves the entire environment as a list of
-- (key,value) pairs.
getEnvironment :: IO [(String, String)]
-- | setEnvironment resets the entire environment to the given list
-- of (key,value) pairs.
setEnvironment :: [(String, String)] -> IO ()
-- | putEnv function takes an argument of the form
-- name=value and is equivalent to
-- setEnv(key,value,True{-overwrite-}).
putEnv :: String -> IO ()
-- | The setEnv function inserts or resets the environment variable
-- name in the current environment list. If the variable name
-- does not exist in the list, it is inserted with the given value. If
-- the variable does exist, the argument overwrite is tested; if
-- overwrite is False, the variable is not reset,
-- otherwise it is reset to the given value.
setEnv :: String -> String -> Bool -> IO ()
-- | The unsetEnv function deletes all instances of the variable
-- name from the environment.
unsetEnv :: String -> IO ()
-- | The clearEnv function clears the environment of all name-value
-- pairs.
clearEnv :: IO ()
-- | POSIX environment support
module System.Posix.Env.ByteString
-- | getEnv looks up a variable in the environment.
getEnv :: ByteString -> IO (Maybe ByteString)
-- | getEnvDefault is a wrapper around getEnv where the
-- programmer can specify a fallback as the second argument, which will
-- be used if the variable is not found in the environment.
getEnvDefault :: ByteString -> ByteString -> IO ByteString
getEnvironmentPrim :: IO [ByteString]
-- | getEnvironment retrieves the entire environment as a list of
-- (key,value) pairs.
getEnvironment :: IO [(ByteString, ByteString)]
-- | setEnvironment resets the entire environment to the given list
-- of (key,value) pairs.
setEnvironment :: [(ByteString, ByteString)] -> IO ()
-- | putEnv function takes an argument of the form
-- name=value and is equivalent to
-- setEnv(key,value,True{-overwrite-}).
putEnv :: ByteString -> IO ()
-- | The setEnv function inserts or resets the environment variable
-- name in the current environment list. If the variable name
-- does not exist in the list, it is inserted with the given value. If
-- the variable does exist, the argument overwrite is tested; if
-- overwrite is False, the variable is not reset,
-- otherwise it is reset to the given value.
setEnv :: ByteString -> ByteString -> Bool -> IO ()
-- | The unsetEnv function deletes all instances of the variable
-- name from the environment.
unsetEnv :: ByteString -> IO ()
-- | The clearEnv function clears the environment of all name-value
-- pairs.
clearEnv :: IO ()
-- | Computation getArgs returns a list of the program's command
-- line arguments (not including the program name), as
-- ByteStrings.
--
-- Unlike getArgs, this function does no Unicode decoding of the
-- arguments; you get the exact bytes that were passed to the program by
-- the OS. To interpret the arguments as text, some Unicode decoding
-- should be applied.
getArgs :: IO [ByteString]
-- | POSIX environment support
module System.Posix.Env.PosixString
-- | getEnv looks up a variable in the environment.
getEnv :: PosixString -> IO (Maybe PosixString)
-- | getEnvDefault is a wrapper around getEnv where the
-- programmer can specify a fallback as the second argument, which will
-- be used if the variable is not found in the environment.
getEnvDefault :: PosixString -> PosixString -> IO PosixString
getEnvironmentPrim :: IO [PosixString]
-- | getEnvironment retrieves the entire environment as a list of
-- (key,value) pairs.
getEnvironment :: IO [(PosixString, PosixString)]
-- | setEnvironment resets the entire environment to the given list
-- of (key,value) pairs.
setEnvironment :: [(PosixString, PosixString)] -> IO ()
-- | putEnv function takes an argument of the form
-- name=value and is equivalent to
-- setEnv(key,value,True{-overwrite-}).
putEnv :: PosixString -> IO ()
-- | The setEnv function inserts or resets the environment variable
-- name in the current environment list. If the variable name
-- does not exist in the list, it is inserted with the given value. If
-- the variable does exist, the argument overwrite is tested; if
-- overwrite is False, the variable is not reset,
-- otherwise it is reset to the given value.
setEnv :: PosixString -> PosixString -> Bool -> IO ()
-- | The unsetEnv function deletes all instances of the variable
-- name from the environment.
unsetEnv :: PosixString -> IO ()
-- | The clearEnv function clears the environment of all name-value
-- pairs.
clearEnv :: IO ()
-- | Computation getArgs returns a list of the program's command
-- line arguments (not including the program name), as
-- PosixStrings.
--
-- Unlike getArgs, this function does no Unicode decoding of the
-- arguments; you get the exact bytes that were passed to the program by
-- the OS. To interpret the arguments as text, some Unicode decoding
-- should be applied.
getArgs :: IO [PosixString]
-- | POSIX error support
module System.Posix.Error
-- | as throwErrno, but exceptions include the given path when
-- appropriate.
throwErrnoPath :: String -> FilePath -> IO a
-- | as throwErrnoIf, but exceptions include the given path when
-- appropriate.
throwErrnoPathIf :: (a -> Bool) -> String -> FilePath -> IO a -> IO a
-- | as throwErrnoIf_, but exceptions include the given path when
-- appropriate.
throwErrnoPathIf_ :: (a -> Bool) -> String -> FilePath -> IO a -> IO ()
throwErrnoPathIfRetry :: (a -> Bool) -> String -> FilePath -> IO a -> IO a
-- | as throwErrnoIfNull, but exceptions include the given path when
-- appropriate.
throwErrnoPathIfNull :: String -> FilePath -> IO (Ptr a) -> IO (Ptr a)
throwErrnoPathIfNullRetry :: String -> FilePath -> IO (Ptr a) -> IO (Ptr a)
-- | as throwErrnoIfMinus1, but exceptions include the given path
-- when appropriate.
throwErrnoPathIfMinus1 :: (Eq a, Num a) => String -> FilePath -> IO a -> IO a
-- | as throwErrnoIfMinus1_, but exceptions include the given path
-- when appropriate.
throwErrnoPathIfMinus1_ :: (Eq a, Num a) => String -> FilePath -> IO a -> IO ()
throwErrnoPathIfMinus1Retry :: (Eq a, Num a) => String -> FilePath -> IO a -> IO a
throwErrnoPathIfMinus1Retry_ :: (Eq a, Num a) => String -> FilePath -> IO a -> IO ()
-- | String-based POSIX directory support
module System.Posix.Directory
-- | createDirectory dir mode calls mkdir to create a new
-- directory, dir, with permissions based on mode.
createDirectory :: FilePath -> FileMode -> IO ()
removeDirectory :: FilePath -> IO ()
data DirStream
-- | openDirStream dir calls opendir to obtain a
-- directory stream for dir.
openDirStream :: FilePath -> IO DirStream
-- | readDirStream dp calls readdir to obtain the next
-- directory entry (struct dirent) for the open directory stream
-- dp, and returns the d_name member of that structure.
--
-- Note that this function returns an empty filepath if the end of the
-- directory stream is reached. For a safer alternative use
-- readDirStreamMaybe.
readDirStream :: DirStream -> IO FilePath
-- | readDirStreamMaybe dp calls readdir to obtain the
-- next directory entry (struct dirent) for the open directory
-- stream dp. It returns the d_name member of that
-- structure wrapped in a Just d_name if an entry was read and
-- Nothing if the end of the directory stream was reached.
readDirStreamMaybe :: DirStream -> IO (Maybe FilePath)
-- | rewindDirStream dp calls rewinddir to reposition the
-- directory stream dp at the beginning of the directory.
rewindDirStream :: DirStream -> IO ()
-- | closeDirStream dp calls closedir to close the
-- directory stream dp.
closeDirStream :: DirStream -> IO ()
data DirStreamOffset
tellDirStream :: DirStream -> IO DirStreamOffset
seekDirStream :: DirStream -> DirStreamOffset -> IO ()
-- | getWorkingDirectory calls getcwd to obtain the name
-- of the current working directory.
getWorkingDirectory :: IO FilePath
-- | changeWorkingDirectory dir calls chdir to change the
-- current working directory to dir.
changeWorkingDirectory :: FilePath -> IO ()
changeWorkingDirectoryFd :: Fd -> IO ()
-- | POSIX file control support
module System.Posix.Fcntl
-- | Advice parameter for fileAdvise operation.
--
-- For more details, see documentation of posix_fadvise(2).
data Advice
AdviceNormal :: Advice
AdviceRandom :: Advice
AdviceSequential :: Advice
AdviceWillNeed :: Advice
AdviceDontNeed :: Advice
AdviceNoReuse :: Advice
-- | Performs posix_fadvise(2) operation on file-descriptor.
--
-- If platform does not provide posix_fadvise(2)
-- fileAdvise becomes a no-op.
--
-- (use #if HAVE_POSIX_FADVISE CPP guard to detect availability)
fileAdvise :: Fd -> FileOffset -> FileOffset -> Advice -> IO ()
-- | Performs posix_fallocate(2) operation on file-descriptor.
--
-- Throws IOError ("unsupported operation") if platform does not
-- provide posix_fallocate(2).
--
-- (use #if HAVE_POSIX_FALLOCATE CPP guard to detect
-- availability).
fileAllocate :: Fd -> FileOffset -> FileOffset -> IO ()
instance GHC.Classes.Eq System.Posix.Fcntl.Advice
-- | Functions defined by the POSIX standards for manipulating and querying
-- the file system. Names of underlying POSIX functions are indicated
-- whenever possible. A more complete documentation of the POSIX
-- functions together with a more detailed description of different error
-- conditions are usually available in the system's manual pages or from
-- http://www.unix.org/version3/online.html (free registration
-- required).
--
-- When a function that calls an underlying POSIX function fails, the
-- errno code is converted to an IOError using
-- errnoToIOError. For a list of which errno codes may be
-- generated, consult the POSIX documentation for the underlying
-- function.
module System.Posix.Files.ByteString
-- | Combines the two file modes into one that contains modes that appear
-- in either.
unionFileModes :: FileMode -> FileMode -> FileMode
-- | Combines two file modes into one that only contains modes that appear
-- in both.
intersectFileModes :: FileMode -> FileMode -> FileMode
-- | No permissions.
nullFileMode :: FileMode
-- | Owner has read permission.
ownerReadMode :: FileMode
-- | Owner has write permission.
ownerWriteMode :: FileMode
-- | Owner has execute permission.
ownerExecuteMode :: FileMode
-- | Owner has read, write and execute permission.
ownerModes :: FileMode
-- | Group has read permission.
groupReadMode :: FileMode
-- | Group has write permission.
groupWriteMode :: FileMode
-- | Group has execute permission.
groupExecuteMode :: FileMode
-- | Group has read, write and execute permission.
groupModes :: FileMode
-- | Others have read permission.
otherReadMode :: FileMode
-- | Others have write permission.
otherWriteMode :: FileMode
-- | Others have execute permission.
otherExecuteMode :: FileMode
-- | Others have read, write and execute permission.
otherModes :: FileMode
-- | Set user ID on execution.
setUserIDMode :: FileMode
-- | Set group ID on execution.
setGroupIDMode :: FileMode
-- | Owner, group and others have read and write permission.
stdFileMode :: FileMode
-- | Owner, group and others have read, write and execute permission.
accessModes :: FileMode
fileTypeModes :: FileMode
blockSpecialMode :: FileMode
characterSpecialMode :: FileMode
namedPipeMode :: FileMode
regularFileMode :: FileMode
directoryMode :: FileMode
symbolicLinkMode :: FileMode
socketMode :: FileMode
-- | setFileMode path mode changes permission of the file given by
-- path to mode. This operation may fail with
-- throwErrnoPathIfMinus1_ if path doesn't exist or if
-- the effective user ID of the current process is not that of the file's
-- owner.
--
-- Note: calls chmod.
setFileMode :: RawFilePath -> FileMode -> IO ()
-- | setFdMode fd mode acts like setFileMode but uses a
-- file descriptor fd instead of a FilePath.
--
-- Note: calls fchmod.
setFdMode :: Fd -> FileMode -> IO ()
-- | setFileCreationMask mode sets the file mode creation mask to
-- mode. Modes set by this operation are subtracted from files
-- and directories upon creation. The previous file creation mask is
-- returned.
--
-- Note: calls umask.
setFileCreationMask :: FileMode -> IO FileMode
-- | fileAccess name read write exec checks if the file (or other
-- file system object) name can be accessed for reading, writing
-- and/or executing. To check a permission set the corresponding argument
-- to True.
--
-- Note: calls access.
fileAccess :: RawFilePath -> Bool -> Bool -> Bool -> IO Bool
-- | Checks for the existence of the file.
--
-- Note: calls access.
fileExist :: RawFilePath -> IO Bool
-- | POSIX defines operations to get information, such as owner,
-- permissions, size and access times, about a file. This information is
-- represented by the FileStatus type.
--
-- Note: see chmod.
--
-- Limitations: Support for high resolution timestamps is filesystem
-- dependent:
--
--
-- - HFS+ volumes on OS X only support whole-second times.
--
data FileStatus
-- | getFileStatus path calls gets the FileStatus
-- information (user ID, size, access times, etc.) for the file
-- path.
--
-- Note: calls stat.
getFileStatus :: RawFilePath -> IO FileStatus
-- | getFdStatus fd acts as getFileStatus but uses a file
-- descriptor fd.
--
-- Note: calls fstat.
getFdStatus :: Fd -> IO FileStatus
-- | Acts as getFileStatus except when the RawFilePath refers
-- to a symbolic link. In that case the FileStatus information
-- of the symbolic link itself is returned instead of that of the file it
-- points to.
--
-- Note: calls lstat.
getSymbolicLinkStatus :: RawFilePath -> IO FileStatus
-- | ID of the device on which this file resides.
deviceID :: FileStatus -> DeviceID
-- | inode number
fileID :: FileStatus -> FileID
-- | File mode (such as permissions).
fileMode :: FileStatus -> FileMode
-- | Number of hard links to this file.
linkCount :: FileStatus -> LinkCount
-- | ID of owner.
fileOwner :: FileStatus -> UserID
-- | ID of group.
fileGroup :: FileStatus -> GroupID
-- | Describes the device that this file represents.
specialDeviceID :: FileStatus -> DeviceID
-- | Size of the file in bytes. If this file is a symbolic link the size is
-- the length of the pathname it contains.
fileSize :: FileStatus -> FileOffset
-- | Time of last access.
accessTime :: FileStatus -> EpochTime
-- | Time of last modification.
modificationTime :: FileStatus -> EpochTime
-- | Time of last status change (i.e. owner, group, link count, mode,
-- etc.).
statusChangeTime :: FileStatus -> EpochTime
-- | Time of last access in sub-second resolution. Depends on the timestamp
-- resolution of the underlying filesystem.
accessTimeHiRes :: FileStatus -> POSIXTime
-- | Time of last modification in sub-second resolution. Depends on the
-- timestamp resolution of the underlying filesystem.
modificationTimeHiRes :: FileStatus -> POSIXTime
-- | Time of last status change (i.e. owner, group, link count, mode, etc.)
-- in sub-second resolution. Depends on the timestamp resolution of the
-- underlying filesystem.
statusChangeTimeHiRes :: FileStatus -> POSIXTime
-- | Checks if this file is a block device.
isBlockDevice :: FileStatus -> Bool
-- | Checks if this file is a character device.
isCharacterDevice :: FileStatus -> Bool
-- | Checks if this file is a named pipe device.
isNamedPipe :: FileStatus -> Bool
-- | Checks if this file is a regular file device.
isRegularFile :: FileStatus -> Bool
-- | Checks if this file is a directory device.
isDirectory :: FileStatus -> Bool
-- | Checks if this file is a symbolic link device.
isSymbolicLink :: FileStatus -> Bool
-- | Checks if this file is a socket device.
isSocket :: FileStatus -> Bool
-- | Gives the preferred block size for efficient filesystem I/O in bytes.
-- Returns Nothing if st_blocksize is not supported on
-- this platform.
fileBlockSize :: FileStatus -> Maybe CBlkSize
-- | Number of blocks allocated for this file, in units of 512-bytes.
-- Returns Nothing if st_blocks is not supported on
-- this platform.
fileBlocks :: FileStatus -> Maybe CBlkCnt
-- | createNamedPipe fifo mode creates a new named pipe,
-- fifo, with permissions based on mode. May fail with
-- throwErrnoPathIfMinus1_ if a file named name already
-- exists or if the effective user ID of the current process doesn't have
-- permission to create the pipe.
--
-- Note: calls mkfifo.
createNamedPipe :: RawFilePath -> FileMode -> IO ()
-- | createDevice path mode dev creates either a regular or a
-- special file depending on the value of mode (and
-- dev). mode will normally be either
-- blockSpecialMode or characterSpecialMode. May fail with
-- throwErrnoPathIfMinus1_ if a file named name already
-- exists or if the effective user ID of the current process doesn't have
-- permission to create the file.
--
-- Note: calls mknod.
createDevice :: RawFilePath -> FileMode -> DeviceID -> IO ()
-- | createLink old new creates a new path, new, linked
-- to an existing file, old.
--
-- Note: calls link.
createLink :: RawFilePath -> RawFilePath -> IO ()
-- | removeLink path removes the link named path.
--
-- Note: calls unlink.
removeLink :: RawFilePath -> IO ()
-- | createSymbolicLink file1 file2 creates a symbolic link named
-- file2 which points to the file file1.
--
-- Symbolic links are interpreted at run-time as if the contents of the
-- link had been substituted into the path being followed to find a file
-- or directory.
--
-- Note: calls symlink.
createSymbolicLink :: RawFilePath -> RawFilePath -> IO ()
-- | Reads the RawFilePath pointed to by the symbolic link and
-- returns it.
--
-- Note: calls readlink.
readSymbolicLink :: RawFilePath -> IO RawFilePath
-- | rename old new renames a file or directory from old
-- to new.
--
-- Note: calls rename.
rename :: RawFilePath -> RawFilePath -> IO ()
-- | setOwnerAndGroup path uid gid changes the owner and group of
-- path to uid and gid, respectively.
--
-- If uid or gid is specified as -1, then that ID is
-- not changed.
--
-- Note: calls chown.
setOwnerAndGroup :: RawFilePath -> UserID -> GroupID -> IO ()
-- | Acts as setOwnerAndGroup but uses a file descriptor instead
-- of a FilePath.
--
-- Note: calls fchown.
setFdOwnerAndGroup :: Fd -> UserID -> GroupID -> IO ()
-- | Acts as setOwnerAndGroup but does not follow symlinks (and thus
-- changes permissions on the link itself).
--
-- Note: calls lchown.
setSymbolicLinkOwnerAndGroup :: RawFilePath -> UserID -> GroupID -> IO ()
-- | setFileTimes path atime mtime sets the access and
-- modification times associated with file path to
-- atime and mtime, respectively.
--
-- Note: calls utime.
setFileTimes :: RawFilePath -> EpochTime -> EpochTime -> IO ()
-- | Like setFileTimes but timestamps can have sub-second
-- resolution.
--
-- Note: calls utimensat or utimes. Support for high
-- resolution timestamps is filesystem dependent with the following
-- limitations:
--
--
-- - HFS+ volumes on OS X truncate the sub-second part of the
-- timestamp.
--
setFileTimesHiRes :: RawFilePath -> POSIXTime -> POSIXTime -> IO ()
-- | Like setFileTimesHiRes but uses a file descriptor instead of
-- a path. This operation is not supported on all platforms. On these
-- platforms, this function will raise an exception.
--
-- Note: calls futimens or futimes. Support for high
-- resolution timestamps is filesystem dependent with the following
-- limitations:
--
--
-- - HFS+ volumes on OS X truncate the sub-second part of the
-- timestamp.
--
setFdTimesHiRes :: Fd -> POSIXTime -> POSIXTime -> IO ()
-- | Like setFileTimesHiRes but does not follow symbolic links. This
-- operation is not supported on all platforms. On these platforms, this
-- function will raise an exception.
--
-- Note: calls utimensat or lutimes. Support for high
-- resolution timestamps is filesystem dependent with the following
-- limitations:
--
--
-- - HFS+ volumes on OS X truncate the sub-second part of the
-- timestamp.
--
setSymbolicLinkTimesHiRes :: RawFilePath -> POSIXTime -> POSIXTime -> IO ()
-- | touchFile path sets the access and modification times
-- associated with file path to the current time.
--
-- Note: calls utime.
touchFile :: RawFilePath -> IO ()
-- | Like touchFile but uses a file descriptor instead of a path.
-- This operation is not supported on all platforms. On these platforms,
-- this function will raise an exception.
--
-- Note: calls futimes.
touchFd :: Fd -> IO ()
-- | Like touchFile but does not follow symbolic links. This
-- operation is not supported on all platforms. On these platforms, this
-- function will raise an exception.
--
-- Note: calls lutimes.
touchSymbolicLink :: RawFilePath -> IO ()
-- | Truncates the file down to the specified length. If the file was
-- larger than the given length before this operation was performed the
-- extra is lost.
--
-- Note: calls truncate.
setFileSize :: RawFilePath -> FileOffset -> IO ()
-- | Acts as setFileSize but uses a file descriptor instead of a
-- FilePath.
--
-- Note: calls ftruncate.
setFdSize :: Fd -> FileOffset -> IO ()
data PathVar
FileSizeBits :: PathVar
LinkLimit :: PathVar
InputLineLimit :: PathVar
InputQueueLimit :: PathVar
FileNameLimit :: PathVar
PathNameLimit :: PathVar
PipeBufferLimit :: PathVar
SymbolicLinkLimit :: PathVar
SetOwnerAndGroupIsRestricted :: PathVar
FileNamesAreNotTruncated :: PathVar
VDisableChar :: PathVar
AsyncIOAvailable :: PathVar
PrioIOAvailable :: PathVar
SyncIOAvailable :: PathVar
-- | getPathVar var path obtains the dynamic value of the
-- requested configurable file limit or option associated with file or
-- directory path. For defined file limits, getPathVar
-- returns the associated value. For defined file options, the result of
-- getPathVar is undefined, but not failure.
--
-- Note: calls pathconf.
getPathVar :: RawFilePath -> PathVar -> IO Limit
-- | getFdPathVar var fd obtains the dynamic value of the
-- requested configurable file limit or option associated with the file
-- or directory attached to the open channel fd. For defined
-- file limits, getFdPathVar returns the associated value. For
-- defined file options, the result of getFdPathVar is
-- undefined, but not failure.
--
-- Note: calls fpathconf.
getFdPathVar :: Fd -> PathVar -> IO Limit
-- | Functions defined by the POSIX standards for manipulating and querying
-- the file system. Names of underlying POSIX functions are indicated
-- whenever possible. A more complete documentation of the POSIX
-- functions together with a more detailed description of different error
-- conditions are usually available in the system's manual pages or from
-- http://www.unix.org/version3/online.html (free registration
-- required).
--
-- When a function that calls an underlying POSIX function fails, the
-- errno code is converted to an IOError using
-- errnoToIOError. For a list of which errno codes may be
-- generated, consult the POSIX documentation for the underlying
-- function.
module System.Posix.Files
-- | Combines the two file modes into one that contains modes that appear
-- in either.
unionFileModes :: FileMode -> FileMode -> FileMode
-- | Combines two file modes into one that only contains modes that appear
-- in both.
intersectFileModes :: FileMode -> FileMode -> FileMode
-- | No permissions.
nullFileMode :: FileMode
-- | Owner has read permission.
ownerReadMode :: FileMode
-- | Owner has write permission.
ownerWriteMode :: FileMode
-- | Owner has execute permission.
ownerExecuteMode :: FileMode
-- | Owner has read, write and execute permission.
ownerModes :: FileMode
-- | Group has read permission.
groupReadMode :: FileMode
-- | Group has write permission.
groupWriteMode :: FileMode
-- | Group has execute permission.
groupExecuteMode :: FileMode
-- | Group has read, write and execute permission.
groupModes :: FileMode
-- | Others have read permission.
otherReadMode :: FileMode
-- | Others have write permission.
otherWriteMode :: FileMode
-- | Others have execute permission.
otherExecuteMode :: FileMode
-- | Others have read, write and execute permission.
otherModes :: FileMode
-- | Set user ID on execution.
setUserIDMode :: FileMode
-- | Set group ID on execution.
setGroupIDMode :: FileMode
-- | Owner, group and others have read and write permission.
stdFileMode :: FileMode
-- | Owner, group and others have read, write and execute permission.
accessModes :: FileMode
fileTypeModes :: FileMode
blockSpecialMode :: FileMode
characterSpecialMode :: FileMode
namedPipeMode :: FileMode
regularFileMode :: FileMode
directoryMode :: FileMode
symbolicLinkMode :: FileMode
socketMode :: FileMode
-- | setFileMode path mode changes permission of the file given by
-- path to mode. This operation may fail with
-- throwErrnoPathIfMinus1_ if path doesn't exist or if
-- the effective user ID of the current process is not that of the file's
-- owner.
--
-- Note: calls chmod.
setFileMode :: FilePath -> FileMode -> IO ()
-- | setFdMode fd mode acts like setFileMode but uses a
-- file descriptor fd instead of a FilePath.
--
-- Note: calls fchmod.
setFdMode :: Fd -> FileMode -> IO ()
-- | setFileCreationMask mode sets the file mode creation mask to
-- mode. Modes set by this operation are subtracted from files
-- and directories upon creation. The previous file creation mask is
-- returned.
--
-- Note: calls umask.
setFileCreationMask :: FileMode -> IO FileMode
-- | fileAccess name read write exec checks if the file (or other
-- file system object) name can be accessed for reading, writing
-- and/or executing. To check a permission set the corresponding argument
-- to True.
--
-- Note: calls access.
fileAccess :: FilePath -> Bool -> Bool -> Bool -> IO Bool
-- | Checks for the existence of the file.
--
-- Note: calls access.
fileExist :: FilePath -> IO Bool
-- | POSIX defines operations to get information, such as owner,
-- permissions, size and access times, about a file. This information is
-- represented by the FileStatus type.
--
-- Note: see chmod.
--
-- Limitations: Support for high resolution timestamps is filesystem
-- dependent:
--
--
-- - HFS+ volumes on OS X only support whole-second times.
--
newtype FileStatus
-- | The constructor is considered internal and may change.
FileStatus :: ForeignPtr CStat -> FileStatus
-- | getFileStatus path calls gets the FileStatus
-- information (user ID, size, access times, etc.) for the file
-- path.
--
-- Note: calls stat.
getFileStatus :: FilePath -> IO FileStatus
-- | getFdStatus fd acts as getFileStatus but uses a file
-- descriptor fd.
--
-- Note: calls fstat.
getFdStatus :: Fd -> IO FileStatus
-- | Acts as getFileStatus except when the FilePath refers to
-- a symbolic link. In that case the FileStatus information of
-- the symbolic link itself is returned instead of that of the file it
-- points to.
--
-- Note: calls lstat.
getSymbolicLinkStatus :: FilePath -> IO FileStatus
-- | ID of the device on which this file resides.
deviceID :: FileStatus -> DeviceID
-- | inode number
fileID :: FileStatus -> FileID
-- | File mode (such as permissions).
fileMode :: FileStatus -> FileMode
-- | Number of hard links to this file.
linkCount :: FileStatus -> LinkCount
-- | ID of owner.
fileOwner :: FileStatus -> UserID
-- | ID of group.
fileGroup :: FileStatus -> GroupID
-- | Describes the device that this file represents.
specialDeviceID :: FileStatus -> DeviceID
-- | Size of the file in bytes. If this file is a symbolic link the size is
-- the length of the pathname it contains.
fileSize :: FileStatus -> FileOffset
-- | Time of last access.
accessTime :: FileStatus -> EpochTime
-- | Time of last modification.
modificationTime :: FileStatus -> EpochTime
-- | Time of last status change (i.e. owner, group, link count, mode,
-- etc.).
statusChangeTime :: FileStatus -> EpochTime
-- | Time of last access in sub-second resolution. Depends on the timestamp
-- resolution of the underlying filesystem.
accessTimeHiRes :: FileStatus -> POSIXTime
-- | Time of last modification in sub-second resolution. Depends on the
-- timestamp resolution of the underlying filesystem.
modificationTimeHiRes :: FileStatus -> POSIXTime
-- | Time of last status change (i.e. owner, group, link count, mode, etc.)
-- in sub-second resolution. Depends on the timestamp resolution of the
-- underlying filesystem.
statusChangeTimeHiRes :: FileStatus -> POSIXTime
-- | Checks if this file is a block device.
isBlockDevice :: FileStatus -> Bool
-- | Checks if this file is a character device.
isCharacterDevice :: FileStatus -> Bool
-- | Checks if this file is a named pipe device.
isNamedPipe :: FileStatus -> Bool
-- | Checks if this file is a regular file device.
isRegularFile :: FileStatus -> Bool
-- | Checks if this file is a directory device.
isDirectory :: FileStatus -> Bool
-- | Checks if this file is a symbolic link device.
isSymbolicLink :: FileStatus -> Bool
-- | Checks if this file is a socket device.
isSocket :: FileStatus -> Bool
-- | Gives the preferred block size for efficient filesystem I/O in bytes.
-- Returns Nothing if st_blocksize is not supported on
-- this platform.
fileBlockSize :: FileStatus -> Maybe CBlkSize
-- | Number of blocks allocated for this file, in units of 512-bytes.
-- Returns Nothing if st_blocks is not supported on
-- this platform.
fileBlocks :: FileStatus -> Maybe CBlkCnt
-- | createNamedPipe fifo mode creates a new named pipe,
-- fifo, with permissions based on mode. May fail with
-- throwErrnoPathIfMinus1_ if a file named name already
-- exists or if the effective user ID of the current process doesn't have
-- permission to create the pipe.
--
-- Note: calls mkfifo.
createNamedPipe :: FilePath -> FileMode -> IO ()
-- | createDevice path mode dev creates either a regular or a
-- special file depending on the value of mode (and
-- dev). mode will normally be either
-- blockSpecialMode or characterSpecialMode. May fail with
-- throwErrnoPathIfMinus1_ if a file named name already
-- exists or if the effective user ID of the current process doesn't have
-- permission to create the file.
--
-- Note: calls mknod.
createDevice :: FilePath -> FileMode -> DeviceID -> IO ()
-- | createLink old new creates a new path, new, linked
-- to an existing file, old.
--
-- Note: calls link.
createLink :: FilePath -> FilePath -> IO ()
-- | removeLink path removes the link named path.
--
-- Note: calls unlink.
removeLink :: FilePath -> IO ()
-- | createSymbolicLink name1 name2 creates a symbolic link named
-- name2 which points to the file name1.
--
-- Symbolic links are interpreted at run-time as if the contents of the
-- link had been substituted into the path being followed to find a file
-- or directory.
--
-- Note: calls symlink.
createSymbolicLink :: FilePath -> FilePath -> IO ()
-- | Reads the FilePath pointed to by the symbolic link and
-- returns it.
--
-- Note: calls readlink.
readSymbolicLink :: FilePath -> IO FilePath
-- | rename old new renames a file or directory from old
-- to new.
--
-- Note: calls rename.
rename :: FilePath -> FilePath -> IO ()
-- | setOwnerAndGroup path uid gid changes the owner and group of
-- path to uid and gid, respectively.
--
-- If uid or gid is specified as -1, then that ID is
-- not changed.
--
-- Note: calls chown.
setOwnerAndGroup :: FilePath -> UserID -> GroupID -> IO ()
-- | Acts as setOwnerAndGroup but uses a file descriptor instead
-- of a FilePath.
--
-- Note: calls fchown.
setFdOwnerAndGroup :: Fd -> UserID -> GroupID -> IO ()
-- | Acts as setOwnerAndGroup but does not follow symlinks (and thus
-- changes permissions on the link itself).
--
-- Note: calls lchown.
setSymbolicLinkOwnerAndGroup :: FilePath -> UserID -> GroupID -> IO ()
-- | setFileTimes path atime mtime sets the access and
-- modification times associated with file path to
-- atime and mtime, respectively.
--
-- Note: calls utime.
setFileTimes :: FilePath -> EpochTime -> EpochTime -> IO ()
-- | Like setFileTimes but timestamps can have sub-second
-- resolution.
--
-- Note: calls utimensat or utimes. Support for high
-- resolution timestamps is filesystem dependent with the following
-- limitations:
--
--
-- - HFS+ volumes on OS X truncate the sub-second part of the
-- timestamp.
--
setFileTimesHiRes :: FilePath -> POSIXTime -> POSIXTime -> IO ()
-- | Like setFileTimesHiRes but uses a file descriptor instead of
-- a path. This operation is not supported on all platforms. On these
-- platforms, this function will raise an exception.
--
-- Note: calls futimens or futimes. Support for high
-- resolution timestamps is filesystem dependent with the following
-- limitations:
--
--
-- - HFS+ volumes on OS X truncate the sub-second part of the
-- timestamp.
--
setFdTimesHiRes :: Fd -> POSIXTime -> POSIXTime -> IO ()
-- | Like setFileTimesHiRes but does not follow symbolic links. This
-- operation is not supported on all platforms. On these platforms, this
-- function will raise an exception.
--
-- Note: calls utimensat or lutimes. Support for high
-- resolution timestamps is filesystem dependent with the following
-- limitations:
--
--
-- - HFS+ volumes on OS X truncate the sub-second part of the
-- timestamp.
--
setSymbolicLinkTimesHiRes :: FilePath -> POSIXTime -> POSIXTime -> IO ()
-- | touchFile path sets the access and modification times
-- associated with file path to the current time.
--
-- Note: calls utime.
touchFile :: FilePath -> IO ()
-- | Like touchFile but uses a file descriptor instead of a path.
-- This operation is not supported on all platforms. On these platforms,
-- this function will raise an exception.
--
-- Note: calls futimes.
touchFd :: Fd -> IO ()
-- | Like touchFile but does not follow symbolic links. This
-- operation is not supported on all platforms. On these platforms, this
-- function will raise an exception.
--
-- Note: calls lutimes.
touchSymbolicLink :: FilePath -> IO ()
-- | Truncates the file down to the specified length. If the file was
-- larger than the given length before this operation was performed the
-- extra is lost.
--
-- Note: calls truncate.
setFileSize :: FilePath -> FileOffset -> IO ()
-- | Acts as setFileSize but uses a file descriptor instead of a
-- FilePath.
--
-- Note: calls ftruncate.
setFdSize :: Fd -> FileOffset -> IO ()
data PathVar
FileSizeBits :: PathVar
LinkLimit :: PathVar
InputLineLimit :: PathVar
InputQueueLimit :: PathVar
FileNameLimit :: PathVar
PathNameLimit :: PathVar
PipeBufferLimit :: PathVar
SymbolicLinkLimit :: PathVar
SetOwnerAndGroupIsRestricted :: PathVar
FileNamesAreNotTruncated :: PathVar
VDisableChar :: PathVar
AsyncIOAvailable :: PathVar
PrioIOAvailable :: PathVar
SyncIOAvailable :: PathVar
-- | getPathVar var path obtains the dynamic value of the
-- requested configurable file limit or option associated with file or
-- directory path. For defined file limits, getPathVar
-- returns the associated value. For defined file options, the result of
-- getPathVar is undefined, but not failure.
--
-- Note: calls pathconf.
getPathVar :: FilePath -> PathVar -> IO Limit
-- | getFdPathVar var fd obtains the dynamic value of the
-- requested configurable file limit or option associated with the file
-- or directory attached to the open channel fd. For defined
-- file limits, getFdPathVar returns the associated value. For
-- defined file options, the result of getFdPathVar is
-- undefined, but not failure.
--
-- Note: calls fpathconf.
getFdPathVar :: Fd -> PathVar -> IO Limit
-- | POSIX IO support. These types and functions correspond to the unix
-- functions open(2), close(2), etc. For more portable functions which
-- are more like fopen(3) and friends from stdio.h, see System.IO.
module System.Posix.IO.ByteString
stdInput :: Fd
stdOutput :: Fd
stdError :: Fd
data OpenMode
ReadOnly :: OpenMode
WriteOnly :: OpenMode
ReadWrite :: OpenMode
-- | Correspond to some of the int flags from C's fcntl.h.
data OpenFileFlags
OpenFileFlags :: Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Maybe FileMode -> Bool -> Bool -> Bool -> OpenFileFlags
-- | O_APPEND
[append] :: OpenFileFlags -> Bool
-- | O_EXCL, result is undefined if O_CREAT is False
--
-- NOTE: Result is undefined if creat is Nothing.
[exclusive] :: OpenFileFlags -> Bool
-- | O_NOCTTY
[noctty] :: OpenFileFlags -> Bool
-- | O_NONBLOCK
[nonBlock] :: OpenFileFlags -> Bool
-- | O_TRUNC
[trunc] :: OpenFileFlags -> Bool
-- | O_NOFOLLOW
[nofollow] :: OpenFileFlags -> Bool
-- | O_CREAT
[creat] :: OpenFileFlags -> Maybe FileMode
-- | O_CLOEXEC
[cloexec] :: OpenFileFlags -> Bool
-- | O_DIRECTORY
[directory] :: OpenFileFlags -> Bool
-- | O_SYNC
[sync] :: OpenFileFlags -> Bool
-- | Default values for the OpenFileFlags type.
--
-- Each field of OpenFileFlags is either False or
-- Nothing respectively.
defaultFileFlags :: OpenFileFlags
-- | Open and optionally create this file. See Files for information
-- on how to use the FileMode type.
openFd :: RawFilePath -> OpenMode -> OpenFileFlags -> IO Fd
-- | Open a file relative to an optional directory file descriptor.
--
-- Directory file descriptors can be used to avoid some race conditions
-- when navigating changing directory trees, or to retain access to a
-- portion of the directory tree that would otherwise become inaccessible
-- after dropping privileges.
openFdAt :: Maybe Fd -> RawFilePath -> OpenMode -> OpenFileFlags -> IO Fd
-- | Create and open this file in WriteOnly mode. A special case of
-- openFd. See Files for information on how to use the
-- FileMode type.
createFile :: RawFilePath -> FileMode -> IO Fd
-- | Create and open a file for write-only, with default flags, relative an
-- optional directory file-descriptor.
--
-- Directory file descriptors can be used to avoid some race conditions
-- when navigating changing directory trees, or to retain access to a
-- portion of the directory tree that would otherwise become inaccessible
-- after dropping privileges.
createFileAt :: Maybe Fd -> RawFilePath -> FileMode -> IO Fd
-- | Close this file descriptor. May throw an exception if this is an
-- invalid descriptor.
closeFd :: Fd -> IO ()
-- | Read data from an Fd and return it as a ByteString.
-- Throws an exception if this is an invalid descriptor, or EOF has been
-- reached.
fdRead :: Fd -> ByteCount -> IO ByteString
-- | Write a ByteString to an Fd.
fdWrite :: Fd -> ByteString -> IO ByteCount
-- | Read data from an Fd into memory. This is exactly equivalent to
-- the POSIX read function.
fdReadBuf :: Fd -> Ptr Word8 -> ByteCount -> IO ByteCount
-- | Write data from memory to an Fd. This is exactly equivalent to
-- the POSIX write function.
fdWriteBuf :: Fd -> Ptr Word8 -> ByteCount -> IO ByteCount
-- | May throw an exception if this is an invalid descriptor.
fdSeek :: Fd -> SeekMode -> FileOffset -> IO FileOffset
data FdOption
-- | O_APPEND
AppendOnWrite :: FdOption
-- | FD_CLOEXEC
CloseOnExec :: FdOption
-- | O_NONBLOCK
NonBlockingRead :: FdOption
-- | O_SYNC
SynchronousWrites :: FdOption
-- | May throw an exception if this is an invalid descriptor.
queryFdOption :: Fd -> FdOption -> IO Bool
-- | May throw an exception if this is an invalid descriptor.
setFdOption :: Fd -> FdOption -> Bool -> IO ()
type FileLock = (LockRequest, SeekMode, FileOffset, FileOffset)
data LockRequest
ReadLock :: LockRequest
WriteLock :: LockRequest
Unlock :: LockRequest
-- | May throw an exception if this is an invalid descriptor.
getLock :: Fd -> FileLock -> IO (Maybe (ProcessID, FileLock))
-- | May throw an exception if this is an invalid descriptor.
setLock :: Fd -> FileLock -> IO ()
-- | May throw an exception if this is an invalid descriptor.
waitToSetLock :: Fd -> FileLock -> IO ()
-- | The createPipe function creates a pair of connected file
-- descriptors. The first component is the fd to read from, the second is
-- the write end. Although pipes may be bidirectional, this behaviour is
-- not portable and programmers should use two separate pipes for this
-- purpose. May throw an exception if this is an invalid descriptor.
createPipe :: IO (Fd, Fd)
-- | May throw an exception if this is an invalid descriptor.
dup :: Fd -> IO Fd
-- | May throw an exception if this is an invalid descriptor.
dupTo :: Fd -> Fd -> IO Fd
-- | Extracts the Fd from a Handle. This function has the
-- side effect of closing the Handle (and flushing its write
-- buffer, if necessary), without closing the underlying Fd.
--
-- Warning: This means you take over ownership of the underlying
-- Fd. hClose on the Handle will no longer have any
-- effect. This will break common patterns to avoid file descriptor
-- leaks, such as using hClose in the cleanup action of
-- Control.Exception.bracket, making it a silent no-op. Be sure
-- to close the returned Fd yourself to not leak it.
handleToFd :: Handle -> IO Fd
-- | Converts an Fd into a Handle that can be used with the
-- standard Haskell IO library (see System.IO).
fdToHandle :: Fd -> IO Handle
-- | POSIX IO support. These types and functions correspond to the unix
-- functions open(2), close(2), etc. For more portable functions which
-- are more like fopen(3) and friends from stdio.h, see System.IO.
module System.Posix.IO
stdInput :: Fd
stdOutput :: Fd
stdError :: Fd
data OpenMode
ReadOnly :: OpenMode
WriteOnly :: OpenMode
ReadWrite :: OpenMode
-- | Correspond to some of the int flags from C's fcntl.h.
data OpenFileFlags
OpenFileFlags :: Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Maybe FileMode -> Bool -> Bool -> Bool -> OpenFileFlags
-- | O_APPEND
[append] :: OpenFileFlags -> Bool
-- | O_EXCL, result is undefined if O_CREAT is False
--
-- NOTE: Result is undefined if creat is Nothing.
[exclusive] :: OpenFileFlags -> Bool
-- | O_NOCTTY
[noctty] :: OpenFileFlags -> Bool
-- | O_NONBLOCK
[nonBlock] :: OpenFileFlags -> Bool
-- | O_TRUNC
[trunc] :: OpenFileFlags -> Bool
-- | O_NOFOLLOW
[nofollow] :: OpenFileFlags -> Bool
-- | O_CREAT
[creat] :: OpenFileFlags -> Maybe FileMode
-- | O_CLOEXEC
[cloexec] :: OpenFileFlags -> Bool
-- | O_DIRECTORY
[directory] :: OpenFileFlags -> Bool
-- | O_SYNC
[sync] :: OpenFileFlags -> Bool
-- | Default values for the OpenFileFlags type.
--
-- Each field of OpenFileFlags is either False or
-- Nothing respectively.
defaultFileFlags :: OpenFileFlags
-- | Open and optionally create this file. See Files for information
-- on how to use the FileMode type.
openFd :: FilePath -> OpenMode -> OpenFileFlags -> IO Fd
-- | Open a file relative to an optional directory file descriptor.
--
-- Directory file descriptors can be used to avoid some race conditions
-- when navigating changing directory trees, or to retain access to a
-- portion of the directory tree that would otherwise become inaccessible
-- after dropping privileges.
openFdAt :: Maybe Fd -> FilePath -> OpenMode -> OpenFileFlags -> IO Fd
-- | Create and open this file in WriteOnly mode. A special case of
-- openFd. See Files for information on how to use the
-- FileMode type.
createFile :: FilePath -> FileMode -> IO Fd
-- | Create and open a file for write-only, with default flags, relative an
-- optional directory file-descriptor.
--
-- Directory file descriptors can be used to avoid some race conditions
-- when navigating changing directory trees, or to retain access to a
-- portion of the directory tree that would otherwise become inaccessible
-- after dropping privileges.
createFileAt :: Maybe Fd -> FilePath -> FileMode -> IO Fd
-- | Close this file descriptor. May throw an exception if this is an
-- invalid descriptor.
closeFd :: Fd -> IO ()
-- | Read data from an Fd and convert it to a String using
-- the locale encoding. Throws an exception if this is an invalid
-- descriptor, or EOF has been reached.
-- | Deprecated: This function is scheduled to be dropped in favor of
-- fdRead, because decoding e.g. UTF-8 streams partially is
-- unsafe.
fdRead :: Fd -> ByteCount -> IO (String, ByteCount)
-- | Write a String to an Fd using the locale encoding.
fdWrite :: Fd -> String -> IO ByteCount
-- | Read data from an Fd into memory. This is exactly equivalent to
-- the POSIX read function.
fdReadBuf :: Fd -> Ptr Word8 -> ByteCount -> IO ByteCount
-- | Write data from memory to an Fd. This is exactly equivalent to
-- the POSIX write function.
fdWriteBuf :: Fd -> Ptr Word8 -> ByteCount -> IO ByteCount
-- | May throw an exception if this is an invalid descriptor.
fdSeek :: Fd -> SeekMode -> FileOffset -> IO FileOffset
data FdOption
-- | O_APPEND
AppendOnWrite :: FdOption
-- | FD_CLOEXEC
CloseOnExec :: FdOption
-- | O_NONBLOCK
NonBlockingRead :: FdOption
-- | O_SYNC
SynchronousWrites :: FdOption
-- | May throw an exception if this is an invalid descriptor.
queryFdOption :: Fd -> FdOption -> IO Bool
-- | May throw an exception if this is an invalid descriptor.
setFdOption :: Fd -> FdOption -> Bool -> IO ()
type FileLock = (LockRequest, SeekMode, FileOffset, FileOffset)
data LockRequest
ReadLock :: LockRequest
WriteLock :: LockRequest
Unlock :: LockRequest
-- | May throw an exception if this is an invalid descriptor.
getLock :: Fd -> FileLock -> IO (Maybe (ProcessID, FileLock))
-- | May throw an exception if this is an invalid descriptor.
setLock :: Fd -> FileLock -> IO ()
-- | May throw an exception if this is an invalid descriptor.
waitToSetLock :: Fd -> FileLock -> IO ()
-- | The createPipe function creates a pair of connected file
-- descriptors. The first component is the fd to read from, the second is
-- the write end. Although pipes may be bidirectional, this behaviour is
-- not portable and programmers should use two separate pipes for this
-- purpose. May throw an exception if this is an invalid descriptor.
createPipe :: IO (Fd, Fd)
-- | May throw an exception if this is an invalid descriptor.
dup :: Fd -> IO Fd
-- | May throw an exception if this is an invalid descriptor.
dupTo :: Fd -> Fd -> IO Fd
-- | Extracts the Fd from a Handle. This function has the
-- side effect of closing the Handle (and flushing its write
-- buffer, if necessary), without closing the underlying Fd.
--
-- Warning: This means you take over ownership of the underlying
-- Fd. hClose on the Handle will no longer have any
-- effect. This will break common patterns to avoid file descriptor
-- leaks, such as using hClose in the cleanup action of
-- Control.Exception.bracket, making it a silent no-op. Be sure
-- to close the returned Fd yourself to not leak it.
handleToFd :: Handle -> IO Fd
-- | Converts an Fd into a Handle that can be used with the
-- standard Haskell IO library (see System.IO).
fdToHandle :: Fd -> IO Handle
-- | Internal stuff: support for ByteString FilePaths
module System.Posix.PosixPath.FilePath
withFilePath :: PosixPath -> (CString -> IO a) -> IO a
peekFilePath :: CString -> IO PosixPath
peekFilePathLen :: CStringLen -> IO PosixPath
throwErrnoPathIfMinus1Retry :: (Eq a, Num a) => String -> PosixPath -> IO a -> IO a
throwErrnoPathIfMinus1Retry_ :: (Eq a, Num a) => String -> PosixPath -> IO a -> IO ()
throwErrnoPathIfNullRetry :: String -> PosixPath -> IO (Ptr a) -> IO (Ptr a)
throwErrnoPathIfRetry :: (a -> Bool) -> String -> PosixPath -> IO a -> IO a
-- | as throwErrno, but exceptions include the given path when
-- appropriate.
throwErrnoPath :: String -> PosixPath -> IO a
-- | as throwErrnoIf, but exceptions include the given path when
-- appropriate.
throwErrnoPathIf :: (a -> Bool) -> String -> PosixPath -> IO a -> IO a
-- | as throwErrnoIf_, but exceptions include the given path when
-- appropriate.
throwErrnoPathIf_ :: (a -> Bool) -> String -> PosixPath -> IO a -> IO ()
-- | as throwErrnoIfNull, but exceptions include the given path when
-- appropriate.
throwErrnoPathIfNull :: String -> PosixPath -> IO (Ptr a) -> IO (Ptr a)
-- | as throwErrnoIfMinus1, but exceptions include the given path
-- when appropriate.
throwErrnoPathIfMinus1 :: (Eq a, Num a) => String -> PosixPath -> IO a -> IO a
-- | as throwErrnoIfMinus1_, but exceptions include the given path
-- when appropriate.
throwErrnoPathIfMinus1_ :: (Eq a, Num a) => String -> PosixPath -> IO a -> IO ()
-- | as throwErrnoTwoPathsIfMinus1_, but exceptions include two
-- paths when appropriate.
throwErrnoTwoPathsIfMinus1_ :: (Eq a, Num a) => String -> PosixPath -> PosixPath -> IO a -> IO ()
-- | POSIX IO support. These types and functions correspond to the unix
-- functions open(2), close(2), etc. For more portable functions which
-- are more like fopen(3) and friends from stdio.h, see System.IO.
module System.Posix.IO.PosixString
stdInput :: Fd
stdOutput :: Fd
stdError :: Fd
data OpenMode
ReadOnly :: OpenMode
WriteOnly :: OpenMode
ReadWrite :: OpenMode
-- | Correspond to some of the int flags from C's fcntl.h.
data OpenFileFlags
OpenFileFlags :: Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Maybe FileMode -> Bool -> Bool -> Bool -> OpenFileFlags
-- | O_APPEND
[append] :: OpenFileFlags -> Bool
-- | O_EXCL, result is undefined if O_CREAT is False
--
-- NOTE: Result is undefined if creat is Nothing.
[exclusive] :: OpenFileFlags -> Bool
-- | O_NOCTTY
[noctty] :: OpenFileFlags -> Bool
-- | O_NONBLOCK
[nonBlock] :: OpenFileFlags -> Bool
-- | O_TRUNC
[trunc] :: OpenFileFlags -> Bool
-- | O_NOFOLLOW
[nofollow] :: OpenFileFlags -> Bool
-- | O_CREAT
[creat] :: OpenFileFlags -> Maybe FileMode
-- | O_CLOEXEC
[cloexec] :: OpenFileFlags -> Bool
-- | O_DIRECTORY
[directory] :: OpenFileFlags -> Bool
-- | O_SYNC
[sync] :: OpenFileFlags -> Bool
-- | Default values for the OpenFileFlags type.
--
-- Each field of OpenFileFlags is either False or
-- Nothing respectively.
defaultFileFlags :: OpenFileFlags
-- | Open and optionally create this file. See Files for information
-- on how to use the FileMode type.
openFd :: PosixPath -> OpenMode -> OpenFileFlags -> IO Fd
-- | Open a file relative to an optional directory file descriptor.
--
-- Directory file descriptors can be used to avoid some race conditions
-- when navigating changing directory trees, or to retain access to a
-- portion of the directory tree that would otherwise become inaccessible
-- after dropping privileges.
openFdAt :: Maybe Fd -> PosixPath -> OpenMode -> OpenFileFlags -> IO Fd
-- | Create and open this file in WriteOnly mode. A special case of
-- openFd. See Files for information on how to use the
-- FileMode type.
createFile :: PosixPath -> FileMode -> IO Fd
-- | Create and open a file for write-only, with default flags, relative an
-- optional directory file-descriptor.
--
-- Directory file descriptors can be used to avoid some race conditions
-- when navigating changing directory trees, or to retain access to a
-- portion of the directory tree that would otherwise become inaccessible
-- after dropping privileges.
createFileAt :: Maybe Fd -> PosixPath -> FileMode -> IO Fd
-- | Close this file descriptor. May throw an exception if this is an
-- invalid descriptor.
closeFd :: Fd -> IO ()
-- | Read data from an Fd and return it as a ByteString.
-- Throws an exception if this is an invalid descriptor, or EOF has been
-- reached.
fdRead :: Fd -> ByteCount -> IO ByteString
-- | Write a ByteString to an Fd.
fdWrite :: Fd -> ByteString -> IO ByteCount
-- | Read data from an Fd into memory. This is exactly equivalent to
-- the POSIX read function.
fdReadBuf :: Fd -> Ptr Word8 -> ByteCount -> IO ByteCount
-- | Write data from memory to an Fd. This is exactly equivalent to
-- the POSIX write function.
fdWriteBuf :: Fd -> Ptr Word8 -> ByteCount -> IO ByteCount
-- | May throw an exception if this is an invalid descriptor.
fdSeek :: Fd -> SeekMode -> FileOffset -> IO FileOffset
data FdOption
-- | O_APPEND
AppendOnWrite :: FdOption
-- | FD_CLOEXEC
CloseOnExec :: FdOption
-- | O_NONBLOCK
NonBlockingRead :: FdOption
-- | O_SYNC
SynchronousWrites :: FdOption
-- | May throw an exception if this is an invalid descriptor.
queryFdOption :: Fd -> FdOption -> IO Bool
-- | May throw an exception if this is an invalid descriptor.
setFdOption :: Fd -> FdOption -> Bool -> IO ()
type FileLock = (LockRequest, SeekMode, FileOffset, FileOffset)
data LockRequest
ReadLock :: LockRequest
WriteLock :: LockRequest
Unlock :: LockRequest
-- | May throw an exception if this is an invalid descriptor.
getLock :: Fd -> FileLock -> IO (Maybe (ProcessID, FileLock))
-- | May throw an exception if this is an invalid descriptor.
setLock :: Fd -> FileLock -> IO ()
-- | May throw an exception if this is an invalid descriptor.
waitToSetLock :: Fd -> FileLock -> IO ()
-- | The createPipe function creates a pair of connected file
-- descriptors. The first component is the fd to read from, the second is
-- the write end. Although pipes may be bidirectional, this behaviour is
-- not portable and programmers should use two separate pipes for this
-- purpose. May throw an exception if this is an invalid descriptor.
createPipe :: IO (Fd, Fd)
-- | May throw an exception if this is an invalid descriptor.
dup :: Fd -> IO Fd
-- | May throw an exception if this is an invalid descriptor.
dupTo :: Fd -> Fd -> IO Fd
-- | Extracts the Fd from a Handle. This function has the
-- side effect of closing the Handle (and flushing its write
-- buffer, if necessary), without closing the underlying Fd.
--
-- Warning: This means you take over ownership of the underlying
-- Fd. hClose on the Handle will no longer have any
-- effect. This will break common patterns to avoid file descriptor
-- leaks, such as using hClose in the cleanup action of
-- Control.Exception.bracket, making it a silent no-op. Be sure
-- to close the returned Fd yourself to not leak it.
handleToFd :: Handle -> IO Fd
-- | Converts an Fd into a Handle that can be used with the
-- standard Haskell IO library (see System.IO).
fdToHandle :: Fd -> IO Handle
-- | Functions defined by the POSIX standards for manipulating and querying
-- the file system. Names of underlying POSIX functions are indicated
-- whenever possible. A more complete documentation of the POSIX
-- functions together with a more detailed description of different error
-- conditions are usually available in the system's manual pages or from
-- http://www.unix.org/version3/online.html (free registration
-- required).
--
-- When a function that calls an underlying POSIX function fails, the
-- errno code is converted to an IOError using
-- errnoToIOError. For a list of which errno codes may be
-- generated, consult the POSIX documentation for the underlying
-- function.
module System.Posix.Files.PosixString
-- | Combines the two file modes into one that contains modes that appear
-- in either.
unionFileModes :: FileMode -> FileMode -> FileMode
-- | Combines two file modes into one that only contains modes that appear
-- in both.
intersectFileModes :: FileMode -> FileMode -> FileMode
-- | No permissions.
nullFileMode :: FileMode
-- | Owner has read permission.
ownerReadMode :: FileMode
-- | Owner has write permission.
ownerWriteMode :: FileMode
-- | Owner has execute permission.
ownerExecuteMode :: FileMode
-- | Owner has read, write and execute permission.
ownerModes :: FileMode
-- | Group has read permission.
groupReadMode :: FileMode
-- | Group has write permission.
groupWriteMode :: FileMode
-- | Group has execute permission.
groupExecuteMode :: FileMode
-- | Group has read, write and execute permission.
groupModes :: FileMode
-- | Others have read permission.
otherReadMode :: FileMode
-- | Others have write permission.
otherWriteMode :: FileMode
-- | Others have execute permission.
otherExecuteMode :: FileMode
-- | Others have read, write and execute permission.
otherModes :: FileMode
-- | Set user ID on execution.
setUserIDMode :: FileMode
-- | Set group ID on execution.
setGroupIDMode :: FileMode
-- | Owner, group and others have read and write permission.
stdFileMode :: FileMode
-- | Owner, group and others have read, write and execute permission.
accessModes :: FileMode
fileTypeModes :: FileMode
blockSpecialMode :: FileMode
characterSpecialMode :: FileMode
namedPipeMode :: FileMode
regularFileMode :: FileMode
directoryMode :: FileMode
symbolicLinkMode :: FileMode
socketMode :: FileMode
-- | setFileMode path mode changes permission of the file given by
-- path to mode. This operation may fail with
-- throwErrnoPathIfMinus1_ if path doesn't exist or if
-- the effective user ID of the current process is not that of the file's
-- owner.
--
-- Note: calls chmod.
setFileMode :: PosixPath -> FileMode -> IO ()
-- | setFdMode fd mode acts like setFileMode but uses a
-- file descriptor fd instead of a FilePath.
--
-- Note: calls fchmod.
setFdMode :: Fd -> FileMode -> IO ()
-- | setFileCreationMask mode sets the file mode creation mask to
-- mode. Modes set by this operation are subtracted from files
-- and directories upon creation. The previous file creation mask is
-- returned.
--
-- Note: calls umask.
setFileCreationMask :: FileMode -> IO FileMode
-- | fileAccess name read write exec checks if the file (or other
-- file system object) name can be accessed for reading, writing
-- and/or executing. To check a permission set the corresponding argument
-- to True.
--
-- Note: calls access.
fileAccess :: PosixPath -> Bool -> Bool -> Bool -> IO Bool
-- | Checks for the existence of the file.
--
-- Note: calls access.
fileExist :: PosixPath -> IO Bool
-- | POSIX defines operations to get information, such as owner,
-- permissions, size and access times, about a file. This information is
-- represented by the FileStatus type.
--
-- Note: see chmod.
--
-- Limitations: Support for high resolution timestamps is filesystem
-- dependent:
--
--
-- - HFS+ volumes on OS X only support whole-second times.
--
data FileStatus
-- | getFileStatus path calls gets the FileStatus
-- information (user ID, size, access times, etc.) for the file
-- path.
--
-- Note: calls stat.
getFileStatus :: PosixPath -> IO FileStatus
-- | getFdStatus fd acts as getFileStatus but uses a file
-- descriptor fd.
--
-- Note: calls fstat.
getFdStatus :: Fd -> IO FileStatus
-- | Acts as getFileStatus except when the PosixPath refers
-- to a symbolic link. In that case the FileStatus information
-- of the symbolic link itself is returned instead of that of the file it
-- points to.
--
-- Note: calls lstat.
getSymbolicLinkStatus :: PosixPath -> IO FileStatus
-- | ID of the device on which this file resides.
deviceID :: FileStatus -> DeviceID
-- | inode number
fileID :: FileStatus -> FileID
-- | File mode (such as permissions).
fileMode :: FileStatus -> FileMode
-- | Number of hard links to this file.
linkCount :: FileStatus -> LinkCount
-- | ID of owner.
fileOwner :: FileStatus -> UserID
-- | ID of group.
fileGroup :: FileStatus -> GroupID
-- | Describes the device that this file represents.
specialDeviceID :: FileStatus -> DeviceID
-- | Size of the file in bytes. If this file is a symbolic link the size is
-- the length of the pathname it contains.
fileSize :: FileStatus -> FileOffset
-- | Time of last access.
accessTime :: FileStatus -> EpochTime
-- | Time of last modification.
modificationTime :: FileStatus -> EpochTime
-- | Time of last status change (i.e. owner, group, link count, mode,
-- etc.).
statusChangeTime :: FileStatus -> EpochTime
-- | Time of last access in sub-second resolution. Depends on the timestamp
-- resolution of the underlying filesystem.
accessTimeHiRes :: FileStatus -> POSIXTime
-- | Time of last modification in sub-second resolution. Depends on the
-- timestamp resolution of the underlying filesystem.
modificationTimeHiRes :: FileStatus -> POSIXTime
-- | Time of last status change (i.e. owner, group, link count, mode, etc.)
-- in sub-second resolution. Depends on the timestamp resolution of the
-- underlying filesystem.
statusChangeTimeHiRes :: FileStatus -> POSIXTime
-- | Checks if this file is a block device.
isBlockDevice :: FileStatus -> Bool
-- | Checks if this file is a character device.
isCharacterDevice :: FileStatus -> Bool
-- | Checks if this file is a named pipe device.
isNamedPipe :: FileStatus -> Bool
-- | Checks if this file is a regular file device.
isRegularFile :: FileStatus -> Bool
-- | Checks if this file is a directory device.
isDirectory :: FileStatus -> Bool
-- | Checks if this file is a symbolic link device.
isSymbolicLink :: FileStatus -> Bool
-- | Checks if this file is a socket device.
isSocket :: FileStatus -> Bool
-- | createNamedPipe fifo mode creates a new named pipe,
-- fifo, with permissions based on mode. May fail with
-- throwErrnoPathIfMinus1_ if a file named name already
-- exists or if the effective user ID of the current process doesn't have
-- permission to create the pipe.
--
-- Note: calls mkfifo.
createNamedPipe :: PosixPath -> FileMode -> IO ()
-- | createDevice path mode dev creates either a regular or a
-- special file depending on the value of mode (and
-- dev). mode will normally be either
-- blockSpecialMode or characterSpecialMode. May fail with
-- throwErrnoPathIfMinus1_ if a file named name already
-- exists or if the effective user ID of the current process doesn't have
-- permission to create the file.
--
-- Note: calls mknod.
createDevice :: PosixPath -> FileMode -> DeviceID -> IO ()
-- | createLink old new creates a new path, new, linked
-- to an existing file, old.
--
-- Note: calls link.
createLink :: PosixPath -> PosixPath -> IO ()
-- | removeLink path removes the link named path.
--
-- Note: calls unlink.
removeLink :: PosixPath -> IO ()
-- | createSymbolicLink file1 file2 creates a symbolic link named
-- file2 which points to the file file1.
--
-- Symbolic links are interpreted at run-time as if the contents of the
-- link had been substituted into the path being followed to find a file
-- or directory.
--
-- Note: calls symlink.
createSymbolicLink :: PosixPath -> PosixPath -> IO ()
-- | Reads the PosixPath pointed to by the symbolic link and
-- returns it.
--
-- Note: calls readlink.
readSymbolicLink :: PosixPath -> IO PosixPath
-- | rename old new renames a file or directory from old
-- to new.
--
-- Note: calls rename.
rename :: PosixPath -> PosixPath -> IO ()
-- | setOwnerAndGroup path uid gid changes the owner and group of
-- path to uid and gid, respectively.
--
-- If uid or gid is specified as -1, then that ID is
-- not changed.
--
-- Note: calls chown.
setOwnerAndGroup :: PosixPath -> UserID -> GroupID -> IO ()
-- | Acts as setOwnerAndGroup but uses a file descriptor instead
-- of a FilePath.
--
-- Note: calls fchown.
setFdOwnerAndGroup :: Fd -> UserID -> GroupID -> IO ()
-- | Acts as setOwnerAndGroup but does not follow symlinks (and thus
-- changes permissions on the link itself).
--
-- Note: calls lchown.
setSymbolicLinkOwnerAndGroup :: PosixPath -> UserID -> GroupID -> IO ()
-- | setFileTimes path atime mtime sets the access and
-- modification times associated with file path to
-- atime and mtime, respectively.
--
-- Note: calls utime.
setFileTimes :: PosixPath -> EpochTime -> EpochTime -> IO ()
-- | Like setFileTimes but timestamps can have sub-second
-- resolution.
--
-- Note: calls utimensat or utimes. Support for high
-- resolution timestamps is filesystem dependent with the following
-- limitations:
--
--
-- - HFS+ volumes on OS X truncate the sub-second part of the
-- timestamp.
--
setFileTimesHiRes :: PosixPath -> POSIXTime -> POSIXTime -> IO ()
-- | Like setFileTimesHiRes but does not follow symbolic links. This
-- operation is not supported on all platforms. On these platforms, this
-- function will raise an exception.
--
-- Note: calls utimensat or lutimes. Support for high
-- resolution timestamps is filesystem dependent with the following
-- limitations:
--
--
-- - HFS+ volumes on OS X truncate the sub-second part of the
-- timestamp.
--
setSymbolicLinkTimesHiRes :: PosixPath -> POSIXTime -> POSIXTime -> IO ()
-- | touchFile path sets the access and modification times
-- associated with file path to the current time.
--
-- Note: calls utime.
touchFile :: PosixPath -> IO ()
-- | Like touchFile but uses a file descriptor instead of a path.
-- This operation is not supported on all platforms. On these platforms,
-- this function will raise an exception.
--
-- Note: calls futimes.
touchFd :: Fd -> IO ()
-- | Like touchFile but does not follow symbolic links. This
-- operation is not supported on all platforms. On these platforms, this
-- function will raise an exception.
--
-- Note: calls lutimes.
touchSymbolicLink :: PosixPath -> IO ()
-- | Truncates the file down to the specified length. If the file was
-- larger than the given length before this operation was performed the
-- extra is lost.
--
-- Note: calls truncate.
setFileSize :: PosixPath -> FileOffset -> IO ()
-- | Acts as setFileSize but uses a file descriptor instead of a
-- FilePath.
--
-- Note: calls ftruncate.
setFdSize :: Fd -> FileOffset -> IO ()
data PathVar
FileSizeBits :: PathVar
LinkLimit :: PathVar
InputLineLimit :: PathVar
InputQueueLimit :: PathVar
FileNameLimit :: PathVar
PathNameLimit :: PathVar
PipeBufferLimit :: PathVar
SymbolicLinkLimit :: PathVar
SetOwnerAndGroupIsRestricted :: PathVar
FileNamesAreNotTruncated :: PathVar
VDisableChar :: PathVar
AsyncIOAvailable :: PathVar
PrioIOAvailable :: PathVar
SyncIOAvailable :: PathVar
-- | getPathVar var path obtains the dynamic value of the
-- requested configurable file limit or option associated with file or
-- directory path. For defined file limits, getPathVar
-- returns the associated value. For defined file options, the result of
-- getPathVar is undefined, but not failure.
--
-- Note: calls pathconf.
getPathVar :: PosixPath -> PathVar -> IO Limit
-- | getFdPathVar var fd obtains the dynamic value of the
-- requested configurable file limit or option associated with the file
-- or directory attached to the open channel fd. For defined
-- file limits, getFdPathVar returns the associated value. For
-- defined file options, the result of getFdPathVar is
-- undefined, but not failure.
--
-- Note: calls fpathconf.
getFdPathVar :: Fd -> PathVar -> IO Limit
-- | PosixPath based POSIX directory support
module System.Posix.Directory.PosixPath
-- | createDirectory dir mode calls mkdir to create a new
-- directory, dir, with permissions based on mode.
createDirectory :: PosixPath -> FileMode -> IO ()
removeDirectory :: PosixPath -> IO ()
data DirStream
-- | openDirStream dir calls opendir to obtain a
-- directory stream for dir.
openDirStream :: PosixPath -> IO DirStream
-- | readDirStream dp calls readdir to obtain the next
-- directory entry (struct dirent) for the open directory stream
-- dp, and returns the d_name member of that structure.
readDirStream :: DirStream -> IO PosixPath
-- | rewindDirStream dp calls rewinddir to reposition the
-- directory stream dp at the beginning of the directory.
rewindDirStream :: DirStream -> IO ()
-- | closeDirStream dp calls closedir to close the
-- directory stream dp.
closeDirStream :: DirStream -> IO ()
data DirStreamOffset
tellDirStream :: DirStream -> IO DirStreamOffset
seekDirStream :: DirStream -> DirStreamOffset -> IO ()
-- | getWorkingDirectory calls getcwd to obtain the name
-- of the current working directory.
getWorkingDirectory :: IO PosixPath
-- | changeWorkingDirectory dir calls chdir to change the
-- current working directory to dir.
changeWorkingDirectory :: PosixPath -> IO ()
changeWorkingDirectoryFd :: Fd -> IO ()
module System.Posix.Process.Internals
pPrPr_disableITimers :: IO ()
c_execvpe :: CString -> Ptr CString -> Ptr CString -> IO CInt
decipherWaitStatus :: CInt -> IO ProcessStatus
-- | The exit status of a process
data ProcessStatus
-- | the process exited by calling exit() or returning from
-- main
Exited :: ExitCode -> ProcessStatus
-- | the process was terminated by a signal, the Bool is
-- True if a core dump was produced
Terminated :: Signal -> Bool -> ProcessStatus
-- | the process was stopped by a signal
Stopped :: Signal -> ProcessStatus
instance GHC.Show.Show System.Posix.Process.Internals.ProcessStatus
instance GHC.Classes.Ord System.Posix.Process.Internals.ProcessStatus
instance GHC.Classes.Eq System.Posix.Process.Internals.ProcessStatus
-- | POSIX process support. See also the System.Cmd and System.Process
-- modules in the process package.
module System.Posix.Process.ByteString
-- | forkProcess corresponds to the POSIX fork system call.
-- The IO action passed as an argument is executed in the child
-- process; no other threads will be copied to the child process. On
-- success, forkProcess returns the child's ProcessID to
-- the parent process; in case of an error, an exception is thrown.
--
-- The exception masking state of the executed action is inherited (c.f.
-- forkIO), see also forkProcessWithUnmask (since:
-- 2.7.0.0).
--
-- forkProcess comes with a giant warning: since any other running
-- threads are not copied into the child process, it's easy to go wrong:
-- e.g. by accessing some shared resource that was held by another thread
-- in the parent.
--
-- GHC note: forkProcess is not currently very well supported when
-- using multiple capabilities (+RTS -N), although it is
-- supported with -threaded as long as only one capability is
-- being used.
forkProcess :: IO () -> IO ProcessID
-- | Variant of forkProcess in the style of
-- forkIOWithUnmask.
forkProcessWithUnmask :: ((forall a. IO a -> IO a) -> IO ()) -> IO ProcessID
-- | executeFile cmd args env calls one of the
-- execv* family, depending on whether or not the current PATH
-- is to be searched for the command, and whether or not an 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 begins with arg[1].
executeFile :: RawFilePath -> Bool -> [ByteString] -> Maybe [(ByteString, ByteString)] -> IO a
-- | exitImmediately status calls _exit to
-- terminate the process with the indicated exit status. The
-- operation never returns. Since it does not use the Haskell exception
-- system and it cannot be caught.
--
-- Note: Prior to unix-2.8.0.0 the type-signature of
-- exitImmediately was ExitCode -> IO ().
exitImmediately :: ExitCode -> IO a
-- | getProcessID calls getpid to obtain the
-- ProcessID for the current process.
getProcessID :: IO ProcessID
-- | getParentProcessID calls getppid to obtain the
-- ProcessID for the parent of the current process.
getParentProcessID :: IO ProcessID
-- | getProcessGroupID calls getpgrp to obtain the
-- ProcessGroupID for the current process.
getProcessGroupID :: IO ProcessGroupID
-- | getProcessGroupIDOf pid calls getpgid to
-- obtain the ProcessGroupID for process pid.
getProcessGroupIDOf :: ProcessID -> IO ProcessGroupID
-- | createProcessGroupFor pid calls setpgid to
-- make process pid a new process group leader.
createProcessGroupFor :: ProcessID -> IO ProcessGroupID
-- | joinProcessGroup pgid calls setpgid to set
-- the ProcessGroupID of the current process to pgid.
joinProcessGroup :: ProcessGroupID -> IO ()
-- | setProcessGroupIDOf pid pgid calls setpgid to
-- set the ProcessGroupIDOf for process pid to
-- pgid.
setProcessGroupIDOf :: ProcessID -> ProcessGroupID -> IO ()
-- | createSession calls setsid to create a new session
-- with the current process as session leader.
createSession :: IO ProcessGroupID
data ProcessTimes
ProcessTimes :: ClockTick -> ClockTick -> ClockTick -> ClockTick -> ClockTick -> ProcessTimes
[elapsedTime] :: ProcessTimes -> ClockTick
[userTime] :: ProcessTimes -> ClockTick
[systemTime] :: ProcessTimes -> ClockTick
[childUserTime] :: ProcessTimes -> ClockTick
[childSystemTime] :: ProcessTimes -> ClockTick
-- | getProcessTimes calls times to obtain time-accounting
-- information for the current process and its children.
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 ()
-- | The exit status of a process
data ProcessStatus
-- | the process exited by calling exit() or returning from
-- main
Exited :: ExitCode -> ProcessStatus
-- | the process was terminated by a signal, the Bool is
-- True if a core dump was produced
Terminated :: Signal -> Bool -> ProcessStatus
-- | the process was stopped by a signal
Stopped :: Signal -> ProcessStatus
-- | getProcessStatus blk stopped pid calls
-- waitpid, returning Just tc, the
-- ProcessStatus for process pid if it is available,
-- Nothing otherwise. If blk is False, then
-- WNOHANG is set in the options for waitpid, otherwise
-- not. If stopped is True, then WUNTRACED is
-- set in the options for waitpid, otherwise not.
getProcessStatus :: Bool -> Bool -> ProcessID -> IO (Maybe ProcessStatus)
-- | getAnyProcessStatus blk stopped calls
-- waitpid, returning Just (pid, tc), the
-- ProcessID and ProcessStatus for any child process if a
-- child process has exited, or Nothing if there are child
-- processes but none have exited. If there are no child processes, then
-- getAnyProcessStatus raises an isDoesNotExistError
-- exception.
--
-- If blk is False, then WNOHANG is set in the
-- options for waitpid, otherwise not. If stopped is
-- True, then WUNTRACED is set in the options for
-- waitpid, otherwise not.
getAnyProcessStatus :: Bool -> Bool -> IO (Maybe (ProcessID, ProcessStatus))
-- | getGroupProcessStatus blk stopped pgid calls
-- waitpid, returning Just (pid, tc), the
-- ProcessID and ProcessStatus for any process in group
-- pgid if one is available, or Nothing if there are
-- child processes but none have exited. If there are no child processes,
-- then getGroupProcessStatus raises an
-- isDoesNotExistError exception.
--
-- If blk is False, then WNOHANG is set in the
-- options for waitpid, otherwise not. If stopped is
-- True, then WUNTRACED is set in the options for
-- waitpid, otherwise not.
getGroupProcessStatus :: Bool -> Bool -> ProcessGroupID -> IO (Maybe (ProcessID, ProcessStatus))
-- | createProcessGroup pid calls setpgid to make
-- process pid a new process group leader. This function is
-- currently deprecated, and might be changed to making the current
-- process a new process group leader in future versions.
-- | Deprecated: This function is scheduled to be replaced by something
-- different in the future, we therefore recommend that you do not use
-- this version and use createProcessGroupFor instead.
createProcessGroup :: ProcessID -> IO ProcessGroupID
-- | setProcessGroupID pid pgid calls setpgid to
-- set the ProcessGroupID for process pid to
-- pgid. This function is currently deprecated, and might be
-- changed to setting the ProcessGroupID for the current process
-- in future versions.
-- | Deprecated: This function is scheduled to be replaced by something
-- different in the future, we therefore recommend that you do not use
-- this version and use setProcessGroupIDOf instead.
setProcessGroupID :: ProcessID -> ProcessGroupID -> IO ()
-- | POSIX process support. See also the System.Cmd and System.Process
-- modules in the process package.
module System.Posix.Process
-- | forkProcess corresponds to the POSIX fork system call.
-- The IO action passed as an argument is executed in the child
-- process; no other threads will be copied to the child process. On
-- success, forkProcess returns the child's ProcessID to
-- the parent process; in case of an error, an exception is thrown.
--
-- The exception masking state of the executed action is inherited (c.f.
-- forkIO), see also forkProcessWithUnmask (since:
-- 2.7.0.0).
--
-- forkProcess comes with a giant warning: since any other running
-- threads are not copied into the child process, it's easy to go wrong:
-- e.g. by accessing some shared resource that was held by another thread
-- in the parent.
--
-- GHC note: forkProcess is not currently very well supported when
-- using multiple capabilities (+RTS -N), although it is
-- supported with -threaded as long as only one capability is
-- being used.
forkProcess :: IO () -> IO ProcessID
-- | Variant of forkProcess in the style of
-- forkIOWithUnmask.
forkProcessWithUnmask :: ((forall a. IO a -> IO a) -> IO ()) -> IO ProcessID
-- | executeFile cmd args env calls one of the
-- execv* family, depending on whether or not the current PATH
-- is to be searched for the command, and whether or not an 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 begins with arg[1].
executeFile :: FilePath -> Bool -> [String] -> Maybe [(String, String)] -> IO a
-- | exitImmediately status calls _exit to
-- terminate the process with the indicated exit status. The
-- operation never returns. Since it does not use the Haskell exception
-- system and it cannot be caught.
--
-- Note: Prior to unix-2.8.0.0 the type-signature of
-- exitImmediately was ExitCode -> IO ().
exitImmediately :: ExitCode -> IO a
-- | getProcessID calls getpid to obtain the
-- ProcessID for the current process.
getProcessID :: IO ProcessID
-- | getParentProcessID calls getppid to obtain the
-- ProcessID for the parent of the current process.
getParentProcessID :: IO ProcessID
-- | getProcessGroupID calls getpgrp to obtain the
-- ProcessGroupID for the current process.
getProcessGroupID :: IO ProcessGroupID
-- | getProcessGroupIDOf pid calls getpgid to
-- obtain the ProcessGroupID for process pid.
getProcessGroupIDOf :: ProcessID -> IO ProcessGroupID
-- | createProcessGroupFor pid calls setpgid to
-- make process pid a new process group leader.
createProcessGroupFor :: ProcessID -> IO ProcessGroupID
-- | joinProcessGroup pgid calls setpgid to set
-- the ProcessGroupID of the current process to pgid.
joinProcessGroup :: ProcessGroupID -> IO ()
-- | setProcessGroupIDOf pid pgid calls setpgid to
-- set the ProcessGroupIDOf for process pid to
-- pgid.
setProcessGroupIDOf :: ProcessID -> ProcessGroupID -> IO ()
-- | createSession calls setsid to create a new session
-- with the current process as session leader.
createSession :: IO ProcessGroupID
data ProcessTimes
ProcessTimes :: ClockTick -> ClockTick -> ClockTick -> ClockTick -> ClockTick -> ProcessTimes
[elapsedTime] :: ProcessTimes -> ClockTick
[userTime] :: ProcessTimes -> ClockTick
[systemTime] :: ProcessTimes -> ClockTick
[childUserTime] :: ProcessTimes -> ClockTick
[childSystemTime] :: ProcessTimes -> ClockTick
-- | getProcessTimes calls times to obtain time-accounting
-- information for the current process and its children.
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 ()
-- | The exit status of a process
data ProcessStatus
-- | the process exited by calling exit() or returning from
-- main
Exited :: ExitCode -> ProcessStatus
-- | the process was terminated by a signal, the Bool is
-- True if a core dump was produced
Terminated :: Signal -> Bool -> ProcessStatus
-- | the process was stopped by a signal
Stopped :: Signal -> ProcessStatus
-- | getProcessStatus blk stopped pid calls
-- waitpid, returning Just tc, the
-- ProcessStatus for process pid if it is available,
-- Nothing otherwise. If blk is False, then
-- WNOHANG is set in the options for waitpid, otherwise
-- not. If stopped is True, then WUNTRACED is
-- set in the options for waitpid, otherwise not.
getProcessStatus :: Bool -> Bool -> ProcessID -> IO (Maybe ProcessStatus)
-- | getAnyProcessStatus blk stopped calls
-- waitpid, returning Just (pid, tc), the
-- ProcessID and ProcessStatus for any child process if a
-- child process has exited, or Nothing if there are child
-- processes but none have exited. If there are no child processes, then
-- getAnyProcessStatus raises an isDoesNotExistError
-- exception.
--
-- If blk is False, then WNOHANG is set in the
-- options for waitpid, otherwise not. If stopped is
-- True, then WUNTRACED is set in the options for
-- waitpid, otherwise not.
getAnyProcessStatus :: Bool -> Bool -> IO (Maybe (ProcessID, ProcessStatus))
-- | getGroupProcessStatus blk stopped pgid calls
-- waitpid, returning Just (pid, tc), the
-- ProcessID and ProcessStatus for any process in group
-- pgid if one is available, or Nothing if there are
-- child processes but none have exited. If there are no child processes,
-- then getGroupProcessStatus raises an
-- isDoesNotExistError exception.
--
-- If blk is False, then WNOHANG is set in the
-- options for waitpid, otherwise not. If stopped is
-- True, then WUNTRACED is set in the options for
-- waitpid, otherwise not.
getGroupProcessStatus :: Bool -> Bool -> ProcessGroupID -> IO (Maybe (ProcessID, ProcessStatus))
-- | createProcessGroup pid calls setpgid to make
-- process pid a new process group leader. This function is
-- currently deprecated, and might be changed to making the current
-- process a new process group leader in future versions.
-- | Deprecated: This function is scheduled to be replaced by something
-- different in the future, we therefore recommend that you do not use
-- this version and use createProcessGroupFor instead.
createProcessGroup :: ProcessID -> IO ProcessGroupID
-- | setProcessGroupID pid pgid calls setpgid to
-- set the ProcessGroupID for process pid to
-- pgid. This function is currently deprecated, and might be
-- changed to setting the ProcessGroupID for the current process
-- in future versions.
-- | Deprecated: This function is scheduled to be replaced by something
-- different in the future, we therefore recommend that you do not use
-- this version and use setProcessGroupIDOf instead.
setProcessGroupID :: ProcessID -> ProcessGroupID -> IO ()
-- | POSIX process support. See also the System.Cmd and System.Process
-- modules in the process package.
module System.Posix.Process.PosixString
-- | forkProcess corresponds to the POSIX fork system call.
-- The IO action passed as an argument is executed in the child
-- process; no other threads will be copied to the child process. On
-- success, forkProcess returns the child's ProcessID to
-- the parent process; in case of an error, an exception is thrown.
--
-- The exception masking state of the executed action is inherited (c.f.
-- forkIO), see also forkProcessWithUnmask (since:
-- 2.7.0.0).
--
-- forkProcess comes with a giant warning: since any other running
-- threads are not copied into the child process, it's easy to go wrong:
-- e.g. by accessing some shared resource that was held by another thread
-- in the parent.
--
-- GHC note: forkProcess is not currently very well supported when
-- using multiple capabilities (+RTS -N), although it is
-- supported with -threaded as long as only one capability is
-- being used.
forkProcess :: IO () -> IO ProcessID
-- | Variant of forkProcess in the style of
-- forkIOWithUnmask.
forkProcessWithUnmask :: ((forall a. IO a -> IO a) -> IO ()) -> IO ProcessID
-- | executeFile cmd args env calls one of the
-- execv* family, depending on whether or not the current PATH
-- is to be searched for the command, and whether or not an 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 begins with arg[1].
executeFile :: PosixPath -> Bool -> [PosixString] -> Maybe [(PosixString, PosixString)] -> IO a
-- | exitImmediately status calls _exit to
-- terminate the process with the indicated exit status. The
-- operation never returns. Since it does not use the Haskell exception
-- system and it cannot be caught.
--
-- Note: Prior to unix-2.8.0.0 the type-signature of
-- exitImmediately was ExitCode -> IO ().
exitImmediately :: ExitCode -> IO a
-- | getProcessID calls getpid to obtain the
-- ProcessID for the current process.
getProcessID :: IO ProcessID
-- | getParentProcessID calls getppid to obtain the
-- ProcessID for the parent of the current process.
getParentProcessID :: IO ProcessID
-- | getProcessGroupID calls getpgrp to obtain the
-- ProcessGroupID for the current process.
getProcessGroupID :: IO ProcessGroupID
-- | getProcessGroupIDOf pid calls getpgid to
-- obtain the ProcessGroupID for process pid.
getProcessGroupIDOf :: ProcessID -> IO ProcessGroupID
-- | createProcessGroupFor pid calls setpgid to
-- make process pid a new process group leader.
createProcessGroupFor :: ProcessID -> IO ProcessGroupID
-- | joinProcessGroup pgid calls setpgid to set
-- the ProcessGroupID of the current process to pgid.
joinProcessGroup :: ProcessGroupID -> IO ()
-- | setProcessGroupIDOf pid pgid calls setpgid to
-- set the ProcessGroupIDOf for process pid to
-- pgid.
setProcessGroupIDOf :: ProcessID -> ProcessGroupID -> IO ()
-- | createSession calls setsid to create a new session
-- with the current process as session leader.
createSession :: IO ProcessGroupID
data ProcessTimes
ProcessTimes :: ClockTick -> ClockTick -> ClockTick -> ClockTick -> ClockTick -> ProcessTimes
[elapsedTime] :: ProcessTimes -> ClockTick
[userTime] :: ProcessTimes -> ClockTick
[systemTime] :: ProcessTimes -> ClockTick
[childUserTime] :: ProcessTimes -> ClockTick
[childSystemTime] :: ProcessTimes -> ClockTick
-- | getProcessTimes calls times to obtain time-accounting
-- information for the current process and its children.
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 ()
-- | The exit status of a process
data ProcessStatus
-- | the process exited by calling exit() or returning from
-- main
Exited :: ExitCode -> ProcessStatus
-- | the process was terminated by a signal, the Bool is
-- True if a core dump was produced
Terminated :: Signal -> Bool -> ProcessStatus
-- | the process was stopped by a signal
Stopped :: Signal -> ProcessStatus
-- | getProcessStatus blk stopped pid calls
-- waitpid, returning Just tc, the
-- ProcessStatus for process pid if it is available,
-- Nothing otherwise. If blk is False, then
-- WNOHANG is set in the options for waitpid, otherwise
-- not. If stopped is True, then WUNTRACED is
-- set in the options for waitpid, otherwise not.
getProcessStatus :: Bool -> Bool -> ProcessID -> IO (Maybe ProcessStatus)
-- | getAnyProcessStatus blk stopped calls
-- waitpid, returning Just (pid, tc), the
-- ProcessID and ProcessStatus for any child process if a
-- child process has exited, or Nothing if there are child
-- processes but none have exited. If there are no child processes, then
-- getAnyProcessStatus raises an isDoesNotExistError
-- exception.
--
-- If blk is False, then WNOHANG is set in the
-- options for waitpid, otherwise not. If stopped is
-- True, then WUNTRACED is set in the options for
-- waitpid, otherwise not.
getAnyProcessStatus :: Bool -> Bool -> IO (Maybe (ProcessID, ProcessStatus))
-- | getGroupProcessStatus blk stopped pgid calls
-- waitpid, returning Just (pid, tc), the
-- ProcessID and ProcessStatus for any process in group
-- pgid if one is available, or Nothing if there are
-- child processes but none have exited. If there are no child processes,
-- then getGroupProcessStatus raises an
-- isDoesNotExistError exception.
--
-- If blk is False, then WNOHANG is set in the
-- options for waitpid, otherwise not. If stopped is
-- True, then WUNTRACED is set in the options for
-- waitpid, otherwise not.
getGroupProcessStatus :: Bool -> Bool -> ProcessGroupID -> IO (Maybe (ProcessID, ProcessStatus))
-- | createProcessGroup pid calls setpgid to make
-- process pid a new process group leader. This function is
-- currently deprecated, and might be changed to making the current
-- process a new process group leader in future versions.
-- | Deprecated: This function is scheduled to be replaced by something
-- different in the future, we therefore recommend that you do not use
-- this version and use createProcessGroupFor instead.
createProcessGroup :: ProcessID -> IO ProcessGroupID
-- | setProcessGroupID pid pgid calls setpgid to
-- set the ProcessGroupID for process pid to
-- pgid. This function is currently deprecated, and might be
-- changed to setting the ProcessGroupID for the current process
-- in future versions.
-- | Deprecated: This function is scheduled to be replaced by something
-- different in the future, we therefore recommend that you do not use
-- this version and use setProcessGroupIDOf instead.
setProcessGroupID :: ProcessID -> ProcessGroupID -> IO ()
-- | POSIX resource support
module System.Posix.Resource
data ResourceLimit
ResourceLimitInfinity :: ResourceLimit
ResourceLimitUnknown :: ResourceLimit
ResourceLimit :: Integer -> ResourceLimit
data ResourceLimits
ResourceLimits :: ResourceLimit -> ResourceLimits
[softLimit, hardLimit] :: ResourceLimits -> ResourceLimit
data Resource
ResourceCoreFileSize :: Resource
ResourceCPUTime :: Resource
ResourceDataSize :: Resource
ResourceFileSize :: Resource
ResourceOpenFiles :: Resource
ResourceStackSize :: Resource
ResourceTotalMemory :: Resource
getResourceLimit :: Resource -> IO ResourceLimits
setResourceLimit :: Resource -> ResourceLimits -> IO ()
instance GHC.Show.Show System.Posix.Resource.Resource
instance GHC.Classes.Eq System.Posix.Resource.Resource
instance GHC.Show.Show System.Posix.Resource.ResourceLimit
instance GHC.Classes.Eq System.Posix.Resource.ResourceLimit
instance GHC.Show.Show System.Posix.Resource.ResourceLimits
instance GHC.Classes.Eq System.Posix.Resource.ResourceLimits
-- | POSIX named semaphore support.
module System.Posix.Semaphore
data OpenSemFlags
OpenSemFlags :: Bool -> Bool -> OpenSemFlags
-- | If true, create the semaphore if it does not yet exist.
[semCreate] :: OpenSemFlags -> Bool
-- | If true, throw an exception if the semaphore already exists.
[semExclusive] :: OpenSemFlags -> Bool
data Semaphore
-- | Open a named semaphore with the given name, flags, mode, and initial
-- value.
semOpen :: String -> OpenSemFlags -> FileMode -> Int -> IO Semaphore
-- | Delete the semaphore with the given name.
semUnlink :: String -> IO ()
-- | Lock the semaphore, blocking until it becomes available. Since this is
-- done through a system call, this will block the *entire runtime*, not
-- just the current thread. If this is not the behaviour you want, use
-- semThreadWait instead.
semWait :: Semaphore -> IO ()
-- | Lock the semaphore, blocking until it becomes available.
--
-- Unlike semWait, this wait operation can be interrupted with an
-- asynchronous exception (e.g. a call to throwTo from another
-- thread).
semWaitInterruptible :: Semaphore -> IO Bool
-- | Attempt to lock the semaphore without blocking. Immediately return
-- False if it is not available.
semTryWait :: Semaphore -> IO Bool
-- | Poll the semaphore until it is available, then lock it. Unlike
-- semWait, this will block only the current thread rather than the
-- entire process.
semThreadWait :: Semaphore -> IO ()
-- | Unlock the semaphore.
semPost :: Semaphore -> IO ()
-- | Return the semaphore's current value.
semGetValue :: Semaphore -> IO Int
-- | POSIX shared memory support.
module System.Posix.SharedMem
data ShmOpenFlags
ShmOpenFlags :: Bool -> Bool -> Bool -> Bool -> ShmOpenFlags
-- | If true, open the shm object read-write rather than read-only.
[shmReadWrite] :: ShmOpenFlags -> Bool
-- | If true, create the shm object if it does not exist.
[shmCreate] :: ShmOpenFlags -> Bool
-- | If true, throw an exception if the shm object already exists.
[shmExclusive] :: ShmOpenFlags -> Bool
-- | If true, wipe the contents of the shm object after opening it.
[shmTrunc] :: ShmOpenFlags -> Bool
-- | Open a shared memory object with the given name, flags, and mode.
shmOpen :: String -> ShmOpenFlags -> FileMode -> IO Fd
-- | Delete the shared memory object with the given name.
shmUnlink :: String -> IO ()
-- | POSIX signal support
module System.Posix.Signals
type Signal = CInt
nullSignal :: Signal
-- | Alias for sigABRT.
internalAbort :: Signal
-- | Process abort signal.
sigABRT :: CInt
-- | Alias for sigALRM.
realTimeAlarm :: Signal
-- | Alarm clock.
sigALRM :: CInt
-- | Alias for sigBUS.
busError :: Signal
-- | Access to an undefined portion of a memory object.
sigBUS :: CInt
-- | Alias for sigCHLD.
processStatusChanged :: Signal
-- | Child process terminated, stopped, or continued.
sigCHLD :: CInt
-- | Alias for sigCONT.
continueProcess :: Signal
-- | Continue executing, if stopped.
sigCONT :: CInt
-- | Alias for sigFPE.
floatingPointException :: Signal
-- | Erroneous arithmetic operation.
sigFPE :: CInt
-- | Alias for sigHUP.
lostConnection :: Signal
-- | Hangup.
sigHUP :: CInt
-- | Alias for sigILL.
illegalInstruction :: Signal
-- | Illegal instruction.
sigILL :: CInt
-- | Alias for sigINT.
keyboardSignal :: Signal
-- | Terminal interrupt signal.
sigINT :: CInt
-- | Alias for sigKILL.
killProcess :: Signal
-- | Kill (cannot be caught or ignored).
sigKILL :: CInt
-- | Alias for sigPIPE.
openEndedPipe :: Signal
-- | Write on a pipe with no one to read it.
sigPIPE :: CInt
-- | Alias for sigQUIT.
keyboardTermination :: Signal
-- | Terminal quit signal.
sigQUIT :: CInt
-- | Alias for sigSEGV.
segmentationViolation :: Signal
-- | Invalid memory reference.
sigSEGV :: CInt
-- | Alias for sigSTOP.
softwareStop :: Signal
-- | Stop executing (cannot be caught or ignored).
sigSTOP :: CInt
-- | Alias for sigTERM.
softwareTermination :: Signal
-- | Termination signal.
sigTERM :: CInt
-- | Alias for sigTSTP.
keyboardStop :: Signal
-- | Terminal stop signal.
sigTSTP :: CInt
-- | Alias for sigTTIN.
backgroundRead :: Signal
-- | Background process attempting read.
sigTTIN :: CInt
-- | Alias for sigTTOU.
backgroundWrite :: Signal
-- | Background process attempting write.
sigTTOU :: CInt
-- | Alias for sigUSR1.
userDefinedSignal1 :: Signal
-- | User-defined signal 1.
sigUSR1 :: CInt
-- | Alias for sigUSR2.
userDefinedSignal2 :: Signal
-- | User-defined signal 2.
sigUSR2 :: CInt
-- | Alias for sigPOLL.
pollableEvent :: Signal
-- | Pollable event.
sigPOLL :: CInt
-- | Alias for sigPROF.
profilingTimerExpired :: Signal
-- | Profiling timer expired.
sigPROF :: CInt
-- | Alias for sigSYS.
badSystemCall :: Signal
-- | Bad system call.
sigSYS :: CInt
-- | Alias for sigTRAP.
breakpointTrap :: Signal
-- | Trace/breakpoint trap.
sigTRAP :: CInt
-- | Alias for sigURG.
urgentDataAvailable :: Signal
-- | High bandwidth data is available at a socket.
sigURG :: CInt
-- | Alias for sigVTALRM.
virtualTimerExpired :: Signal
-- | Virtual timer expired.
sigVTALRM :: CInt
-- | Alias for sigXCPU.
cpuTimeLimitExceeded :: Signal
-- | CPU time limit exceeded.
sigXCPU :: CInt
-- | Alias for sigXFSZ.
fileSizeLimitExceeded :: Signal
-- | File size limit exceeded.
sigXFSZ :: CInt
-- | raiseSignal int calls kill to signal the current
-- process with interrupt signal int.
raiseSignal :: Signal -> IO ()
-- | signalProcess int pid calls kill to signal process
-- pid with interrupt signal int.
signalProcess :: Signal -> ProcessID -> IO ()
-- | signalProcessGroup int pgid calls kill to signal all
-- processes in group pgid with interrupt signal int.
signalProcessGroup :: Signal -> ProcessGroupID -> IO ()
-- | The actions to perform when a signal is received.
data Handler
-- | Sets the disposition of the signal to SIG_DFL, which means we
-- want the default action associated with the signal. For example, the
-- default action for SIGTERM (and various other signals) is to
-- terminate the process.
Default :: Handler
-- | Set the disposition of the signal to SIG_IGN, which means we
-- want to ignore the signal. Ignored signals will not be
-- delivered to the process, and if also blocked will not be added
-- to the pending set for later delivery (if/when unblocked). Some
-- signals (e.g. SIGSTOP and SIGKILL) cannot be caught
-- or ignored. not yet: | Hold
Ignore :: Handler
-- | signal handler is not reset
Catch :: IO () -> Handler
-- | signal handler is automatically reset (via SA_RESETHAND)
CatchOnce :: IO () -> Handler
CatchInfo :: (SignalInfo -> IO ()) -> Handler
CatchInfoOnce :: (SignalInfo -> IO ()) -> Handler
-- | Information about a received signal (derived from siginfo_t).
data SignalInfo
SignalInfo :: Signal -> Errno -> SignalSpecificInfo -> SignalInfo
[siginfoSignal] :: SignalInfo -> Signal
[siginfoError] :: SignalInfo -> Errno
[siginfoSpecific] :: SignalInfo -> SignalSpecificInfo
-- | Information specific to a particular type of signal (derived from
-- siginfo_t).
data SignalSpecificInfo
NoSignalSpecificInfo :: SignalSpecificInfo
SigChldInfo :: ProcessID -> UserID -> ProcessStatus -> SignalSpecificInfo
[siginfoPid] :: SignalSpecificInfo -> ProcessID
[siginfoUid] :: SignalSpecificInfo -> UserID
[siginfoStatus] :: SignalSpecificInfo -> ProcessStatus
-- | installHandler int handler iset calls sigaction to
-- install an interrupt handler for signal int. If
-- handler is Default, SIG_DFL is installed;
-- if handler is Ignore, SIG_IGN is installed;
-- if handler is Catch action, a handler is installed
-- which will invoke action in a new thread when (or shortly
-- after) the signal is received. If iset is Just s,
-- then the sa_mask of the sigaction structure is set
-- to s; otherwise it is cleared. The previously installed
-- signal handler for int is returned
installHandler :: Signal -> Handler -> Maybe SignalSet -> IO Handler
data SignalSet
emptySignalSet :: SignalSet
fullSignalSet :: SignalSet
-- | A set of signals reserved for use by the implementation. In GHC, this
-- will normally include either sigVTALRM or sigALRM.
reservedSignals :: SignalSet
addSignal :: Signal -> SignalSet -> SignalSet
infixr 9 `addSignal`
deleteSignal :: Signal -> SignalSet -> SignalSet
infixr 9 `deleteSignal`
inSignalSet :: Signal -> SignalSet -> Bool
-- | getSignalMask calls sigprocmask to determine the set
-- of interrupts which are currently being blocked.
getSignalMask :: IO SignalSet
-- | setSignalMask mask calls sigprocmask with
-- SIG_SETMASK to block all interrupts in mask.
setSignalMask :: SignalSet -> IO ()
-- | blockSignals mask calls sigprocmask with
-- SIG_BLOCK to add all interrupts in mask to the set
-- of blocked interrupts.
blockSignals :: SignalSet -> IO ()
-- | unblockSignals mask calls sigprocmask with
-- SIG_UNBLOCK to remove all interrupts in mask from
-- the set of blocked interrupts.
unblockSignals :: SignalSet -> IO ()
-- | scheduleAlarm i calls alarm to schedule a real time
-- alarm at least i seconds in the future.
scheduleAlarm :: Int -> IO Int
-- | getPendingSignals calls sigpending to obtain the set
-- of interrupts which have been received but are currently blocked.
getPendingSignals :: IO SignalSet
-- | awaitSignal iset suspends execution until an interrupt is
-- received. If iset is Just s, awaitSignal
-- calls sigsuspend, installing s as the new signal
-- mask before suspending execution; otherwise, it calls
-- sigsuspend with current signal mask. Note that RTS scheduler
-- signal (either virtualTimerExpired or realTimeAlarm)
-- could cause premature termination of this call. It might be necessary
-- to block that signal before invocation of awaitSignal with
-- blockSignals reservedSignals.
--
-- awaitSignal returns when signal was received and processed by
-- a signal handler, or if the signal could not be caught. If you have
-- installed any signal handlers with installHandler, it may be
-- wise to call yield directly after awaitSignal to
-- ensure that the signal handler runs as promptly as possible.
awaitSignal :: Maybe SignalSet -> IO ()
-- | Tells the system whether or not to set the SA_NOCLDSTOP flag
-- when installing new signal handlers.
setStoppedChildFlag :: Bool -> IO Bool
-- | Queries the current state of the stopped child flag.
queryStoppedChildFlag :: IO Bool
-- | non-POSIX signal support commonly available
module System.Posix.Signals.Exts
sigINFO :: CInt
sigWINCH :: CInt
infoEvent :: Signal
windowChange :: Signal
-- | POSIX temporary file and directory creation functions.
module System.Posix.Temp
-- | Make a unique filename and open it for reading/writing. The returned
-- FilePath is the (possibly relative) path of the created file,
-- which is padded with 6 random characters. The argument is the desired
-- prefix of the filepath of the temporary file to be created.
--
-- If you aren't using GHC or Hugs then this function simply wraps mktemp
-- and so shouldn't be considered safe.
mkstemp :: String -> IO (FilePath, Handle)
-- | Make a unique filename with a given prefix and suffix and open it for
-- reading/writing. The returned FilePath is the (possibly
-- relative) path of the created file, which contains 6 random characters
-- in between the prefix and suffix. The first argument is the desired
-- prefix of the filepath of the temporary file to be created. The second
-- argument is the suffix of the temporary file to be created.
--
-- If you are using as system that doesn't support the mkstemps glibc
-- function (supported in glibc > 2.11) then this function simply
-- throws an error.
mkstemps :: String -> String -> IO (FilePath, Handle)
-- | Make a unique directory. The returned FilePath is the path of
-- the created directory, which is padded with 6 random characters. The
-- argument is the desired prefix of the filepath of the temporary
-- directory to be created.
--
-- If you are using as system that doesn't support the mkdtemp glibc
-- function (supported in glibc > 2.1.91) then this function uses
-- mktemp and so shouldn't be considered safe.
mkdtemp :: String -> IO FilePath
-- | POSIX temporary file and directory creation functions.
module System.Posix.Temp.ByteString
-- | Make a unique filename and open it for reading/writing. The returned
-- RawFilePath is the (possibly relative) path of the created
-- file, which is padded with 6 random characters. The argument is the
-- desired prefix of the filepath of the temporary file to be created.
--
-- If you aren't using GHC or Hugs then this function simply wraps mktemp
-- and so shouldn't be considered safe.
mkstemp :: ByteString -> IO (RawFilePath, Handle)
-- | mkstemps - make a unique filename with a given prefix and
-- suffix and open it for reading/writing (only safe on GHC & Hugs).
-- The returned RawFilePath is the (possibly relative) path of the
-- created file, which contains 6 random characters in between the prefix
-- and suffix.
mkstemps :: ByteString -> ByteString -> IO (RawFilePath, Handle)
-- | Make a unique directory. The returned RawFilePath is the path
-- of the created directory, which is padded with 6 random characters.
-- The argument is the desired prefix of the filepath of the temporary
-- directory to be created.
--
-- If you aren't using GHC or Hugs then this function simply wraps mktemp
-- and so shouldn't be considered safe.
mkdtemp :: ByteString -> IO RawFilePath
-- | POSIX temporary file and directory creation functions.
module System.Posix.Temp.PosixString
-- | Make a unique filename and open it for reading/writing. The returned
-- PosixPath is the (possibly relative) path of the created file,
-- which is padded with 6 random characters. The argument is the desired
-- prefix of the filepath of the temporary file to be created.
--
-- If you aren't using GHC or Hugs then this function simply wraps mktemp
-- and so shouldn't be considered safe.
mkstemp :: PosixString -> IO (PosixPath, Handle)
-- | mkstemps - make a unique filename with a given prefix and
-- suffix and open it for reading/writing (only safe on GHC & Hugs).
-- The returned PosixPath is the (possibly relative) path of the
-- created file, which contains 6 random characters in between the prefix
-- and suffix.
mkstemps :: PosixString -> PosixString -> IO (PosixPath, Handle)
-- | Make a unique directory. The returned PosixPath is the path of
-- the created directory, which is padded with 6 random characters. The
-- argument is the desired prefix of the filepath of the temporary
-- directory to be created.
--
-- If you aren't using GHC or Hugs then this function simply wraps mktemp
-- and so shouldn't be considered safe.
mkdtemp :: PosixString -> IO PosixPath
-- | POSIX Terminal support
module System.Posix.Terminal.ByteString
data TerminalAttributes
-- | getTerminalAttributes fd calls tcgetattr to obtain
-- the TerminalAttributes associated with Fd
-- fd.
getTerminalAttributes :: Fd -> IO TerminalAttributes
data TerminalState
Immediately :: TerminalState
WhenDrained :: TerminalState
WhenFlushed :: TerminalState
-- | setTerminalAttributes fd attr ts calls tcsetattr to
-- change the TerminalAttributes associated with Fd
-- fd to attr, when the terminal is in the state
-- indicated by ts.
setTerminalAttributes :: Fd -> TerminalAttributes -> TerminalState -> IO ()
data TerminalMode
-- | BRKINT - Signal interrupt on break
InterruptOnBreak :: TerminalMode
-- | ICRNL - Map CR to NL on input
MapCRtoLF :: TerminalMode
-- | IGNBRK - Ignore break condition
IgnoreBreak :: TerminalMode
-- | IGNCR - Ignore CR
IgnoreCR :: TerminalMode
-- | IGNPAR - Ignore characters with parity errors
IgnoreParityErrors :: TerminalMode
-- | INLCR - Map NL to CR on input
MapLFtoCR :: TerminalMode
-- | INPCK - Enable input parity check
CheckParity :: TerminalMode
-- | ISTRIP - Strip character
StripHighBit :: TerminalMode
-- | IXANY - Enable any character to restart output
RestartOnAny :: TerminalMode
-- | IXOFF - Enable start/stop input control
StartStopInput :: TerminalMode
-- | IXON - Enable start/stop output control
StartStopOutput :: TerminalMode
-- | PARMRK - Mark parity errors
MarkParityErrors :: TerminalMode
-- | OPOST - Post-process output
ProcessOutput :: TerminalMode
-- | ONLCR - (XSI) Map NL to CR-NL on output
MapLFtoCRLF :: TerminalMode
-- | OCRNL - (XSI) Map CR to NL on output
OutputMapCRtoLF :: TerminalMode
-- | ONOCR - (XSI) No CR output at column 0
NoCRAtColumnZero :: TerminalMode
-- | ONLRET - (XSI) NL performs CR function
ReturnMeansLF :: TerminalMode
-- | TABDLY(TAB0) - (XSI) Select horizontal-tab delays: type 0
TabDelayMask0 :: TerminalMode
-- | TABDLY(TAB3) - (XSI) Select horizontal-tab delays: type 3
TabDelayMask3 :: TerminalMode
-- | CLOCAL - Ignore modem status lines
LocalMode :: TerminalMode
-- | CREAD - Enable receiver
ReadEnable :: TerminalMode
-- | CSTOPB - Send two stop bits, else one
TwoStopBits :: TerminalMode
-- | HUPCL - Hang up on last close
HangupOnClose :: TerminalMode
-- | PARENB - Parity enable
EnableParity :: TerminalMode
-- | PARODD - Odd parity, else even
OddParity :: TerminalMode
-- | ECHO - Enable echo
EnableEcho :: TerminalMode
-- | ECHOE - Echo erase character as error-correcting backspace
EchoErase :: TerminalMode
-- | ECHOK - Echo KILL
EchoKill :: TerminalMode
-- | ECHONL - Echo NL
EchoLF :: TerminalMode
-- | ICANON - Canonical input (erase and kill processing)
ProcessInput :: TerminalMode
-- | IEXTEN - Enable extended input character processing
ExtendedFunctions :: TerminalMode
-- | ISIG - Enable signals
KeyboardInterrupts :: TerminalMode
-- | NOFLSH - Disable flush after interrupt or quit
NoFlushOnInterrupt :: TerminalMode
-- | TOSTOP - Send SIGTTOU for background output
BackgroundWriteInterrupt :: TerminalMode
withoutMode :: TerminalAttributes -> TerminalMode -> TerminalAttributes
withMode :: TerminalAttributes -> TerminalMode -> TerminalAttributes
terminalMode :: TerminalMode -> TerminalAttributes -> Bool
bitsPerByte :: TerminalAttributes -> Int
withBits :: TerminalAttributes -> Int -> TerminalAttributes
data ControlCharacter
EndOfFile :: ControlCharacter
EndOfLine :: ControlCharacter
Erase :: ControlCharacter
Interrupt :: ControlCharacter
Kill :: ControlCharacter
Quit :: ControlCharacter
Start :: ControlCharacter
Stop :: ControlCharacter
Suspend :: ControlCharacter
controlChar :: TerminalAttributes -> ControlCharacter -> Maybe Char
withCC :: TerminalAttributes -> (ControlCharacter, Char) -> TerminalAttributes
withoutCC :: TerminalAttributes -> ControlCharacter -> TerminalAttributes
inputTime :: TerminalAttributes -> Int
withTime :: TerminalAttributes -> Int -> TerminalAttributes
minInput :: TerminalAttributes -> Int
withMinInput :: TerminalAttributes -> Int -> TerminalAttributes
-- | Serial line baudrate. The set of supported speeds is system-dependent.
-- Portable use of the provided pattern synonyms that are outside the
-- list mandated by POSIX requires #ifdef guards.
--
-- Applications may need to be prepared to encounter speeds not known at
-- compile time, these can be handled generically via the BaudRate
-- constructor. In other words, the provided pattern synonyms are not
-- necessarily a COMPLETE set.
--
-- All non-zero pseudo-terminal baud rates are functionally
-- equivalent, and the pty driver may accept any speed within a
-- suitable range. Requested speeds may be rounded up or down to fit into
-- the supported range.
newtype BaudRate
BaudRate :: CSpeed -> BaudRate
-- | Hang up
pattern B0 :: BaudRate
-- | 50 baud
pattern B50 :: BaudRate
-- | 75 baud
pattern B75 :: BaudRate
-- | 110 baud
pattern B110 :: BaudRate
-- |
-- - 5 baud
--
pattern B134 :: BaudRate
-- | 150 baud
pattern B150 :: BaudRate
-- | 200 baud
pattern B200 :: BaudRate
-- | 300 baud
pattern B300 :: BaudRate
-- | 600 baud
pattern B600 :: BaudRate
-- | 1200 baud
pattern B1200 :: BaudRate
-- | 1800 baud
pattern B1800 :: BaudRate
-- | 2400 baud
pattern B2400 :: BaudRate
-- | 4800 baud
pattern B4800 :: BaudRate
-- | 9600 baud
pattern B9600 :: BaudRate
-- | 19200 baud
pattern B19200 :: BaudRate
-- | 38400 baud
pattern B38400 :: BaudRate
-- | 57600 baud, non-POSIX system-dependent extension
pattern B57600 :: BaudRate
-- | 115200 baud, non-POSIX system-dependent extension
pattern B115200 :: BaudRate
-- | 230400 baud, non-POSIX system-dependent extension
pattern B230400 :: BaudRate
-- | 460800 baud, non-POSIX system-dependent extension
pattern B460800 :: BaudRate
-- | 500000 baud, non-POSIX system-dependent extension
pattern B500000 :: BaudRate
-- | 576000 baud, non-POSIX system-dependent extension
pattern B576000 :: BaudRate
-- | 921600 baud, non-POSIX system-dependent extension
pattern B921600 :: BaudRate
-- | 1000000 baud, non-POSIX system-dependent extension
pattern B1000000 :: BaudRate
-- | 1152000 baud, non-POSIX system-dependent extension
pattern B1152000 :: BaudRate
-- | 1500000 baud, non-POSIX system-dependent extension
pattern B1500000 :: BaudRate
-- | 2000000 baud, non-POSIX system-dependent extension
pattern B2000000 :: BaudRate
-- | 2500000 baud, non-POSIX system-dependent extension
pattern B2500000 :: BaudRate
-- | 3000000 baud, non-POSIX system-dependent extension
pattern B3000000 :: BaudRate
-- | 3500000 baud, non-POSIX system-dependent extension
pattern B3500000 :: BaudRate
-- | 4000000 baud, non-POSIX system-dependent extension
pattern B4000000 :: BaudRate
inputSpeed :: TerminalAttributes -> BaudRate
withInputSpeed :: TerminalAttributes -> BaudRate -> TerminalAttributes
outputSpeed :: TerminalAttributes -> BaudRate
withOutputSpeed :: TerminalAttributes -> BaudRate -> TerminalAttributes
-- | sendBreak fd duration calls tcsendbreak to transmit
-- a continuous stream of zero-valued bits on Fd fd for
-- the specified implementation-dependent duration.
sendBreak :: Fd -> Int -> IO ()
-- | drainOutput fd calls tcdrain to block until all
-- output written to Fd fd has been transmitted.
--
-- Throws IOError ("unsupported operation") if platform does not
-- provide tcdrain(3) (use #if HAVE_TCDRAIN CPP guard
-- to detect availability).
drainOutput :: Fd -> IO ()
data QueueSelector
InputQueue :: QueueSelector
OutputQueue :: QueueSelector
BothQueues :: QueueSelector
-- | discardData fd queues calls tcflush to discard
-- pending input and/or output for Fd fd, as indicated
-- by the QueueSelector queues.
discardData :: Fd -> QueueSelector -> IO ()
data FlowAction
-- | TCOOFF
SuspendOutput :: FlowAction
-- | TCOON
RestartOutput :: FlowAction
-- | TCIOFF
TransmitStop :: FlowAction
-- | TCION
TransmitStart :: FlowAction
-- | controlFlow fd action calls tcflow to control the
-- flow of data on Fd fd, as indicated by
-- action.
controlFlow :: Fd -> FlowAction -> IO ()
-- | getTerminalProcessGroupID fd calls tcgetpgrp to
-- obtain the ProcessGroupID of the foreground process group
-- associated with the terminal attached to Fd fd.
getTerminalProcessGroupID :: Fd -> IO ProcessGroupID
-- | setTerminalProcessGroupID fd pgid calls tcsetpgrp to
-- set the ProcessGroupID of the foreground process group
-- associated with the terminal attached to Fd fd to
-- pgid.
setTerminalProcessGroupID :: Fd -> ProcessGroupID -> IO ()
-- | queryTerminal fd calls isatty to determine whether
-- or not Fd fd is associated with a terminal.
queryTerminal :: Fd -> IO Bool
-- | getTerminalName fd calls ttyname to obtain a name
-- associated with the terminal for Fd fd. If
-- fd is associated with a terminal, getTerminalName
-- returns the name of the terminal.
getTerminalName :: Fd -> IO RawFilePath
-- | getControllingTerminalName calls ctermid to obtain a
-- name associated with the controlling terminal for the process. If a
-- controlling terminal exists, getControllingTerminalName
-- returns the name of the controlling terminal.
--
-- Throws IOError ("unsupported operation") if platform does not
-- provide ctermid(3) (use #if HAVE_CTERMID CPP guard
-- to detect availability).
getControllingTerminalName :: IO RawFilePath
-- | openPseudoTerminal creates a pseudoterminal (pty) pair, and
-- returns the newly created pair as a (master, slave)
-- tuple.
openPseudoTerminal :: IO (Fd, Fd)
-- | getSlaveTerminalName calls ptsname to obtain the
-- name of the slave terminal associated with a pseudoterminal pair. The
-- file descriptor to pass in must be that of the master.
getSlaveTerminalName :: Fd -> IO RawFilePath
-- | POSIX Terminal support
module System.Posix.Terminal
data TerminalAttributes
-- | getTerminalAttributes fd calls tcgetattr to obtain
-- the TerminalAttributes associated with Fd
-- fd.
getTerminalAttributes :: Fd -> IO TerminalAttributes
data TerminalState
Immediately :: TerminalState
WhenDrained :: TerminalState
WhenFlushed :: TerminalState
-- | setTerminalAttributes fd attr ts calls tcsetattr to
-- change the TerminalAttributes associated with Fd
-- fd to attr, when the terminal is in the state
-- indicated by ts.
setTerminalAttributes :: Fd -> TerminalAttributes -> TerminalState -> IO ()
data TerminalMode
-- | BRKINT - Signal interrupt on break
InterruptOnBreak :: TerminalMode
-- | ICRNL - Map CR to NL on input
MapCRtoLF :: TerminalMode
-- | IGNBRK - Ignore break condition
IgnoreBreak :: TerminalMode
-- | IGNCR - Ignore CR
IgnoreCR :: TerminalMode
-- | IGNPAR - Ignore characters with parity errors
IgnoreParityErrors :: TerminalMode
-- | INLCR - Map NL to CR on input
MapLFtoCR :: TerminalMode
-- | INPCK - Enable input parity check
CheckParity :: TerminalMode
-- | ISTRIP - Strip character
StripHighBit :: TerminalMode
-- | IXANY - Enable any character to restart output
RestartOnAny :: TerminalMode
-- | IXOFF - Enable start/stop input control
StartStopInput :: TerminalMode
-- | IXON - Enable start/stop output control
StartStopOutput :: TerminalMode
-- | PARMRK - Mark parity errors
MarkParityErrors :: TerminalMode
-- | OPOST - Post-process output
ProcessOutput :: TerminalMode
-- | ONLCR - (XSI) Map NL to CR-NL on output
MapLFtoCRLF :: TerminalMode
-- | OCRNL - (XSI) Map CR to NL on output
OutputMapCRtoLF :: TerminalMode
-- | ONOCR - (XSI) No CR output at column 0
NoCRAtColumnZero :: TerminalMode
-- | ONLRET - (XSI) NL performs CR function
ReturnMeansLF :: TerminalMode
-- | TABDLY(TAB0) - (XSI) Select horizontal-tab delays: type 0
TabDelayMask0 :: TerminalMode
-- | TABDLY(TAB3) - (XSI) Select horizontal-tab delays: type 3
TabDelayMask3 :: TerminalMode
-- | CLOCAL - Ignore modem status lines
LocalMode :: TerminalMode
-- | CREAD - Enable receiver
ReadEnable :: TerminalMode
-- | CSTOPB - Send two stop bits, else one
TwoStopBits :: TerminalMode
-- | HUPCL - Hang up on last close
HangupOnClose :: TerminalMode
-- | PARENB - Parity enable
EnableParity :: TerminalMode
-- | PARODD - Odd parity, else even
OddParity :: TerminalMode
-- | ECHO - Enable echo
EnableEcho :: TerminalMode
-- | ECHOE - Echo erase character as error-correcting backspace
EchoErase :: TerminalMode
-- | ECHOK - Echo KILL
EchoKill :: TerminalMode
-- | ECHONL - Echo NL
EchoLF :: TerminalMode
-- | ICANON - Canonical input (erase and kill processing)
ProcessInput :: TerminalMode
-- | IEXTEN - Enable extended input character processing
ExtendedFunctions :: TerminalMode
-- | ISIG - Enable signals
KeyboardInterrupts :: TerminalMode
-- | NOFLSH - Disable flush after interrupt or quit
NoFlushOnInterrupt :: TerminalMode
-- | TOSTOP - Send SIGTTOU for background output
BackgroundWriteInterrupt :: TerminalMode
withoutMode :: TerminalAttributes -> TerminalMode -> TerminalAttributes
withMode :: TerminalAttributes -> TerminalMode -> TerminalAttributes
terminalMode :: TerminalMode -> TerminalAttributes -> Bool
bitsPerByte :: TerminalAttributes -> Int
withBits :: TerminalAttributes -> Int -> TerminalAttributes
data ControlCharacter
EndOfFile :: ControlCharacter
EndOfLine :: ControlCharacter
Erase :: ControlCharacter
Interrupt :: ControlCharacter
Kill :: ControlCharacter
Quit :: ControlCharacter
Start :: ControlCharacter
Stop :: ControlCharacter
Suspend :: ControlCharacter
controlChar :: TerminalAttributes -> ControlCharacter -> Maybe Char
withCC :: TerminalAttributes -> (ControlCharacter, Char) -> TerminalAttributes
withoutCC :: TerminalAttributes -> ControlCharacter -> TerminalAttributes
inputTime :: TerminalAttributes -> Int
withTime :: TerminalAttributes -> Int -> TerminalAttributes
minInput :: TerminalAttributes -> Int
withMinInput :: TerminalAttributes -> Int -> TerminalAttributes
-- | Serial line baudrate. The set of supported speeds is system-dependent.
-- Portable use of the provided pattern synonyms that are outside the
-- list mandated by POSIX requires #ifdef guards.
--
-- Applications may need to be prepared to encounter speeds not known at
-- compile time, these can be handled generically via the BaudRate
-- constructor. In other words, the provided pattern synonyms are not
-- necessarily a COMPLETE set.
--
-- All non-zero pseudo-terminal baud rates are functionally
-- equivalent, and the pty driver may accept any speed within a
-- suitable range. Requested speeds may be rounded up or down to fit into
-- the supported range.
newtype BaudRate
BaudRate :: CSpeed -> BaudRate
-- | Hang up
pattern B0 :: BaudRate
-- | 50 baud
pattern B50 :: BaudRate
-- | 75 baud
pattern B75 :: BaudRate
-- | 110 baud
pattern B110 :: BaudRate
-- |
-- - 5 baud
--
pattern B134 :: BaudRate
-- | 150 baud
pattern B150 :: BaudRate
-- | 200 baud
pattern B200 :: BaudRate
-- | 300 baud
pattern B300 :: BaudRate
-- | 600 baud
pattern B600 :: BaudRate
-- | 1200 baud
pattern B1200 :: BaudRate
-- | 1800 baud
pattern B1800 :: BaudRate
-- | 2400 baud
pattern B2400 :: BaudRate
-- | 4800 baud
pattern B4800 :: BaudRate
-- | 9600 baud
pattern B9600 :: BaudRate
-- | 19200 baud
pattern B19200 :: BaudRate
-- | 38400 baud
pattern B38400 :: BaudRate
-- | 57600 baud, non-POSIX system-dependent extension
pattern B57600 :: BaudRate
-- | 115200 baud, non-POSIX system-dependent extension
pattern B115200 :: BaudRate
-- | 230400 baud, non-POSIX system-dependent extension
pattern B230400 :: BaudRate
-- | 460800 baud, non-POSIX system-dependent extension
pattern B460800 :: BaudRate
-- | 500000 baud, non-POSIX system-dependent extension
pattern B500000 :: BaudRate
-- | 576000 baud, non-POSIX system-dependent extension
pattern B576000 :: BaudRate
-- | 921600 baud, non-POSIX system-dependent extension
pattern B921600 :: BaudRate
-- | 1000000 baud, non-POSIX system-dependent extension
pattern B1000000 :: BaudRate
-- | 1152000 baud, non-POSIX system-dependent extension
pattern B1152000 :: BaudRate
-- | 1500000 baud, non-POSIX system-dependent extension
pattern B1500000 :: BaudRate
-- | 2000000 baud, non-POSIX system-dependent extension
pattern B2000000 :: BaudRate
-- | 2500000 baud, non-POSIX system-dependent extension
pattern B2500000 :: BaudRate
-- | 3000000 baud, non-POSIX system-dependent extension
pattern B3000000 :: BaudRate
-- | 3500000 baud, non-POSIX system-dependent extension
pattern B3500000 :: BaudRate
-- | 4000000 baud, non-POSIX system-dependent extension
pattern B4000000 :: BaudRate
inputSpeed :: TerminalAttributes -> BaudRate
withInputSpeed :: TerminalAttributes -> BaudRate -> TerminalAttributes
outputSpeed :: TerminalAttributes -> BaudRate
withOutputSpeed :: TerminalAttributes -> BaudRate -> TerminalAttributes
-- | sendBreak fd duration calls tcsendbreak to transmit
-- a continuous stream of zero-valued bits on Fd fd for
-- the specified implementation-dependent duration.
sendBreak :: Fd -> Int -> IO ()
-- | drainOutput fd calls tcdrain to block until all
-- output written to Fd fd has been transmitted.
--
-- Throws IOError ("unsupported operation") if platform does not
-- provide tcdrain(3) (use #if HAVE_TCDRAIN CPP guard
-- to detect availability).
drainOutput :: Fd -> IO ()
data QueueSelector
InputQueue :: QueueSelector
OutputQueue :: QueueSelector
BothQueues :: QueueSelector
-- | discardData fd queues calls tcflush to discard
-- pending input and/or output for Fd fd, as indicated
-- by the QueueSelector queues.
discardData :: Fd -> QueueSelector -> IO ()
data FlowAction
-- | TCOOFF
SuspendOutput :: FlowAction
-- | TCOON
RestartOutput :: FlowAction
-- | TCIOFF
TransmitStop :: FlowAction
-- | TCION
TransmitStart :: FlowAction
-- | controlFlow fd action calls tcflow to control the
-- flow of data on Fd fd, as indicated by
-- action.
controlFlow :: Fd -> FlowAction -> IO ()
-- | getTerminalProcessGroupID fd calls tcgetpgrp to
-- obtain the ProcessGroupID of the foreground process group
-- associated with the terminal attached to Fd fd.
getTerminalProcessGroupID :: Fd -> IO ProcessGroupID
-- | setTerminalProcessGroupID fd pgid calls tcsetpgrp to
-- set the ProcessGroupID of the foreground process group
-- associated with the terminal attached to Fd fd to
-- pgid.
setTerminalProcessGroupID :: Fd -> ProcessGroupID -> IO ()
-- | queryTerminal fd calls isatty to determine whether
-- or not Fd fd is associated with a terminal.
queryTerminal :: Fd -> IO Bool
-- | getTerminalName fd calls ttyname to obtain a name
-- associated with the terminal for Fd fd. If
-- fd is associated with a terminal, getTerminalName
-- returns the name of the terminal.
getTerminalName :: Fd -> IO FilePath
-- | getControllingTerminalName calls ctermid to obtain a
-- name associated with the controlling terminal for the process. If a
-- controlling terminal exists, getControllingTerminalName
-- returns the name of the controlling terminal.
--
-- Throws IOError ("unsupported operation") if platform does not
-- provide ctermid(3) (use #if HAVE_CTERMID CPP guard
-- to detect availability).
getControllingTerminalName :: IO FilePath
-- | openPseudoTerminal creates a pseudoterminal (pty) pair, and
-- returns the newly created pair as a (master, slave)
-- tuple.
openPseudoTerminal :: IO (Fd, Fd)
-- | getSlaveTerminalName calls ptsname to obtain the
-- name of the slave terminal associated with a pseudoterminal pair. The
-- file descriptor to pass in must be that of the master.
getSlaveTerminalName :: Fd -> IO FilePath
-- | POSIX Terminal support
module System.Posix.Terminal.PosixString
data TerminalAttributes
-- | getTerminalAttributes fd calls tcgetattr to obtain
-- the TerminalAttributes associated with Fd
-- fd.
getTerminalAttributes :: Fd -> IO TerminalAttributes
data TerminalState
Immediately :: TerminalState
WhenDrained :: TerminalState
WhenFlushed :: TerminalState
-- | setTerminalAttributes fd attr ts calls tcsetattr to
-- change the TerminalAttributes associated with Fd
-- fd to attr, when the terminal is in the state
-- indicated by ts.
setTerminalAttributes :: Fd -> TerminalAttributes -> TerminalState -> IO ()
data TerminalMode
-- | BRKINT - Signal interrupt on break
InterruptOnBreak :: TerminalMode
-- | ICRNL - Map CR to NL on input
MapCRtoLF :: TerminalMode
-- | IGNBRK - Ignore break condition
IgnoreBreak :: TerminalMode
-- | IGNCR - Ignore CR
IgnoreCR :: TerminalMode
-- | IGNPAR - Ignore characters with parity errors
IgnoreParityErrors :: TerminalMode
-- | INLCR - Map NL to CR on input
MapLFtoCR :: TerminalMode
-- | INPCK - Enable input parity check
CheckParity :: TerminalMode
-- | ISTRIP - Strip character
StripHighBit :: TerminalMode
-- | IXANY - Enable any character to restart output
RestartOnAny :: TerminalMode
-- | IXOFF - Enable start/stop input control
StartStopInput :: TerminalMode
-- | IXON - Enable start/stop output control
StartStopOutput :: TerminalMode
-- | PARMRK - Mark parity errors
MarkParityErrors :: TerminalMode
-- | OPOST - Post-process output
ProcessOutput :: TerminalMode
-- | ONLCR - (XSI) Map NL to CR-NL on output
MapLFtoCRLF :: TerminalMode
-- | OCRNL - (XSI) Map CR to NL on output
OutputMapCRtoLF :: TerminalMode
-- | ONOCR - (XSI) No CR output at column 0
NoCRAtColumnZero :: TerminalMode
-- | ONLRET - (XSI) NL performs CR function
ReturnMeansLF :: TerminalMode
-- | TABDLY(TAB0) - (XSI) Select horizontal-tab delays: type 0
TabDelayMask0 :: TerminalMode
-- | TABDLY(TAB3) - (XSI) Select horizontal-tab delays: type 3
TabDelayMask3 :: TerminalMode
-- | CLOCAL - Ignore modem status lines
LocalMode :: TerminalMode
-- | CREAD - Enable receiver
ReadEnable :: TerminalMode
-- | CSTOPB - Send two stop bits, else one
TwoStopBits :: TerminalMode
-- | HUPCL - Hang up on last close
HangupOnClose :: TerminalMode
-- | PARENB - Parity enable
EnableParity :: TerminalMode
-- | PARODD - Odd parity, else even
OddParity :: TerminalMode
-- | ECHO - Enable echo
EnableEcho :: TerminalMode
-- | ECHOE - Echo erase character as error-correcting backspace
EchoErase :: TerminalMode
-- | ECHOK - Echo KILL
EchoKill :: TerminalMode
-- | ECHONL - Echo NL
EchoLF :: TerminalMode
-- | ICANON - Canonical input (erase and kill processing)
ProcessInput :: TerminalMode
-- | IEXTEN - Enable extended input character processing
ExtendedFunctions :: TerminalMode
-- | ISIG - Enable signals
KeyboardInterrupts :: TerminalMode
-- | NOFLSH - Disable flush after interrupt or quit
NoFlushOnInterrupt :: TerminalMode
-- | TOSTOP - Send SIGTTOU for background output
BackgroundWriteInterrupt :: TerminalMode
withoutMode :: TerminalAttributes -> TerminalMode -> TerminalAttributes
withMode :: TerminalAttributes -> TerminalMode -> TerminalAttributes
terminalMode :: TerminalMode -> TerminalAttributes -> Bool
bitsPerByte :: TerminalAttributes -> Int
withBits :: TerminalAttributes -> Int -> TerminalAttributes
data ControlCharacter
EndOfFile :: ControlCharacter
EndOfLine :: ControlCharacter
Erase :: ControlCharacter
Interrupt :: ControlCharacter
Kill :: ControlCharacter
Quit :: ControlCharacter
Start :: ControlCharacter
Stop :: ControlCharacter
Suspend :: ControlCharacter
controlChar :: TerminalAttributes -> ControlCharacter -> Maybe Char
withCC :: TerminalAttributes -> (ControlCharacter, Char) -> TerminalAttributes
withoutCC :: TerminalAttributes -> ControlCharacter -> TerminalAttributes
inputTime :: TerminalAttributes -> Int
withTime :: TerminalAttributes -> Int -> TerminalAttributes
minInput :: TerminalAttributes -> Int
withMinInput :: TerminalAttributes -> Int -> TerminalAttributes
-- | Serial line baudrate. The set of supported speeds is system-dependent.
-- Portable use of the provided pattern synonyms that are outside the
-- list mandated by POSIX requires #ifdef guards.
--
-- Applications may need to be prepared to encounter speeds not known at
-- compile time, these can be handled generically via the BaudRate
-- constructor. In other words, the provided pattern synonyms are not
-- necessarily a COMPLETE set.
--
-- All non-zero pseudo-terminal baud rates are functionally
-- equivalent, and the pty driver may accept any speed within a
-- suitable range. Requested speeds may be rounded up or down to fit into
-- the supported range.
newtype BaudRate
BaudRate :: CSpeed -> BaudRate
-- | Hang up
pattern B0 :: BaudRate
-- | 50 baud
pattern B50 :: BaudRate
-- | 75 baud
pattern B75 :: BaudRate
-- | 110 baud
pattern B110 :: BaudRate
-- |
-- - 5 baud
--
pattern B134 :: BaudRate
-- | 150 baud
pattern B150 :: BaudRate
-- | 200 baud
pattern B200 :: BaudRate
-- | 300 baud
pattern B300 :: BaudRate
-- | 600 baud
pattern B600 :: BaudRate
-- | 1200 baud
pattern B1200 :: BaudRate
-- | 1800 baud
pattern B1800 :: BaudRate
-- | 2400 baud
pattern B2400 :: BaudRate
-- | 4800 baud
pattern B4800 :: BaudRate
-- | 9600 baud
pattern B9600 :: BaudRate
-- | 19200 baud
pattern B19200 :: BaudRate
-- | 38400 baud
pattern B38400 :: BaudRate
-- | 57600 baud, non-POSIX system-dependent extension
pattern B57600 :: BaudRate
-- | 115200 baud, non-POSIX system-dependent extension
pattern B115200 :: BaudRate
-- | 230400 baud, non-POSIX system-dependent extension
pattern B230400 :: BaudRate
-- | 460800 baud, non-POSIX system-dependent extension
pattern B460800 :: BaudRate
-- | 500000 baud, non-POSIX system-dependent extension
pattern B500000 :: BaudRate
-- | 576000 baud, non-POSIX system-dependent extension
pattern B576000 :: BaudRate
-- | 921600 baud, non-POSIX system-dependent extension
pattern B921600 :: BaudRate
-- | 1000000 baud, non-POSIX system-dependent extension
pattern B1000000 :: BaudRate
-- | 1152000 baud, non-POSIX system-dependent extension
pattern B1152000 :: BaudRate
-- | 1500000 baud, non-POSIX system-dependent extension
pattern B1500000 :: BaudRate
-- | 2000000 baud, non-POSIX system-dependent extension
pattern B2000000 :: BaudRate
-- | 2500000 baud, non-POSIX system-dependent extension
pattern B2500000 :: BaudRate
-- | 3000000 baud, non-POSIX system-dependent extension
pattern B3000000 :: BaudRate
-- | 3500000 baud, non-POSIX system-dependent extension
pattern B3500000 :: BaudRate
-- | 4000000 baud, non-POSIX system-dependent extension
pattern B4000000 :: BaudRate
inputSpeed :: TerminalAttributes -> BaudRate
withInputSpeed :: TerminalAttributes -> BaudRate -> TerminalAttributes
outputSpeed :: TerminalAttributes -> BaudRate
withOutputSpeed :: TerminalAttributes -> BaudRate -> TerminalAttributes
-- | sendBreak fd duration calls tcsendbreak to transmit
-- a continuous stream of zero-valued bits on Fd fd for
-- the specified implementation-dependent duration.
sendBreak :: Fd -> Int -> IO ()
-- | drainOutput fd calls tcdrain to block until all
-- output written to Fd fd has been transmitted.
--
-- Throws IOError ("unsupported operation") if platform does not
-- provide tcdrain(3) (use #if HAVE_TCDRAIN CPP guard
-- to detect availability).
drainOutput :: Fd -> IO ()
data QueueSelector
InputQueue :: QueueSelector
OutputQueue :: QueueSelector
BothQueues :: QueueSelector
-- | discardData fd queues calls tcflush to discard
-- pending input and/or output for Fd fd, as indicated
-- by the QueueSelector queues.
discardData :: Fd -> QueueSelector -> IO ()
data FlowAction
-- | TCOOFF
SuspendOutput :: FlowAction
-- | TCOON
RestartOutput :: FlowAction
-- | TCIOFF
TransmitStop :: FlowAction
-- | TCION
TransmitStart :: FlowAction
-- | controlFlow fd action calls tcflow to control the
-- flow of data on Fd fd, as indicated by
-- action.
controlFlow :: Fd -> FlowAction -> IO ()
-- | getTerminalProcessGroupID fd calls tcgetpgrp to
-- obtain the ProcessGroupID of the foreground process group
-- associated with the terminal attached to Fd fd.
getTerminalProcessGroupID :: Fd -> IO ProcessGroupID
-- | setTerminalProcessGroupID fd pgid calls tcsetpgrp to
-- set the ProcessGroupID of the foreground process group
-- associated with the terminal attached to Fd fd to
-- pgid.
setTerminalProcessGroupID :: Fd -> ProcessGroupID -> IO ()
-- | queryTerminal fd calls isatty to determine whether
-- or not Fd fd is associated with a terminal.
queryTerminal :: Fd -> IO Bool
-- | getTerminalName fd calls ttyname to obtain a name
-- associated with the terminal for Fd fd. If
-- fd is associated with a terminal, getTerminalName
-- returns the name of the terminal.
getTerminalName :: Fd -> IO PosixPath
-- | getControllingTerminalName calls ctermid to obtain a
-- name associated with the controlling terminal for the process. If a
-- controlling terminal exists, getControllingTerminalName
-- returns the name of the controlling terminal.
--
-- Throws IOError ("unsupported operation") if platform does not
-- provide ctermid(3) (use #if HAVE_CTERMID CPP guard
-- to detect availability).
getControllingTerminalName :: IO PosixPath
-- | openPseudoTerminal creates a pseudoterminal (pty) pair, and
-- returns the newly created pair as a (master, slave)
-- tuple.
openPseudoTerminal :: IO (Fd, Fd)
-- | getSlaveTerminalName calls ptsname to obtain the
-- name of the slave terminal associated with a pseudoterminal pair. The
-- file descriptor to pass in must be that of the master.
getSlaveTerminalName :: Fd -> IO PosixPath
-- | POSIX Time support
module System.Posix.Time
-- | epochTime calls time to obtain the number of seconds
-- that have elapsed since the epoch (Jan 01 00:00:00 GMT 1970).
epochTime :: IO EpochTime
-- | POSIX miscellaneous stuff, mostly from unistd.h
module System.Posix.Unistd
data SystemID
SystemID :: String -> String -> String -> String -> String -> SystemID
[systemName] :: SystemID -> String
[nodeName] :: SystemID -> String
[release] :: SystemID -> String
[version] :: SystemID -> String
[machine] :: SystemID -> String
getSystemID :: IO SystemID
data SysVar
ArgumentLimit :: SysVar
ChildLimit :: SysVar
ClockTick :: SysVar
GroupLimit :: SysVar
OpenFileLimit :: SysVar
PosixVersion :: SysVar
HasSavedIDs :: SysVar
HasJobControl :: SysVar
getSysVar :: SysVar -> IO Integer
-- | Sleep for the specified duration (in seconds). Returns the time
-- remaining (if the sleep was interrupted by a signal, for example).
--
-- GHC Note: threadDelay is a better choice. Since GHC uses
-- signals for its internal clock, a call to sleep will usually be
-- interrupted immediately. That makes sleep unusable in a program
-- compiled with GHC, unless the RTS timer is disabled (with +RTS
-- -V0). Furthermore, without the -threaded option,
-- sleep will block all other user threads. Even with the
-- -threaded option, sleep requires a full OS thread to
-- itself. threadDelay has none of these shortcomings.
-- | Warning: This function has several shortcomings (see
-- documentation). Please consider using Control.Concurrent.threadDelay
-- instead.
sleep :: Int -> IO Int
-- | Sleep for the specified duration (in microseconds).
--
-- GHC Note: threadDelay is a better choice. Without the
-- -threaded option, usleep will block all other user
-- threads. Even with the -threaded option, usleep
-- requires a full OS thread to itself. threadDelay has neither of
-- these shortcomings.
usleep :: Int -> IO ()
-- | Sleep for the specified duration (in nanoseconds)
--
-- GHC Note: the comment for usleep also applies here.
nanosleep :: Integer -> IO ()
-- | Performs fsync(2) operation on file-descriptor.
--
-- Throws IOError ("unsupported operation") if platform does not
-- provide fsync(2) (use #if HAVE_FSYNC CPP guard to
-- detect availability).
fileSynchronise :: Fd -> IO ()
-- | Performs fdatasync(2) operation on file-descriptor.
--
-- Throws IOError ("unsupported operation") if platform does not
-- provide fdatasync(2) (use #if HAVE_FDATASYNC CPP
-- guard to detect availability).
fileSynchroniseDataOnly :: Fd -> IO ()
-- | POSIX user/group support
module System.Posix.User.ByteString
-- | getRealUserID calls getuid to obtain the real
-- UserID associated with the current process.
getRealUserID :: IO UserID
-- | getRealGroupID calls getgid to obtain the real
-- GroupID associated with the current process.
getRealGroupID :: IO GroupID
-- | getEffectiveUserID calls geteuid to obtain the
-- effective UserID associated with the current process.
getEffectiveUserID :: IO UserID
-- | getEffectiveGroupID calls getegid to obtain the
-- effective GroupID associated with the current process.
getEffectiveGroupID :: IO GroupID
-- | getGroups calls getgroups to obtain the list of
-- supplementary GroupIDs associated with the current process.
getGroups :: IO [GroupID]
-- | getLoginName calls getlogin to obtain the login name
-- associated with the current process.
getLoginName :: IO ByteString
-- | getEffectiveUserName gets the name associated with the
-- effective UserID of the process.
getEffectiveUserName :: IO ByteString
data GroupEntry
GroupEntry :: ByteString -> ByteString -> GroupID -> [ByteString] -> GroupEntry
-- | The name of this group (gr_name)
[groupName] :: GroupEntry -> ByteString
-- | The password for this group (gr_passwd)
[groupPassword] :: GroupEntry -> ByteString
-- | The unique numeric ID for this group (gr_gid)
[groupID] :: GroupEntry -> GroupID
-- | A list of zero or more usernames that are members (gr_mem)
[groupMembers] :: GroupEntry -> [ByteString]
-- | getGroupEntryForID gid calls getgrgid_r to obtain
-- the GroupEntry information associated with GroupID
-- gid. This operation may fail with isDoesNotExistError
-- if no such group exists.
getGroupEntryForID :: GroupID -> IO GroupEntry
-- | getGroupEntryForName name calls getgrnam_r to obtain
-- the GroupEntry information associated with the group called
-- name. This operation may fail with isDoesNotExistError
-- if no such group exists.
getGroupEntryForName :: ByteString -> IO GroupEntry
-- | getAllGroupEntries returns all group entries on the system by
-- repeatedly calling getgrent
getAllGroupEntries :: IO [GroupEntry]
data UserEntry
UserEntry :: ByteString -> ByteString -> UserID -> GroupID -> ByteString -> ByteString -> ByteString -> UserEntry
-- | Textual name of this user (pw_name)
[userName] :: UserEntry -> ByteString
-- | Password -- may be empty or fake if shadow is in use (pw_passwd)
[userPassword] :: UserEntry -> ByteString
-- | Numeric ID for this user (pw_uid)
[userID] :: UserEntry -> UserID
-- | Primary group ID (pw_gid)
[userGroupID] :: UserEntry -> GroupID
-- | Usually the real name for the user (pw_gecos)
[userGecos] :: UserEntry -> ByteString
-- | Home directory (pw_dir)
[homeDirectory] :: UserEntry -> ByteString
-- | Default shell (pw_shell)
[userShell] :: UserEntry -> ByteString
-- | getUserEntryForID uid calls getpwuid_r to obtain the
-- UserEntry information associated with UserID
-- uid. This operation may fail with isDoesNotExistError
-- if no such user exists.
getUserEntryForID :: UserID -> IO UserEntry
-- | getUserEntryForName name calls getpwnam_r to obtain
-- the UserEntry information associated with the user login
-- name. This operation may fail with isDoesNotExistError
-- if no such user exists.
getUserEntryForName :: ByteString -> IO UserEntry
-- | getAllUserEntries returns all user entries on the system by
-- repeatedly calling getpwent
getAllUserEntries :: IO [UserEntry]
-- | setUserID uid calls setuid to set the real,
-- effective, and saved set-user-id associated with the current process
-- to uid.
setUserID :: UserID -> IO ()
-- | setGroupID gid calls setgid to set the real,
-- effective, and saved set-group-id associated with the current process
-- to gid.
setGroupID :: GroupID -> IO ()
-- | setEffectiveUserID uid calls seteuid to set the
-- effective user-id associated with the current process to uid.
-- This does not update the real user-id or set-user-id.
setEffectiveUserID :: UserID -> IO ()
-- | setEffectiveGroupID uid calls setegid to set the
-- effective group-id associated with the current process to
-- gid. This does not update the real group-id or set-group-id.
setEffectiveGroupID :: GroupID -> IO ()
-- | setGroups calls setgroups to set the list of
-- supplementary GroupIDs associated with the current process.
setGroups :: [GroupID] -> IO ()
-- | POSIX user/group support
module System.Posix.User
-- | getRealUserID calls getuid to obtain the real
-- UserID associated with the current process.
getRealUserID :: IO UserID
-- | getRealGroupID calls getgid to obtain the real
-- GroupID associated with the current process.
getRealGroupID :: IO GroupID
-- | getEffectiveUserID calls geteuid to obtain the
-- effective UserID associated with the current process.
getEffectiveUserID :: IO UserID
-- | getEffectiveGroupID calls getegid to obtain the
-- effective GroupID associated with the current process.
getEffectiveGroupID :: IO GroupID
-- | getGroups calls getgroups to obtain the list of
-- supplementary GroupIDs associated with the current process.
getGroups :: IO [GroupID]
-- | getLoginName calls getlogin to obtain the login name
-- associated with the current process.
getLoginName :: IO String
-- | getEffectiveUserName gets the name associated with the
-- effective UserID of the process.
getEffectiveUserName :: IO String
groupName :: GroupEntry -> String
groupPassword :: GroupEntry -> String
groupID :: GroupEntry -> GroupID
groupMembers :: GroupEntry -> [String]
-- | Manually constructing GroupEntry in String modules is
-- discouraged. It will truncate Chars to 8bit. Use ByteString
-- instead.
pattern GroupEntry :: String -> String -> GroupID -> [String] -> GroupEntry
-- | getGroupEntryForID gid calls getgrgid_r to obtain
-- the GroupEntry information associated with GroupID
-- gid. This operation may fail with isDoesNotExistError
-- if no such group exists.
getGroupEntryForID :: GroupID -> IO GroupEntry
-- | getGroupEntryForName name calls getgrnam_r to obtain
-- the GroupEntry information associated with the group called
-- name. This operation may fail with isDoesNotExistError
-- if no such group exists.
getGroupEntryForName :: String -> IO GroupEntry
-- | getAllGroupEntries returns all group entries on the system by
-- repeatedly calling getgrent
getAllGroupEntries :: IO [GroupEntry]
userName :: UserEntry -> String
userPassword :: UserEntry -> String
userID :: UserEntry -> UserID
userGroupID :: UserEntry -> GroupID
userGecos :: UserEntry -> String
homeDirectory :: UserEntry -> String
userShell :: UserEntry -> String
-- | Manually constructing UserEntry in String modules is
-- discouraged. It will truncate Chars to 8bit. Use ByteString
-- instead.
pattern UserEntry :: String -> String -> UserID -> GroupID -> String -> String -> String -> UserEntry
-- | getUserEntryForID uid calls getpwuid_r to obtain the
-- UserEntry information associated with UserID
-- uid. This operation may fail with isDoesNotExistError
-- if no such user exists.
getUserEntryForID :: UserID -> IO UserEntry
-- | getUserEntryForName name calls getpwnam_r to obtain
-- the UserEntry information associated with the user login
-- name. This operation may fail with isDoesNotExistError
-- if no such user exists.
getUserEntryForName :: String -> IO UserEntry
-- | getAllUserEntries returns all user entries on the system by
-- repeatedly calling getpwent
getAllUserEntries :: IO [UserEntry]
-- | setUserID uid calls setuid to set the real,
-- effective, and saved set-user-id associated with the current process
-- to uid.
setUserID :: UserID -> IO ()
-- | setGroupID gid calls setgid to set the real,
-- effective, and saved set-group-id associated with the current process
-- to gid.
setGroupID :: GroupID -> IO ()
-- | setEffectiveUserID uid calls seteuid to set the
-- effective user-id associated with the current process to uid.
-- This does not update the real user-id or set-user-id.
setEffectiveUserID :: UserID -> IO ()
-- | setEffectiveGroupID uid calls setegid to set the
-- effective group-id associated with the current process to
-- gid. This does not update the real group-id or set-group-id.
setEffectiveGroupID :: GroupID -> IO ()
-- | setGroups calls setgroups to set the list of
-- supplementary GroupIDs associated with the current process.
setGroups :: [GroupID] -> IO ()
-- | POSIX.1-2008 support with ByteString file paths and
-- environment strings.
--
-- This module exports exactly the same API as System.Posix,
-- except that all file paths and environment strings are represented by
-- ByteString instead of String. The System.Posix
-- API implicitly translates all file paths and environment strings using
-- the locale encoding, whereas this version of the API does no encoding
-- or decoding and works directly in terms of raw bytes.
--
-- Note that if you do need to interpret file paths or environment
-- strings as text, then some Unicode encoding or decoding should be
-- applied first.
module System.Posix.PosixString
-- | Commonly used Posix string as uninterpreted char[] array.
data PosixString
-- | Filepaths are char[] data on unix as passed to syscalls.
type PosixPath = PosixString
-- | POSIX.1-2008 support with ByteString file paths and
-- environment strings.
--
-- This module exports exactly the same API as System.Posix,
-- except that all file paths and environment strings are represented by
-- ByteString instead of String. The System.Posix
-- API implicitly translates all file paths and environment strings using
-- the locale encoding, whereas this version of the API does no encoding
-- or decoding and works directly in terms of raw bytes.
--
-- Note that if you do need to interpret file paths or environment
-- strings as text, then some Unicode encoding or decoding should be
-- applied first.
module System.Posix.ByteString
-- | A literal POSIX file path
type RawFilePath = ByteString
-- | Flags for dlsym. Notice that Next might not be available
-- on your particular platform! Use haveRtldNext.
--
-- If RTLD_DEFAULT is not defined on your platform,
-- packDL Default reduces to nullPtr.
data DL
Null :: DL
Next :: DL
DLHandle :: Ptr () -> DL
-- | Flags for dlopen.
data RTLDFlags
RTLD_LAZY :: RTLDFlags
RTLD_NOW :: RTLDFlags
RTLD_GLOBAL :: RTLDFlags
RTLD_LOCAL :: RTLDFlags
c_dlclose :: Ptr () -> IO CInt
c_dlerror :: IO CString
c_dlsym :: Ptr () -> CString -> IO (FunPtr a)
c_dlopen :: CString -> CInt -> IO (Ptr ())
-- | On some hosts (e.g. SuSe and Ubuntu Linux) RTLD_NEXT (and
-- RTLD_DEFAULT) are not visible without setting the macro
-- _GNU_SOURCE. Since we don't want to define this macro, you
-- can use the function haveRtldNext to check whether the flag
-- Next is available. Ideally, this will be optimized by the
-- compiler so that it should be as efficient as an #ifdef.
--
-- If you fail to test the flag and use it although it is undefined,
-- packDL will throw an error.
haveRtldNext :: Bool
-- | Deprecated: defaults to True
haveRtldLocal :: Bool
packRTLDFlags :: [RTLDFlags] -> CInt
packDL :: DL -> Ptr ()
dlclose :: DL -> IO ()
dlerror :: IO String
-- | dlsym returns the address binding of the symbol described in
-- symbol, as it occurs in the shared object identified by
-- source.
dlsym :: DL -> String -> IO (FunPtr a)
-- | undl obtains the raw handle. You mustn't do something like
-- withDL mod flags $ liftM undl >>= p -> use p
undl :: DL -> Ptr ()
dlopen :: RawFilePath -> [RTLDFlags] -> IO DL
withDL :: RawFilePath -> [RTLDFlags] -> (DL -> IO a) -> IO a
withDL_ :: RawFilePath -> [RTLDFlags] -> (DL -> IO a) -> IO ()
-- | POSIX.1-2008 support
module System.Posix
-- | Flags for dlsym. Notice that Next might not be available
-- on your particular platform! Use haveRtldNext.
--
-- If RTLD_DEFAULT is not defined on your platform,
-- packDL Default reduces to nullPtr.
data DL
Null :: DL
Next :: DL
DLHandle :: Ptr () -> DL
-- | Flags for dlopen.
data RTLDFlags
RTLD_LAZY :: RTLDFlags
RTLD_NOW :: RTLDFlags
RTLD_GLOBAL :: RTLDFlags
RTLD_LOCAL :: RTLDFlags
c_dlclose :: Ptr () -> IO CInt
c_dlerror :: IO CString
c_dlsym :: Ptr () -> CString -> IO (FunPtr a)
c_dlopen :: CString -> CInt -> IO (Ptr ())
-- | On some hosts (e.g. SuSe and Ubuntu Linux) RTLD_NEXT (and
-- RTLD_DEFAULT) are not visible without setting the macro
-- _GNU_SOURCE. Since we don't want to define this macro, you
-- can use the function haveRtldNext to check whether the flag
-- Next is available. Ideally, this will be optimized by the
-- compiler so that it should be as efficient as an #ifdef.
--
-- If you fail to test the flag and use it although it is undefined,
-- packDL will throw an error.
haveRtldNext :: Bool
-- | Deprecated: defaults to True
haveRtldLocal :: Bool
packRTLDFlags :: [RTLDFlags] -> CInt
packDL :: DL -> Ptr ()
dlclose :: DL -> IO ()
dlerror :: IO String
-- | dlsym returns the address binding of the symbol described in
-- symbol, as it occurs in the shared object identified by
-- source.
dlsym :: DL -> String -> IO (FunPtr a)
-- | undl obtains the raw handle. You mustn't do something like
-- withDL mod flags $ liftM undl >>= p -> use p
undl :: DL -> Ptr ()
dlopen :: FilePath -> [RTLDFlags] -> IO DL
withDL :: FilePath -> [RTLDFlags] -> (DL -> IO a) -> IO a
withDL_ :: FilePath -> [RTLDFlags] -> (DL -> IO a) -> IO ()