-- 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.7.2.2
-- | 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 ()
-- | 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.
readDirStream :: DirStream -> IO 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 ()
-- | 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 wether 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.Show.Show System.Posix.DynamicLinker.Prim.DL
instance GHC.Read.Read System.Posix.DynamicLinker.Prim.RTLDFlags
instance GHC.Show.Show System.Posix.DynamicLinker.Prim.RTLDFlags
-- | 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 :: String -> [RTLDFlags] -> (DL -> IO a) -> IO a
withDL_ :: String -> [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 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)]
-- | 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 ()
-- | 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 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.
readDirStream :: DirStream -> IO 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.
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.
accessTimeHiRes :: FileStatus -> POSIXTime
-- | Time of last modification in sub-second resolution.
modificationTimeHiRes :: FileStatus -> POSIXTime
-- | Time of last status change (i.e. owner, group, link count, mode, etc.)
-- in sub-second resolution.
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 :: 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.
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.
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.
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.
data 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.
accessTimeHiRes :: FileStatus -> POSIXTime
-- | Time of last modification in sub-second resolution.
modificationTimeHiRes :: FileStatus -> POSIXTime
-- | Time of last status change (i.e. owner, group, link count, mode, etc.)
-- in sub-second resolution.
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 :: 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 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 :: 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.
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.
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.
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 -> OpenFileFlags
-- | O_APPEND
[append] :: OpenFileFlags -> Bool
-- | O_EXCL
[exclusive] :: OpenFileFlags -> Bool
-- | O_NOCTTY
[noctty] :: OpenFileFlags -> Bool
-- | O_NONBLOCK
[nonBlock] :: OpenFileFlags -> Bool
-- | O_TRUNC
[trunc] :: OpenFileFlags -> Bool
-- | Default values for the OpenFileFlags type. False for each of
-- append, exclusive, noctty, nonBlock, and trunc.
defaultFileFlags :: OpenFileFlags
-- | Open and optionally create this file. See Files for information
-- on how to use the FileMode type.
openFd :: RawFilePath -> OpenMode -> Maybe FileMode -> 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
-- | 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.
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.
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 -> OpenFileFlags
-- | O_APPEND
[append] :: OpenFileFlags -> Bool
-- | O_EXCL
[exclusive] :: OpenFileFlags -> Bool
-- | O_NOCTTY
[noctty] :: OpenFileFlags -> Bool
-- | O_NONBLOCK
[nonBlock] :: OpenFileFlags -> Bool
-- | O_TRUNC
[trunc] :: OpenFileFlags -> Bool
-- | Default values for the OpenFileFlags type. False for each of
-- append, exclusive, noctty, nonBlock, and trunc.
defaultFileFlags :: OpenFileFlags
-- | Open and optionally create this file. See Files for information
-- on how to use the FileMode type.
openFd :: FilePath -> OpenMode -> Maybe FileMode -> 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
-- | 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.
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.
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
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.
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.
exitImmediately :: ExitCode -> IO ()
-- | getProcessID calls getpid to obtain the
-- ProcessID for the current process.
getProcessID :: IO ProcessID
-- | getProcessID 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.
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.
exitImmediately :: ExitCode -> IO ()
-- | getProcessID calls getpid to obtain the
-- ProcessID for the current process.
getProcessID :: IO ProcessID
-- | getProcessID 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.Classes.Eq System.Posix.Resource.ResourceLimits
instance GHC.Classes.Eq System.Posix.Resource.ResourceLimit
instance GHC.Classes.Eq System.Posix.Resource.Resource
-- | 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 ()
-- | 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
internalAbort :: Signal
sigABRT :: CInt
realTimeAlarm :: Signal
sigALRM :: CInt
busError :: Signal
sigBUS :: CInt
processStatusChanged :: Signal
sigCHLD :: CInt
continueProcess :: Signal
sigCONT :: CInt
floatingPointException :: Signal
sigFPE :: CInt
lostConnection :: Signal
sigHUP :: CInt
illegalInstruction :: Signal
sigILL :: CInt
keyboardSignal :: Signal
sigINT :: CInt
killProcess :: Signal
sigKILL :: CInt
openEndedPipe :: Signal
sigPIPE :: CInt
keyboardTermination :: Signal
sigQUIT :: CInt
segmentationViolation :: Signal
sigSEGV :: CInt
softwareStop :: Signal
sigSTOP :: CInt
softwareTermination :: Signal
sigTERM :: CInt
keyboardStop :: Signal
sigTSTP :: CInt
backgroundRead :: Signal
sigTTIN :: CInt
backgroundWrite :: Signal
sigTTOU :: CInt
userDefinedSignal1 :: Signal
sigUSR1 :: CInt
userDefinedSignal2 :: Signal
sigUSR2 :: CInt
pollableEvent :: Signal
sigPOLL :: CInt
profilingTimerExpired :: Signal
sigPROF :: CInt
badSystemCall :: Signal
sigSYS :: CInt
breakpointTrap :: Signal
sigTRAP :: CInt
urgentDataAvailable :: Signal
sigURG :: CInt
virtualTimerExpired :: Signal
sigVTALRM :: CInt
cpuTimeLimitExceeded :: Signal
sigXCPU :: CInt
fileSizeLimitExceeded :: Signal
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
Default :: Handler
Ignore :: Handler
Catch :: (IO ()) -> Handler
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 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
InterruptOnBreak :: TerminalMode
MapCRtoLF :: TerminalMode
IgnoreBreak :: TerminalMode
IgnoreCR :: TerminalMode
IgnoreParityErrors :: TerminalMode
MapLFtoCR :: TerminalMode
CheckParity :: TerminalMode
StripHighBit :: TerminalMode
StartStopInput :: TerminalMode
StartStopOutput :: TerminalMode
MarkParityErrors :: TerminalMode
ProcessOutput :: TerminalMode
LocalMode :: TerminalMode
ReadEnable :: TerminalMode
TwoStopBits :: TerminalMode
HangupOnClose :: TerminalMode
EnableParity :: TerminalMode
OddParity :: TerminalMode
EnableEcho :: TerminalMode
EchoErase :: TerminalMode
EchoKill :: TerminalMode
EchoLF :: TerminalMode
ProcessInput :: TerminalMode
ExtendedFunctions :: TerminalMode
KeyboardInterrupts :: TerminalMode
NoFlushOnInterrupt :: TerminalMode
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
data BaudRate
B0 :: BaudRate
B50 :: BaudRate
B75 :: BaudRate
B110 :: BaudRate
B134 :: BaudRate
B150 :: BaudRate
B200 :: BaudRate
B300 :: BaudRate
B600 :: BaudRate
B1200 :: BaudRate
B1800 :: BaudRate
B2400 :: BaudRate
B4800 :: BaudRate
B9600 :: BaudRate
B19200 :: BaudRate
B38400 :: BaudRate
B57600 :: BaudRate
B115200 :: 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
InterruptOnBreak :: TerminalMode
MapCRtoLF :: TerminalMode
IgnoreBreak :: TerminalMode
IgnoreCR :: TerminalMode
IgnoreParityErrors :: TerminalMode
MapLFtoCR :: TerminalMode
CheckParity :: TerminalMode
StripHighBit :: TerminalMode
StartStopInput :: TerminalMode
StartStopOutput :: TerminalMode
MarkParityErrors :: TerminalMode
ProcessOutput :: TerminalMode
LocalMode :: TerminalMode
ReadEnable :: TerminalMode
TwoStopBits :: TerminalMode
HangupOnClose :: TerminalMode
EnableParity :: TerminalMode
OddParity :: TerminalMode
EnableEcho :: TerminalMode
EchoErase :: TerminalMode
EchoKill :: TerminalMode
EchoLF :: TerminalMode
ProcessInput :: TerminalMode
ExtendedFunctions :: TerminalMode
KeyboardInterrupts :: TerminalMode
NoFlushOnInterrupt :: TerminalMode
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
data BaudRate
B0 :: BaudRate
B50 :: BaudRate
B75 :: BaudRate
B110 :: BaudRate
B134 :: BaudRate
B150 :: BaudRate
B200 :: BaudRate
B300 :: BaudRate
B600 :: BaudRate
B1200 :: BaudRate
B1800 :: BaudRate
B2400 :: BaudRate
B4800 :: BaudRate
B9600 :: BaudRate
B19200 :: BaudRate
B38400 :: BaudRate
B57600 :: BaudRate
B115200 :: 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 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
-- | 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
data GroupEntry
GroupEntry :: String -> String -> GroupID -> [String] -> GroupEntry
-- | The name of this group (gr_name)
[groupName] :: GroupEntry -> String
-- | The password for this group (gr_passwd)
[groupPassword] :: GroupEntry -> String
-- | 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 -> [String]
-- | 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]
data UserEntry
UserEntry :: String -> String -> UserID -> GroupID -> String -> String -> String -> UserEntry
-- | Textual name of this user (pw_name)
[userName] :: UserEntry -> String
-- | Password -- may be empty or fake if shadow is in use (pw_passwd)
[userPassword] :: UserEntry -> String
-- | 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 -> String
-- | Home directory (pw_dir)
[homeDirectory] :: UserEntry -> String
-- | Default shell (pw_shell)
[userShell] :: UserEntry -> String
-- | getUserEntryForID gid 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 ()
instance GHC.Classes.Eq System.Posix.User.UserEntry
instance GHC.Read.Read System.Posix.User.UserEntry
instance GHC.Show.Show System.Posix.User.UserEntry
instance GHC.Classes.Eq System.Posix.User.GroupEntry
instance GHC.Read.Read System.Posix.User.GroupEntry
instance GHC.Show.Show System.Posix.User.GroupEntry
-- | 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 wether 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 wether 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 :: String -> [RTLDFlags] -> (DL -> IO a) -> IO a
withDL_ :: String -> [RTLDFlags] -> (DL -> IO a) -> IO ()