-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | POSIX functionality
°5u
°5uThis package gives you access to the set of operating system services
°5ustandardised by <a>POSIX.1-2008</a> (or the IEEE Portable Operating
°5uSystem Interface for Computing Environments - IEEE Std. 1003.1).
°5u
°5uThe 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 <a>throwErrno</a>, but exceptions include the given path when
°5uappropriate.
throwErrnoPath :: String -> RawFilePath -> IO a

-- | as <a>throwErrnoIf</a>, but exceptions include the given path when
°5uappropriate.
throwErrnoPathIf :: (a -> Bool) -> String -> RawFilePath -> IO a -> IO a

-- | as <a>throwErrnoIf_</a>, but exceptions include the given path when
°5uappropriate.
throwErrnoPathIf_ :: (a -> Bool) -> String -> RawFilePath -> IO a -> IO ()

-- | as <a>throwErrnoIfNull</a>, but exceptions include the given path when
°5uappropriate.
throwErrnoPathIfNull :: String -> RawFilePath -> IO (Ptr a) -> IO (Ptr a)

-- | as <a>throwErrnoIfMinus1</a>, but exceptions include the given path
°5uwhen appropriate.
throwErrnoPathIfMinus1 :: (Eq a, Num a) => String -> RawFilePath -> IO a -> IO a

-- | as <a>throwErrnoIfMinus1_</a>, but exceptions include the given path
°5uwhen appropriate.
throwErrnoPathIfMinus1_ :: (Eq a, Num a) => String -> RawFilePath -> IO a -> IO ()


-- | String-based POSIX directory support
module System.Posix.Directory.ByteString

-- | <tt>createDirectory dir mode</tt> calls <tt>mkdir</tt> to create a new
°5udirectory, <tt>dir</tt>, with permissions based on <tt>mode</tt>.
createDirectory :: RawFilePath -> FileMode -> IO ()
removeDirectory :: RawFilePath -> IO ()
data DirStream

-- | <tt>openDirStream dir</tt> calls <tt>opendir</tt> to obtain a
°5udirectory stream for <tt>dir</tt>.
openDirStream :: RawFilePath -> IO DirStream

-- | <tt>readDirStream dp</tt> calls <tt>readdir</tt> to obtain the next
°5udirectory entry (<tt>struct dirent</tt>) for the open directory stream
°5u<tt>dp</tt>, and returns the <tt>d_name</tt> member of that structure.
readDirStream :: DirStream -> IO RawFilePath

-- | <tt>rewindDirStream dp</tt> calls <tt>rewinddir</tt> to reposition the
°5udirectory stream <tt>dp</tt> at the beginning of the directory.
rewindDirStream :: DirStream -> IO ()

-- | <tt>closeDirStream dp</tt> calls <tt>closedir</tt> to close the
°5udirectory stream <tt>dp</tt>.
closeDirStream :: DirStream -> IO ()
data DirStreamOffset
tellDirStream :: DirStream -> IO DirStreamOffset
seekDirStream :: DirStream -> DirStreamOffset -> IO ()

-- | <tt>getWorkingDirectory</tt> calls <tt>getcwd</tt> to obtain the name
°5uof the current working directory.
getWorkingDirectory :: IO RawFilePath

-- | <tt>changeWorkingDirectory dir</tt> calls <tt>chdir</tt> to change the
°5ucurrent working directory to <tt>dir</tt>.
changeWorkingDirectory :: RawFilePath -> IO ()
changeWorkingDirectoryFd :: Fd -> IO ()


-- | <tt>dlopen(3)</tt> and friends Derived from <tt>GModule.chs</tt> by
°5uM.Weber &amp; M.Chakravarty which is part of c2hs. I left the API more
°5uor 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) <tt>RTLD_NEXT</tt> (and
°5u<tt>RTLD_DEFAULT</tt>) are not visible without setting the macro
°5u<tt>_GNU_SOURCE</tt>. Since we don't want to define this macro, you
°5ucan use the function <a>haveRtldNext</a> to check wether the flag
°5u<a>Next</a> is available. Ideally, this will be optimized by the
°5ucompiler so that it should be as efficient as an <tt>#ifdef</tt>.
°5u
°5uIf you fail to test the flag and use it although it is undefined,
°5u<a>packDL</a> will throw an error.
haveRtldNext :: Bool

-- | <i>Deprecated: defaults to True</i>
haveRtldLocal :: Bool
packRTLDFlags :: [RTLDFlags] -> CInt

-- | Flags for <a>dlopen</a>.
data RTLDFlags
RTLD_LAZY :: RTLDFlags
RTLD_NOW :: RTLDFlags
RTLD_GLOBAL :: RTLDFlags
RTLD_LOCAL :: RTLDFlags
packDL :: DL -> Ptr ()

-- | Flags for <a>dlsym</a>. Notice that <a>Next</a> might not be available
°5uon your particular platform! Use <a>haveRtldNext</a>.
°5u
°5uIf <tt>RTLD_DEFAULT</tt> is not defined on your platform,
°5u<a>packDL</a> <a>Default</a> reduces to <a>nullPtr</a>.
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

-- | <a>dlsym</a> returns the address binding of the symbol described in
°5u<tt>symbol</tt>, as it occurs in the shared object identified by
°5u<tt>source</tt>.
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 ()

-- | <a>undl</a> obtains the raw handle. You mustn't do something like
°5u<tt>withDL mod flags $ liftM undl &gt;&gt;= p -&gt; use p</tt>
undl :: DL -> Ptr ()


-- | Dynamic linker support through dlopen()
module System.Posix.DynamicLinker
dlopen :: FilePath -> [RTLDFlags] -> IO DL

-- | <a>dlsym</a> returns the address binding of the symbol described in
°5u<tt>symbol</tt>, as it occurs in the shared object identified by
°5u<tt>source</tt>.
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 ()

-- | <a>undl</a> obtains the raw handle. You mustn't do something like
°5u<tt>withDL mod flags $ liftM undl &gt;&gt;= p -&gt; use p</tt>
undl :: DL -> Ptr ()


-- | DLOpen support, old API Derived from GModule.chs by M.Weber &amp;
°5uM.Chakravarty which is part of c2hs I left the API more or less the
°5usame, 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 &amp;
°5uM.Chakravarty which is part of c2hs I left the API more or less the
°5usame, 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

-- | <a>getEnv</a> looks up a variable in the environment.
getEnv :: String -> IO (Maybe String)

-- | <a>getEnvDefault</a> is a wrapper around <a>getEnv</a> where the
°5uprogrammer can specify a fallback if the variable is not found in the
°5uenvironment.
getEnvDefault :: String -> String -> IO String
getEnvironmentPrim :: IO [String]

-- | <a>getEnvironment</a> retrieves the entire environment as a list of
°5u<tt>(key,value)</tt> pairs.
getEnvironment :: IO [(String, String)]

-- | <a>setEnvironment</a> resets the entire environment to the given list
°5uof <tt>(key,value)</tt> pairs.
setEnvironment :: [(String, String)] -> IO ()

-- | <a>putEnv</a> function takes an argument of the form
°5u<tt>name=value</tt> and is equivalent to
°5u<tt>setEnv(key,value,True{-overwrite-})</tt>.
putEnv :: String -> IO ()

-- | The <a>setEnv</a> function inserts or resets the environment variable
°5uname in the current environment list. If the variable <tt>name</tt>
°5udoes not exist in the list, it is inserted with the given value. If
°5uthe variable does exist, the argument <tt>overwrite</tt> is tested; if
°5u<tt>overwrite</tt> is <tt>False</tt>, the variable is not reset,
°5uotherwise it is reset to the given value.
setEnv :: String -> String -> Bool -> IO ()

-- | The <a>unsetEnv</a> function deletes all instances of the variable
°5uname from the environment.
unsetEnv :: String -> IO ()

-- | The <a>clearEnv</a> function clears the environment of all name-value
°5upairs.
clearEnv :: IO ()


-- | POSIX environment support
module System.Posix.Env.ByteString

-- | <a>getEnv</a> looks up a variable in the environment.
getEnv :: ByteString -> IO (Maybe ByteString)

-- | <a>getEnvDefault</a> is a wrapper around <a>getEnv</a> where the
°5uprogrammer can specify a fallback if the variable is not found in the
°5uenvironment.
getEnvDefault :: ByteString -> ByteString -> IO ByteString
getEnvironmentPrim :: IO [ByteString]

-- | <a>getEnvironment</a> retrieves the entire environment as a list of
°5u<tt>(key,value)</tt> pairs.
getEnvironment :: IO [(ByteString, ByteString)]

-- | <a>putEnv</a> function takes an argument of the form
°5u<tt>name=value</tt> and is equivalent to
°5u<tt>setEnv(key,value,True{-overwrite-})</tt>.
putEnv :: ByteString -> IO ()

-- | The <a>setEnv</a> function inserts or resets the environment variable
°5uname in the current environment list. If the variable <tt>name</tt>
°5udoes not exist in the list, it is inserted with the given value. If
°5uthe variable does exist, the argument <tt>overwrite</tt> is tested; if
°5u<tt>overwrite</tt> is <tt>False</tt>, the variable is not reset,
°5uotherwise it is reset to the given value.
setEnv :: ByteString -> ByteString -> Bool -> IO ()

-- | The <a>unsetEnv</a> function deletes all instances of the variable
°5uname from the environment.
unsetEnv :: ByteString -> IO ()

-- | Computation <a>getArgs</a> returns a list of the program's command
°5uline arguments (not including the program name), as
°5u<a>ByteString</a>s.
°5u
°5uUnlike <a>getArgs</a>, this function does no Unicode decoding of the
°5uarguments; you get the exact bytes that were passed to the program by
°5uthe OS. To interpret the arguments as text, some Unicode decoding
°5ushould be applied.
getArgs :: IO [ByteString]


-- | POSIX error support
module System.Posix.Error

-- | as <a>throwErrno</a>, but exceptions include the given path when
°5uappropriate.
throwErrnoPath :: () => String -> FilePath -> IO a

-- | as <a>throwErrnoIf</a>, but exceptions include the given path when
°5uappropriate.
throwErrnoPathIf :: () => a -> Bool -> String -> FilePath -> IO a -> IO a

-- | as <a>throwErrnoIf_</a>, but exceptions include the given path when
°5uappropriate.
throwErrnoPathIf_ :: () => a -> Bool -> String -> FilePath -> IO a -> IO ()
throwErrnoPathIfRetry :: (a -> Bool) -> String -> FilePath -> IO a -> IO a

-- | as <a>throwErrnoIfNull</a>, but exceptions include the given path when
°5uappropriate.
throwErrnoPathIfNull :: () => String -> FilePath -> IO Ptr a -> IO Ptr a
throwErrnoPathIfNullRetry :: String -> FilePath -> IO (Ptr a) -> IO (Ptr a)

-- | as <a>throwErrnoIfMinus1</a>, but exceptions include the given path
°5uwhen appropriate.
throwErrnoPathIfMinus1 :: (Eq a, Num a) => String -> FilePath -> IO a -> IO a

-- | as <a>throwErrnoIfMinus1_</a>, but exceptions include the given path
°5uwhen 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

-- | <tt>createDirectory dir mode</tt> calls <tt>mkdir</tt> to create a new
°5udirectory, <tt>dir</tt>, with permissions based on <tt>mode</tt>.
createDirectory :: FilePath -> FileMode -> IO ()
removeDirectory :: FilePath -> IO ()
data DirStream

-- | <tt>openDirStream dir</tt> calls <tt>opendir</tt> to obtain a
°5udirectory stream for <tt>dir</tt>.
openDirStream :: FilePath -> IO DirStream

-- | <tt>readDirStream dp</tt> calls <tt>readdir</tt> to obtain the next
°5udirectory entry (<tt>struct dirent</tt>) for the open directory stream
°5u<tt>dp</tt>, and returns the <tt>d_name</tt> member of that structure.
readDirStream :: DirStream -> IO FilePath

-- | <tt>rewindDirStream dp</tt> calls <tt>rewinddir</tt> to reposition the
°5udirectory stream <tt>dp</tt> at the beginning of the directory.
rewindDirStream :: DirStream -> IO ()

-- | <tt>closeDirStream dp</tt> calls <tt>closedir</tt> to close the
°5udirectory stream <tt>dp</tt>.
closeDirStream :: DirStream -> IO ()
data DirStreamOffset
tellDirStream :: DirStream -> IO DirStreamOffset
seekDirStream :: DirStream -> DirStreamOffset -> IO ()

-- | <tt>getWorkingDirectory</tt> calls <tt>getcwd</tt> to obtain the name
°5uof the current working directory.
getWorkingDirectory :: IO FilePath

-- | <tt>changeWorkingDirectory dir</tt> calls <tt>chdir</tt> to change the
°5ucurrent working directory to <tt>dir</tt>.
changeWorkingDirectory :: FilePath -> IO ()
changeWorkingDirectoryFd :: Fd -> IO ()


-- | POSIX file control support
module System.Posix.Fcntl

-- | Advice parameter for <a>fileAdvise</a> operation.
°5u
°5uFor more details, see documentation of <tt>posix_fadvise(2)</tt>.
data Advice
AdviceNormal :: Advice
AdviceRandom :: Advice
AdviceSequential :: Advice
AdviceWillNeed :: Advice
AdviceDontNeed :: Advice
AdviceNoReuse :: Advice

-- | Performs <tt>posix_fadvise(2)</tt> operation on file-descriptor.
°5u
°5uIf platform does not provide <tt>posix_fadvise(2)</tt>
°5u<a>fileAdvise</a> becomes a no-op.
°5u
°5u(use <tt>#if HAVE_POSIX_FADVISE</tt> CPP guard to detect availability)
fileAdvise :: Fd -> FileOffset -> FileOffset -> Advice -> IO ()

-- | Performs <tt>posix_fallocate(2)</tt> operation on file-descriptor.
°5u
°5uThrows <a>IOError</a> ("unsupported operation") if platform does not
°5uprovide <tt>posix_fallocate(2)</tt>.
°5u
°5u(use <tt>#if HAVE_POSIX_FALLOCATE</tt> CPP guard to detect
°5uavailability).
fileAllocate :: Fd -> FileOffset -> FileOffset -> IO ()
instance GHC.Classes.Eq System.Posix.Fcntl.Advice


-- | Functions defined by the POSIX standards for manipulating and querying
°5uthe file system. Names of underlying POSIX functions are indicated
°5uwhenever possible. A more complete documentation of the POSIX
°5ufunctions together with a more detailed description of different error
°5uconditions are usually available in the system's manual pages or from
°5u<a>http://www.unix.org/version3/online.html</a> (free registration
°5urequired).
°5u
°5uWhen a function that calls an underlying POSIX function fails, the
°5uerrno code is converted to an <a>IOError</a> using
°5u<a>errnoToIOError</a>. For a list of which errno codes may be
°5ugenerated, consult the POSIX documentation for the underlying
°5ufunction.
module System.Posix.Files.ByteString

-- | Combines the two file modes into one that contains modes that appear
°5uin either.
unionFileModes :: FileMode -> FileMode -> FileMode

-- | Combines two file modes into one that only contains modes that appear
°5uin 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

-- | <tt>setFileMode path mode</tt> changes permission of the file given by
°5u<tt>path</tt> to <tt>mode</tt>. This operation may fail with
°5u<a>throwErrnoPathIfMinus1_</a> if <tt>path</tt> doesn't exist or if
°5uthe effective user ID of the current process is not that of the file's
°5uowner.
°5u
°5uNote: calls <tt>chmod</tt>.
setFileMode :: RawFilePath -> FileMode -> IO ()

-- | <tt>setFdMode fd mode</tt> acts like <tt>setFileMode</tt> but uses a
°5ufile descriptor <tt>fd</tt> instead of a <a>FilePath</a>.
°5u
°5uNote: calls <tt>fchmod</tt>.
setFdMode :: Fd -> FileMode -> IO ()

-- | <tt>setFileCreationMask mode</tt> sets the file mode creation mask to
°5u<tt>mode</tt>. Modes set by this operation are subtracted from files
°5uand directories upon creation. The previous file creation mask is
°5ureturned.
°5u
°5uNote: calls <tt>umask</tt>.
setFileCreationMask :: FileMode -> IO FileMode

-- | <tt>fileAccess name read write exec</tt> checks if the file (or other
°5ufile system object) <tt>name</tt> can be accessed for reading, writing
°5uand/or executing. To check a permission set the corresponding argument
°5uto <a>True</a>.
°5u
°5uNote: calls <tt>access</tt>.
fileAccess :: RawFilePath -> Bool -> Bool -> Bool -> IO Bool

-- | Checks for the existence of the file.
°5u
°5uNote: calls <tt>access</tt>.
fileExist :: RawFilePath -> IO Bool

-- | POSIX defines operations to get information, such as owner,
°5upermissions, size and access times, about a file. This information is
°5urepresented by the <a>FileStatus</a> type.
°5u
°5uNote: see <tt>chmod</tt>.
data FileStatus

-- | <tt>getFileStatus path</tt> calls gets the <tt>FileStatus</tt>
°5uinformation (user ID, size, access times, etc.) for the file
°5u<tt>path</tt>.
°5u
°5uNote: calls <tt>stat</tt>.
getFileStatus :: RawFilePath -> IO FileStatus

-- | <tt>getFdStatus fd</tt> acts as <tt>getFileStatus</tt> but uses a file
°5udescriptor <tt>fd</tt>.
°5u
°5uNote: calls <tt>fstat</tt>.
getFdStatus :: Fd -> IO FileStatus

-- | Acts as <a>getFileStatus</a> except when the <a>RawFilePath</a> refers
°5uto a symbolic link. In that case the <tt>FileStatus</tt> information
°5uof the symbolic link itself is returned instead of that of the file it
°5upoints to.
°5u
°5uNote: calls <tt>lstat</tt>.
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
°5uthe 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,
°5uetc.).
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.)
°5uin 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

-- | <tt>createNamedPipe fifo mode</tt> creates a new named pipe,
°5u<tt>fifo</tt>, with permissions based on <tt>mode</tt>. May fail with
°5u<a>throwErrnoPathIfMinus1_</a> if a file named <tt>name</tt> already
°5uexists or if the effective user ID of the current process doesn't have
°5upermission to create the pipe.
°5u
°5uNote: calls <tt>mkfifo</tt>.
createNamedPipe :: RawFilePath -> FileMode -> IO ()

-- | <tt>createDevice path mode dev</tt> creates either a regular or a
°5uspecial file depending on the value of <tt>mode</tt> (and
°5u<tt>dev</tt>). <tt>mode</tt> will normally be either
°5u<a>blockSpecialMode</a> or <a>characterSpecialMode</a>. May fail with
°5u<a>throwErrnoPathIfMinus1_</a> if a file named <tt>name</tt> already
°5uexists or if the effective user ID of the current process doesn't have
°5upermission to create the file.
°5u
°5uNote: calls <tt>mknod</tt>.
createDevice :: RawFilePath -> FileMode -> DeviceID -> IO ()

-- | <tt>createLink old new</tt> creates a new path, <tt>new</tt>, linked
°5uto an existing file, <tt>old</tt>.
°5u
°5uNote: calls <tt>link</tt>.
createLink :: RawFilePath -> RawFilePath -> IO ()

-- | <tt>removeLink path</tt> removes the link named <tt>path</tt>.
°5u
°5uNote: calls <tt>unlink</tt>.
removeLink :: RawFilePath -> IO ()

-- | <tt>createSymbolicLink file1 file2</tt> creates a symbolic link named
°5u<tt>file2</tt> which points to the file <tt>file1</tt>.
°5u
°5uSymbolic links are interpreted at run-time as if the contents of the
°5ulink had been substituted into the path being followed to find a file
°5uor directory.
°5u
°5uNote: calls <tt>symlink</tt>.
createSymbolicLink :: RawFilePath -> RawFilePath -> IO ()

-- | Reads the <tt>RawFilePath</tt> pointed to by the symbolic link and
°5ureturns it.
°5u
°5uNote: calls <tt>readlink</tt>.
readSymbolicLink :: RawFilePath -> IO RawFilePath

-- | <tt>rename old new</tt> renames a file or directory from <tt>old</tt>
°5uto <tt>new</tt>.
°5u
°5uNote: calls <tt>rename</tt>.
rename :: RawFilePath -> RawFilePath -> IO ()

-- | <tt>setOwnerAndGroup path uid gid</tt> changes the owner and group of
°5u<tt>path</tt> to <tt>uid</tt> and <tt>gid</tt>, respectively.
°5u
°5uIf <tt>uid</tt> or <tt>gid</tt> is specified as -1, then that ID is
°5unot changed.
°5u
°5uNote: calls <tt>chown</tt>.
setOwnerAndGroup :: RawFilePath -> UserID -> GroupID -> IO ()

-- | Acts as <tt>setOwnerAndGroup</tt> but uses a file descriptor instead
°5uof a <a>FilePath</a>.
°5u
°5uNote: calls <tt>fchown</tt>.
setFdOwnerAndGroup :: Fd -> UserID -> GroupID -> IO ()

-- | Acts as <a>setOwnerAndGroup</a> but does not follow symlinks (and thus
°5uchanges permissions on the link itself).
°5u
°5uNote: calls <tt>lchown</tt>.
setSymbolicLinkOwnerAndGroup :: RawFilePath -> UserID -> GroupID -> IO ()

-- | <tt>setFileTimes path atime mtime</tt> sets the access and
°5umodification times associated with file <tt>path</tt> to
°5u<tt>atime</tt> and <tt>mtime</tt>, respectively.
°5u
°5uNote: calls <tt>utime</tt>.
setFileTimes :: RawFilePath -> EpochTime -> EpochTime -> IO ()

-- | Like <a>setFileTimes</a> but timestamps can have sub-second
°5uresolution.
°5u
°5uNote: calls <tt>utimensat</tt> or <tt>utimes</tt>.
setFileTimesHiRes :: RawFilePath -> POSIXTime -> POSIXTime -> IO ()

-- | Like <tt>setFileTimesHiRes</tt> but uses a file descriptor instead of
°5ua path. This operation is not supported on all platforms. On these
°5uplatforms, this function will raise an exception.
°5u
°5uNote: calls <tt>futimens</tt> or <tt>futimes</tt>.
setFdTimesHiRes :: Fd -> POSIXTime -> POSIXTime -> IO ()

-- | Like <a>setFileTimesHiRes</a> but does not follow symbolic links. This
°5uoperation is not supported on all platforms. On these platforms, this
°5ufunction will raise an exception.
°5u
°5uNote: calls <tt>utimensat</tt> or <tt>lutimes</tt>.
setSymbolicLinkTimesHiRes :: RawFilePath -> POSIXTime -> POSIXTime -> IO ()

-- | <tt>touchFile path</tt> sets the access and modification times
°5uassociated with file <tt>path</tt> to the current time.
°5u
°5uNote: calls <tt>utime</tt>.
touchFile :: RawFilePath -> IO ()

-- | Like <tt>touchFile</tt> but uses a file descriptor instead of a path.
°5uThis operation is not supported on all platforms. On these platforms,
°5uthis function will raise an exception.
°5u
°5uNote: calls <tt>futimes</tt>.
touchFd :: Fd -> IO ()

-- | Like <a>touchFile</a> but does not follow symbolic links. This
°5uoperation is not supported on all platforms. On these platforms, this
°5ufunction will raise an exception.
°5u
°5uNote: calls <tt>lutimes</tt>.
touchSymbolicLink :: RawFilePath -> IO ()

-- | Truncates the file down to the specified length. If the file was
°5ularger than the given length before this operation was performed the
°5uextra is lost.
°5u
°5uNote: calls <tt>truncate</tt>.
setFileSize :: RawFilePath -> FileOffset -> IO ()

-- | Acts as <tt>setFileSize</tt> but uses a file descriptor instead of a
°5u<a>FilePath</a>.
°5u
°5uNote: calls <tt>ftruncate</tt>.
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

-- | <tt>getPathVar var path</tt> obtains the dynamic value of the
°5urequested configurable file limit or option associated with file or
°5udirectory <tt>path</tt>. For defined file limits, <tt>getPathVar</tt>
°5ureturns the associated value. For defined file options, the result of
°5u<tt>getPathVar</tt> is undefined, but not failure.
°5u
°5uNote: calls <tt>pathconf</tt>.
getPathVar :: RawFilePath -> PathVar -> IO Limit

-- | <tt>getFdPathVar var fd</tt> obtains the dynamic value of the
°5urequested configurable file limit or option associated with the file
°5uor directory attached to the open channel <tt>fd</tt>. For defined
°5ufile limits, <tt>getFdPathVar</tt> returns the associated value. For
°5udefined file options, the result of <tt>getFdPathVar</tt> is
°5uundefined, but not failure.
°5u
°5uNote: calls <tt>fpathconf</tt>.
getFdPathVar :: Fd -> PathVar -> IO Limit


-- | Functions defined by the POSIX standards for manipulating and querying
°5uthe file system. Names of underlying POSIX functions are indicated
°5uwhenever possible. A more complete documentation of the POSIX
°5ufunctions together with a more detailed description of different error
°5uconditions are usually available in the system's manual pages or from
°5u<a>http://www.unix.org/version3/online.html</a> (free registration
°5urequired).
°5u
°5uWhen a function that calls an underlying POSIX function fails, the
°5uerrno code is converted to an <a>IOError</a> using
°5u<a>errnoToIOError</a>. For a list of which errno codes may be
°5ugenerated, consult the POSIX documentation for the underlying
°5ufunction.
module System.Posix.Files

-- | Combines the two file modes into one that contains modes that appear
°5uin either.
unionFileModes :: FileMode -> FileMode -> FileMode

-- | Combines two file modes into one that only contains modes that appear
°5uin 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

-- | <tt>setFileMode path mode</tt> changes permission of the file given by
°5u<tt>path</tt> to <tt>mode</tt>. This operation may fail with
°5u<a>throwErrnoPathIfMinus1_</a> if <tt>path</tt> doesn't exist or if
°5uthe effective user ID of the current process is not that of the file's
°5uowner.
°5u
°5uNote: calls <tt>chmod</tt>.
setFileMode :: FilePath -> FileMode -> IO ()

-- | <tt>setFdMode fd mode</tt> acts like <tt>setFileMode</tt> but uses a
°5ufile descriptor <tt>fd</tt> instead of a <a>FilePath</a>.
°5u
°5uNote: calls <tt>fchmod</tt>.
setFdMode :: Fd -> FileMode -> IO ()

-- | <tt>setFileCreationMask mode</tt> sets the file mode creation mask to
°5u<tt>mode</tt>. Modes set by this operation are subtracted from files
°5uand directories upon creation. The previous file creation mask is
°5ureturned.
°5u
°5uNote: calls <tt>umask</tt>.
setFileCreationMask :: FileMode -> IO FileMode

-- | <tt>fileAccess name read write exec</tt> checks if the file (or other
°5ufile system object) <tt>name</tt> can be accessed for reading, writing
°5uand/or executing. To check a permission set the corresponding argument
°5uto <a>True</a>.
°5u
°5uNote: calls <tt>access</tt>.
fileAccess :: FilePath -> Bool -> Bool -> Bool -> IO Bool

-- | Checks for the existence of the file.
°5u
°5uNote: calls <tt>access</tt>.
fileExist :: FilePath -> IO Bool

-- | POSIX defines operations to get information, such as owner,
°5upermissions, size and access times, about a file. This information is
°5urepresented by the <a>FileStatus</a> type.
°5u
°5uNote: see <tt>chmod</tt>.
data FileStatus

-- | <tt>getFileStatus path</tt> calls gets the <tt>FileStatus</tt>
°5uinformation (user ID, size, access times, etc.) for the file
°5u<tt>path</tt>.
°5u
°5uNote: calls <tt>stat</tt>.
getFileStatus :: FilePath -> IO FileStatus

-- | <tt>getFdStatus fd</tt> acts as <tt>getFileStatus</tt> but uses a file
°5udescriptor <tt>fd</tt>.
°5u
°5uNote: calls <tt>fstat</tt>.
getFdStatus :: Fd -> IO FileStatus

-- | Acts as <a>getFileStatus</a> except when the <a>FilePath</a> refers to
°5ua symbolic link. In that case the <tt>FileStatus</tt> information of
°5uthe symbolic link itself is returned instead of that of the file it
°5upoints to.
°5u
°5uNote: calls <tt>lstat</tt>.
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
°5uthe 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,
°5uetc.).
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.)
°5uin 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

-- | <tt>createNamedPipe fifo mode</tt> creates a new named pipe,
°5u<tt>fifo</tt>, with permissions based on <tt>mode</tt>. May fail with
°5u<a>throwErrnoPathIfMinus1_</a> if a file named <tt>name</tt> already
°5uexists or if the effective user ID of the current process doesn't have
°5upermission to create the pipe.
°5u
°5uNote: calls <tt>mkfifo</tt>.
createNamedPipe :: FilePath -> FileMode -> IO ()

-- | <tt>createDevice path mode dev</tt> creates either a regular or a
°5uspecial file depending on the value of <tt>mode</tt> (and
°5u<tt>dev</tt>). <tt>mode</tt> will normally be either
°5u<a>blockSpecialMode</a> or <a>characterSpecialMode</a>. May fail with
°5u<a>throwErrnoPathIfMinus1_</a> if a file named <tt>name</tt> already
°5uexists or if the effective user ID of the current process doesn't have
°5upermission to create the file.
°5u
°5uNote: calls <tt>mknod</tt>.
createDevice :: FilePath -> FileMode -> DeviceID -> IO ()

-- | <tt>createLink old new</tt> creates a new path, <tt>new</tt>, linked
°5uto an existing file, <tt>old</tt>.
°5u
°5uNote: calls <tt>link</tt>.
createLink :: FilePath -> FilePath -> IO ()

-- | <tt>removeLink path</tt> removes the link named <tt>path</tt>.
°5u
°5uNote: calls <tt>unlink</tt>.
removeLink :: FilePath -> IO ()

-- | <tt>createSymbolicLink file1 file2</tt> creates a symbolic link named
°5u<tt>file2</tt> which points to the file <tt>file1</tt>.
°5u
°5uSymbolic links are interpreted at run-time as if the contents of the
°5ulink had been substituted into the path being followed to find a file
°5uor directory.
°5u
°5uNote: calls <tt>symlink</tt>.
createSymbolicLink :: FilePath -> FilePath -> IO ()

-- | Reads the <tt>FilePath</tt> pointed to by the symbolic link and
°5ureturns it.
°5u
°5uNote: calls <tt>readlink</tt>.
readSymbolicLink :: FilePath -> IO FilePath

-- | <tt>rename old new</tt> renames a file or directory from <tt>old</tt>
°5uto <tt>new</tt>.
°5u
°5uNote: calls <tt>rename</tt>.
rename :: FilePath -> FilePath -> IO ()

-- | <tt>setOwnerAndGroup path uid gid</tt> changes the owner and group of
°5u<tt>path</tt> to <tt>uid</tt> and <tt>gid</tt>, respectively.
°5u
°5uIf <tt>uid</tt> or <tt>gid</tt> is specified as -1, then that ID is
°5unot changed.
°5u
°5uNote: calls <tt>chown</tt>.
setOwnerAndGroup :: FilePath -> UserID -> GroupID -> IO ()

-- | Acts as <tt>setOwnerAndGroup</tt> but uses a file descriptor instead
°5uof a <a>FilePath</a>.
°5u
°5uNote: calls <tt>fchown</tt>.
setFdOwnerAndGroup :: Fd -> UserID -> GroupID -> IO ()

-- | Acts as <a>setOwnerAndGroup</a> but does not follow symlinks (and thus
°5uchanges permissions on the link itself).
°5u
°5uNote: calls <tt>lchown</tt>.
setSymbolicLinkOwnerAndGroup :: FilePath -> UserID -> GroupID -> IO ()

-- | <tt>setFileTimes path atime mtime</tt> sets the access and
°5umodification times associated with file <tt>path</tt> to
°5u<tt>atime</tt> and <tt>mtime</tt>, respectively.
°5u
°5uNote: calls <tt>utime</tt>.
setFileTimes :: FilePath -> EpochTime -> EpochTime -> IO ()

-- | Like <a>setFileTimes</a> but timestamps can have sub-second
°5uresolution.
°5u
°5uNote: calls <tt>utimensat</tt> or <tt>utimes</tt>.
setFileTimesHiRes :: FilePath -> POSIXTime -> POSIXTime -> IO ()

-- | Like <tt>setFileTimesHiRes</tt> but uses a file descriptor instead of
°5ua path. This operation is not supported on all platforms. On these
°5uplatforms, this function will raise an exception.
°5u
°5uNote: calls <tt>futimens</tt> or <tt>futimes</tt>.
setFdTimesHiRes :: Fd -> POSIXTime -> POSIXTime -> IO ()

-- | Like <a>setFileTimesHiRes</a> but does not follow symbolic links. This
°5uoperation is not supported on all platforms. On these platforms, this
°5ufunction will raise an exception.
°5u
°5uNote: calls <tt>utimensat</tt> or <tt>lutimes</tt>.
setSymbolicLinkTimesHiRes :: FilePath -> POSIXTime -> POSIXTime -> IO ()

-- | <tt>touchFile path</tt> sets the access and modification times
°5uassociated with file <tt>path</tt> to the current time.
°5u
°5uNote: calls <tt>utime</tt>.
touchFile :: FilePath -> IO ()

-- | Like <tt>touchFile</tt> but uses a file descriptor instead of a path.
°5uThis operation is not supported on all platforms. On these platforms,
°5uthis function will raise an exception.
°5u
°5uNote: calls <tt>futimes</tt>.
touchFd :: Fd -> IO ()

-- | Like <a>touchFile</a> but does not follow symbolic links. This
°5uoperation is not supported on all platforms. On these platforms, this
°5ufunction will raise an exception.
°5u
°5uNote: calls <tt>lutimes</tt>.
touchSymbolicLink :: FilePath -> IO ()

-- | Truncates the file down to the specified length. If the file was
°5ularger than the given length before this operation was performed the
°5uextra is lost.
°5u
°5uNote: calls <tt>truncate</tt>.
setFileSize :: FilePath -> FileOffset -> IO ()

-- | Acts as <tt>setFileSize</tt> but uses a file descriptor instead of a
°5u<a>FilePath</a>.
°5u
°5uNote: calls <tt>ftruncate</tt>.
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

-- | <tt>getPathVar var path</tt> obtains the dynamic value of the
°5urequested configurable file limit or option associated with file or
°5udirectory <tt>path</tt>. For defined file limits, <tt>getPathVar</tt>
°5ureturns the associated value. For defined file options, the result of
°5u<tt>getPathVar</tt> is undefined, but not failure.
°5u
°5uNote: calls <tt>pathconf</tt>.
getPathVar :: FilePath -> PathVar -> IO Limit

-- | <tt>getFdPathVar var fd</tt> obtains the dynamic value of the
°5urequested configurable file limit or option associated with the file
°5uor directory attached to the open channel <tt>fd</tt>. For defined
°5ufile limits, <tt>getFdPathVar</tt> returns the associated value. For
°5udefined file options, the result of <tt>getFdPathVar</tt> is
°5uundefined, but not failure.
°5u
°5uNote: calls <tt>fpathconf</tt>.
getFdPathVar :: Fd -> PathVar -> IO Limit


-- | POSIX IO support. These types and functions correspond to the unix
°5ufunctions open(2), close(2), etc. For more portable functions which
°5uare more like fopen(3) and friends from stdio.h, see <a>System.IO</a>.
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 <a>OpenFileFlags</a> type. False for each of
°5uappend, exclusive, noctty, nonBlock, and trunc.
defaultFileFlags :: OpenFileFlags

-- | Open and optionally create this file. See <a>Files</a> for information
°5uon how to use the <a>FileMode</a> type.
openFd :: RawFilePath -> OpenMode -> Maybe FileMode -> OpenFileFlags -> IO Fd

-- | Create and open this file in WriteOnly mode. A special case of
°5u<a>openFd</a>. See <a>Files</a> for information on how to use the
°5u<a>FileMode</a> type.
createFile :: RawFilePath -> FileMode -> IO Fd

-- | Close this file descriptor. May throw an exception if this is an
°5uinvalid descriptor.
closeFd :: Fd -> IO ()

-- | Read data from an <a>Fd</a> and convert it to a <a>String</a> using
°5uthe locale encoding. Throws an exception if this is an invalid
°5udescriptor, or EOF has been reached.
fdRead :: Fd -> ByteCount -> IO (String, ByteCount)

-- | Write a <a>String</a> to an <a>Fd</a> using the locale encoding.
fdWrite :: Fd -> String -> IO ByteCount

-- | Read data from an <a>Fd</a> into memory. This is exactly equivalent to
°5uthe POSIX <tt>read</tt> function.
fdReadBuf :: Fd -> Ptr Word8 -> ByteCount -> IO ByteCount

-- | Write data from memory to an <a>Fd</a>. This is exactly equivalent to
°5uthe POSIX <tt>write</tt> 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 <a>createPipe</a> function creates a pair of connected file
°5udescriptors. The first component is the fd to read from, the second is
°5uthe write end. Although pipes may be bidirectional, this behaviour is
°5unot portable and programmers should use two separate pipes for this
°5upurpose. 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 <a>Fd</a> from a <a>Handle</a>. This function has the
°5uside effect of closing the <a>Handle</a> and flushing its write
°5ubuffer, if necessary.
handleToFd :: Handle -> IO Fd

-- | Converts an <a>Fd</a> into a <a>Handle</a> that can be used with the
°5ustandard Haskell IO library (see <a>System.IO</a>).
fdToHandle :: Fd -> IO Handle


-- | POSIX IO support. These types and functions correspond to the unix
°5ufunctions open(2), close(2), etc. For more portable functions which
°5uare more like fopen(3) and friends from stdio.h, see <a>System.IO</a>.
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 <a>OpenFileFlags</a> type. False for each of
°5uappend, exclusive, noctty, nonBlock, and trunc.
defaultFileFlags :: OpenFileFlags

-- | Open and optionally create this file. See <a>Files</a> for information
°5uon how to use the <a>FileMode</a> type.
openFd :: FilePath -> OpenMode -> Maybe FileMode -> OpenFileFlags -> IO Fd

-- | Create and open this file in WriteOnly mode. A special case of
°5u<a>openFd</a>. See <a>Files</a> for information on how to use the
°5u<a>FileMode</a> type.
createFile :: FilePath -> FileMode -> IO Fd

-- | Close this file descriptor. May throw an exception if this is an
°5uinvalid descriptor.
closeFd :: Fd -> IO ()

-- | Read data from an <a>Fd</a> and convert it to a <a>String</a> using
°5uthe locale encoding. Throws an exception if this is an invalid
°5udescriptor, or EOF has been reached.
fdRead :: Fd -> ByteCount -> IO (String, ByteCount)

-- | Write a <a>String</a> to an <a>Fd</a> using the locale encoding.
fdWrite :: Fd -> String -> IO ByteCount

-- | Read data from an <a>Fd</a> into memory. This is exactly equivalent to
°5uthe POSIX <tt>read</tt> function.
fdReadBuf :: Fd -> Ptr Word8 -> ByteCount -> IO ByteCount

-- | Write data from memory to an <a>Fd</a>. This is exactly equivalent to
°5uthe POSIX <tt>write</tt> 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 <a>createPipe</a> function creates a pair of connected file
°5udescriptors. The first component is the fd to read from, the second is
°5uthe write end. Although pipes may be bidirectional, this behaviour is
°5unot portable and programmers should use two separate pipes for this
°5upurpose. 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 <a>Fd</a> from a <a>Handle</a>. This function has the
°5uside effect of closing the <a>Handle</a> and flushing its write
°5ubuffer, if necessary.
handleToFd :: Handle -> IO Fd

-- | Converts an <a>Fd</a> into a <a>Handle</a> that can be used with the
°5ustandard Haskell IO library (see <a>System.IO</a>).
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 <tt>exit()</tt> or returning from
°5u<tt>main</tt>
Exited :: ExitCode -> ProcessStatus

-- | the process was terminated by a signal, the <tt>Bool</tt> is
°5u<tt>True</tt> 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
°5umodules in the process package.
module System.Posix.Process.ByteString

-- | <a>forkProcess</a> corresponds to the POSIX <tt>fork</tt> system call.
°5uThe <a>IO</a> action passed as an argument is executed in the child
°5uprocess; no other threads will be copied to the child process. On
°5usuccess, <a>forkProcess</a> returns the child's <a>ProcessID</a> to
°5uthe parent process; in case of an error, an exception is thrown.
°5u
°5uThe exception masking state of the executed action is inherited (c.f.
°5u<tt>forkIO</tt>), see also <a>forkProcessWithUnmask</a> (<i>since:
°5u2.7.0.0</i>).
°5u
°5u<a>forkProcess</a> comes with a giant warning: since any other running
°5uthreads are not copied into the child process, it's easy to go wrong:
°5ue.g. by accessing some shared resource that was held by another thread
°5uin the parent.
forkProcess :: IO () -> IO ProcessID

-- | Variant of <a>forkProcess</a> in the style of
°5u<tt>forkIOWithUnmask</tt>.
forkProcessWithUnmask :: ((forall a. IO a -> IO a) -> IO ()) -> IO ProcessID

-- | <tt><a>executeFile</a> cmd args env</tt> calls one of the
°5u<tt>execv*</tt> family, depending on whether or not the current PATH
°5uis to be searched for the command, and whether or not an environment
°5uis provided to supersede the process's current environment. The
°5ubasename (leading directory names suppressed) of the command is passed
°5uto <tt>execv*</tt> as <tt>arg[0]</tt>; the argument list passed to
°5u<a>executeFile</a> therefore begins with <tt>arg[1]</tt>.
executeFile :: RawFilePath -> Bool -> [ByteString] -> Maybe [(ByteString, ByteString)] -> IO a

-- | <tt><a>exitImmediately</a> status</tt> calls <tt>_exit</tt> to
°5uterminate the process with the indicated exit <tt>status</tt>. The
°5uoperation never returns.
exitImmediately :: ExitCode -> IO ()

-- | <a>getProcessID</a> calls <tt>getpid</tt> to obtain the
°5u<a>ProcessID</a> for the current process.
getProcessID :: IO ProcessID

-- | <a>getProcessID</a> calls <tt>getppid</tt> to obtain the
°5u<a>ProcessID</a> for the parent of the current process.
getParentProcessID :: IO ProcessID

-- | <a>getProcessGroupID</a> calls <tt>getpgrp</tt> to obtain the
°5u<a>ProcessGroupID</a> for the current process.
getProcessGroupID :: IO ProcessGroupID

-- | <tt><a>getProcessGroupIDOf</a> pid</tt> calls <tt>getpgid</tt> to
°5uobtain the <a>ProcessGroupID</a> for process <tt>pid</tt>.
getProcessGroupIDOf :: ProcessID -> IO ProcessGroupID

-- | <tt><a>createProcessGroupFor</a> pid</tt> calls <tt>setpgid</tt> to
°5umake process <tt>pid</tt> a new process group leader.
createProcessGroupFor :: ProcessID -> IO ProcessGroupID

-- | <tt><a>joinProcessGroup</a> pgid</tt> calls <tt>setpgid</tt> to set
°5uthe <a>ProcessGroupID</a> of the current process to <tt>pgid</tt>.
joinProcessGroup :: ProcessGroupID -> IO ()

-- | <tt><a>setProcessGroupIDOf</a> pid pgid</tt> calls <tt>setpgid</tt> to
°5uset the <tt>ProcessGroupIDOf</tt> for process <tt>pid</tt> to
°5u<tt>pgid</tt>.
setProcessGroupIDOf :: ProcessID -> ProcessGroupID -> IO ()

-- | <a>createSession</a> calls <tt>setsid</tt> to create a new session
°5uwith 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

-- | <a>getProcessTimes</a> calls <tt>times</tt> to obtain time-accounting
°5uinformation 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 <tt>exit()</tt> or returning from
°5u<tt>main</tt>
Exited :: ExitCode -> ProcessStatus

-- | the process was terminated by a signal, the <tt>Bool</tt> is
°5u<tt>True</tt> if a core dump was produced
Terminated :: Signal -> Bool -> ProcessStatus

-- | the process was stopped by a signal
Stopped :: Signal -> ProcessStatus

-- | <tt><a>getProcessStatus</a> blk stopped pid</tt> calls
°5u<tt>waitpid</tt>, returning <tt><a>Just</a> tc</tt>, the
°5u<a>ProcessStatus</a> for process <tt>pid</tt> if it is available,
°5u<a>Nothing</a> otherwise. If <tt>blk</tt> is <a>False</a>, then
°5u<tt>WNOHANG</tt> is set in the options for <tt>waitpid</tt>, otherwise
°5unot. If <tt>stopped</tt> is <a>True</a>, then <tt>WUNTRACED</tt> is
°5uset in the options for <tt>waitpid</tt>, otherwise not.
getProcessStatus :: Bool -> Bool -> ProcessID -> IO (Maybe ProcessStatus)

-- | <tt><a>getAnyProcessStatus</a> blk stopped</tt> calls
°5u<tt>waitpid</tt>, returning <tt><a>Just</a> (pid, tc)</tt>, the
°5u<a>ProcessID</a> and <a>ProcessStatus</a> for any child process if a
°5uchild process has exited, or <a>Nothing</a> if there are child
°5uprocesses but none have exited. If there are no child processes, then
°5u<a>getAnyProcessStatus</a> raises an <tt>isDoesNotExistError</tt>
°5uexception.
°5u
°5uIf <tt>blk</tt> is <a>False</a>, then <tt>WNOHANG</tt> is set in the
°5uoptions for <tt>waitpid</tt>, otherwise not. If <tt>stopped</tt> is
°5u<a>True</a>, then <tt>WUNTRACED</tt> is set in the options for
°5u<tt>waitpid</tt>, otherwise not.
getAnyProcessStatus :: Bool -> Bool -> IO (Maybe (ProcessID, ProcessStatus))

-- | <tt><a>getGroupProcessStatus</a> blk stopped pgid</tt> calls
°5u<tt>waitpid</tt>, returning <tt><a>Just</a> (pid, tc)</tt>, the
°5u<a>ProcessID</a> and <a>ProcessStatus</a> for any process in group
°5u<tt>pgid</tt> if one is available, or <a>Nothing</a> if there are
°5uchild processes but none have exited. If there are no child processes,
°5uthen <a>getGroupProcessStatus</a> raises an
°5u<tt>isDoesNotExistError</tt> exception.
°5u
°5uIf <tt>blk</tt> is <a>False</a>, then <tt>WNOHANG</tt> is set in the
°5uoptions for <tt>waitpid</tt>, otherwise not. If <tt>stopped</tt> is
°5u<a>True</a>, then <tt>WUNTRACED</tt> is set in the options for
°5u<tt>waitpid</tt>, otherwise not.
getGroupProcessStatus :: Bool -> Bool -> ProcessGroupID -> IO (Maybe (ProcessID, ProcessStatus))

-- | <tt><a>createProcessGroup</a> pid</tt> calls <tt>setpgid</tt> to make
°5uprocess <tt>pid</tt> a new process group leader. This function is
°5ucurrently deprecated, and might be changed to making the current
°5uprocess a new process group leader in future versions.

-- | <i>Deprecated: This function is scheduled to be replaced by something
°5udifferent in the future, we therefore recommend that you do not use
°5uthis version and use <a>createProcessGroupFor</a> instead.</i>
createProcessGroup :: ProcessID -> IO ProcessGroupID

-- | <tt><a>setProcessGroupID</a> pid pgid</tt> calls <tt>setpgid</tt> to
°5uset the <a>ProcessGroupID</a> for process <tt>pid</tt> to
°5u<tt>pgid</tt>. This function is currently deprecated, and might be
°5uchanged to setting the <a>ProcessGroupID</a> for the current process
°5uin future versions.

-- | <i>Deprecated: This function is scheduled to be replaced by something
°5udifferent in the future, we therefore recommend that you do not use
°5uthis version and use <a>setProcessGroupIDOf</a> instead.</i>
setProcessGroupID :: ProcessID -> ProcessGroupID -> IO ()


-- | POSIX process support. See also the System.Cmd and System.Process
°5umodules in the process package.
module System.Posix.Process

-- | <a>forkProcess</a> corresponds to the POSIX <tt>fork</tt> system call.
°5uThe <a>IO</a> action passed as an argument is executed in the child
°5uprocess; no other threads will be copied to the child process. On
°5usuccess, <a>forkProcess</a> returns the child's <a>ProcessID</a> to
°5uthe parent process; in case of an error, an exception is thrown.
°5u
°5uThe exception masking state of the executed action is inherited (c.f.
°5u<tt>forkIO</tt>), see also <a>forkProcessWithUnmask</a> (<i>since:
°5u2.7.0.0</i>).
°5u
°5u<a>forkProcess</a> comes with a giant warning: since any other running
°5uthreads are not copied into the child process, it's easy to go wrong:
°5ue.g. by accessing some shared resource that was held by another thread
°5uin the parent.
forkProcess :: IO () -> IO ProcessID

-- | Variant of <a>forkProcess</a> in the style of
°5u<tt>forkIOWithUnmask</tt>.
forkProcessWithUnmask :: ((forall a. IO a -> IO a) -> IO ()) -> IO ProcessID

-- | <tt><a>executeFile</a> cmd args env</tt> calls one of the
°5u<tt>execv*</tt> family, depending on whether or not the current PATH
°5uis to be searched for the command, and whether or not an environment
°5uis provided to supersede the process's current environment. The
°5ubasename (leading directory names suppressed) of the command is passed
°5uto <tt>execv*</tt> as <tt>arg[0]</tt>; the argument list passed to
°5u<a>executeFile</a> therefore begins with <tt>arg[1]</tt>.
executeFile :: FilePath -> Bool -> [String] -> Maybe [(String, String)] -> IO a

-- | <tt><a>exitImmediately</a> status</tt> calls <tt>_exit</tt> to
°5uterminate the process with the indicated exit <tt>status</tt>. The
°5uoperation never returns.
exitImmediately :: ExitCode -> IO ()

-- | <a>getProcessID</a> calls <tt>getpid</tt> to obtain the
°5u<a>ProcessID</a> for the current process.
getProcessID :: IO ProcessID

-- | <a>getProcessID</a> calls <tt>getppid</tt> to obtain the
°5u<a>ProcessID</a> for the parent of the current process.
getParentProcessID :: IO ProcessID

-- | <a>getProcessGroupID</a> calls <tt>getpgrp</tt> to obtain the
°5u<a>ProcessGroupID</a> for the current process.
getProcessGroupID :: IO ProcessGroupID

-- | <tt><a>getProcessGroupIDOf</a> pid</tt> calls <tt>getpgid</tt> to
°5uobtain the <a>ProcessGroupID</a> for process <tt>pid</tt>.
getProcessGroupIDOf :: ProcessID -> IO ProcessGroupID

-- | <tt><a>createProcessGroupFor</a> pid</tt> calls <tt>setpgid</tt> to
°5umake process <tt>pid</tt> a new process group leader.
createProcessGroupFor :: ProcessID -> IO ProcessGroupID

-- | <tt><a>joinProcessGroup</a> pgid</tt> calls <tt>setpgid</tt> to set
°5uthe <a>ProcessGroupID</a> of the current process to <tt>pgid</tt>.
joinProcessGroup :: ProcessGroupID -> IO ()

-- | <tt><a>setProcessGroupIDOf</a> pid pgid</tt> calls <tt>setpgid</tt> to
°5uset the <tt>ProcessGroupIDOf</tt> for process <tt>pid</tt> to
°5u<tt>pgid</tt>.
setProcessGroupIDOf :: ProcessID -> ProcessGroupID -> IO ()

-- | <a>createSession</a> calls <tt>setsid</tt> to create a new session
°5uwith 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

-- | <a>getProcessTimes</a> calls <tt>times</tt> to obtain time-accounting
°5uinformation 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 <tt>exit()</tt> or returning from
°5u<tt>main</tt>
Exited :: ExitCode -> ProcessStatus

-- | the process was terminated by a signal, the <tt>Bool</tt> is
°5u<tt>True</tt> if a core dump was produced
Terminated :: Signal -> Bool -> ProcessStatus

-- | the process was stopped by a signal
Stopped :: Signal -> ProcessStatus

-- | <tt><a>getProcessStatus</a> blk stopped pid</tt> calls
°5u<tt>waitpid</tt>, returning <tt><a>Just</a> tc</tt>, the
°5u<a>ProcessStatus</a> for process <tt>pid</tt> if it is available,
°5u<a>Nothing</a> otherwise. If <tt>blk</tt> is <a>False</a>, then
°5u<tt>WNOHANG</tt> is set in the options for <tt>waitpid</tt>, otherwise
°5unot. If <tt>stopped</tt> is <a>True</a>, then <tt>WUNTRACED</tt> is
°5uset in the options for <tt>waitpid</tt>, otherwise not.
getProcessStatus :: Bool -> Bool -> ProcessID -> IO (Maybe ProcessStatus)

-- | <tt><a>getAnyProcessStatus</a> blk stopped</tt> calls
°5u<tt>waitpid</tt>, returning <tt><a>Just</a> (pid, tc)</tt>, the
°5u<a>ProcessID</a> and <a>ProcessStatus</a> for any child process if a
°5uchild process has exited, or <a>Nothing</a> if there are child
°5uprocesses but none have exited. If there are no child processes, then
°5u<a>getAnyProcessStatus</a> raises an <tt>isDoesNotExistError</tt>
°5uexception.
°5u
°5uIf <tt>blk</tt> is <a>False</a>, then <tt>WNOHANG</tt> is set in the
°5uoptions for <tt>waitpid</tt>, otherwise not. If <tt>stopped</tt> is
°5u<a>True</a>, then <tt>WUNTRACED</tt> is set in the options for
°5u<tt>waitpid</tt>, otherwise not.
getAnyProcessStatus :: Bool -> Bool -> IO (Maybe (ProcessID, ProcessStatus))

-- | <tt><a>getGroupProcessStatus</a> blk stopped pgid</tt> calls
°5u<tt>waitpid</tt>, returning <tt><a>Just</a> (pid, tc)</tt>, the
°5u<a>ProcessID</a> and <a>ProcessStatus</a> for any process in group
°5u<tt>pgid</tt> if one is available, or <a>Nothing</a> if there are
°5uchild processes but none have exited. If there are no child processes,
°5uthen <a>getGroupProcessStatus</a> raises an
°5u<tt>isDoesNotExistError</tt> exception.
°5u
°5uIf <tt>blk</tt> is <a>False</a>, then <tt>WNOHANG</tt> is set in the
°5uoptions for <tt>waitpid</tt>, otherwise not. If <tt>stopped</tt> is
°5u<a>True</a>, then <tt>WUNTRACED</tt> is set in the options for
°5u<tt>waitpid</tt>, otherwise not.
getGroupProcessStatus :: Bool -> Bool -> ProcessGroupID -> IO (Maybe (ProcessID, ProcessStatus))

-- | <tt><a>createProcessGroup</a> pid</tt> calls <tt>setpgid</tt> to make
°5uprocess <tt>pid</tt> a new process group leader. This function is
°5ucurrently deprecated, and might be changed to making the current
°5uprocess a new process group leader in future versions.

-- | <i>Deprecated: This function is scheduled to be replaced by something
°5udifferent in the future, we therefore recommend that you do not use
°5uthis version and use <a>createProcessGroupFor</a> instead.</i>
createProcessGroup :: ProcessID -> IO ProcessGroupID

-- | <tt><a>setProcessGroupID</a> pid pgid</tt> calls <tt>setpgid</tt> to
°5uset the <a>ProcessGroupID</a> for process <tt>pid</tt> to
°5u<tt>pgid</tt>. This function is currently deprecated, and might be
°5uchanged to setting the <a>ProcessGroupID</a> for the current process
°5uin future versions.

-- | <i>Deprecated: This function is scheduled to be replaced by something
°5udifferent in the future, we therefore recommend that you do not use
°5uthis version and use <a>setProcessGroupIDOf</a> instead.</i>
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
°5uvalue.
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
°5udone through a system call, this will block the *entire runtime*, not
°5ujust the current thread. If this is not the behaviour you want, use
°5usemThreadWait instead.
semWait :: Semaphore -> IO ()

-- | Attempt to lock the semaphore without blocking. Immediately return
°5uFalse if it is not available.
semTryWait :: Semaphore -> IO Bool

-- | Poll the semaphore until it is available, then lock it. Unlike
°5usemWait, this will block only the current thread rather than the
°5uentire process.
semThreadWait :: Semaphore -> IO ()

-- | Unlock the semaphore.
semPost :: Semaphore -> IO ()

-- | Return the semaphore's current value.
semGetValue :: Semaphore -> IO Int


-- | POSIX shared memory support.
module System.Posix.SharedMem
data ShmOpenFlags
ShmOpenFlags :: Bool -> Bool -> Bool -> Bool -> ShmOpenFlags

-- | If true, open the shm object read-write rather than read-only.
[shmReadWrite] :: ShmOpenFlags -> Bool

-- | If true, create the shm object if it does not exist.
[shmCreate] :: ShmOpenFlags -> Bool

-- | If true, throw an exception if the shm object already exists.
[shmExclusive] :: ShmOpenFlags -> Bool

-- | If true, wipe the contents of the shm object after opening it.
[shmTrunc] :: ShmOpenFlags -> Bool

-- | Open a shared memory object with the given name, flags, and mode.
shmOpen :: String -> ShmOpenFlags -> FileMode -> IO Fd

-- | Delete the shared memory object with the given name.
shmUnlink :: String -> IO ()


-- | POSIX signal support
module System.Posix.Signals
type Signal = CInt
nullSignal :: Signal

-- | Alias for <a>sigABRT</a>.
internalAbort :: Signal

-- | Process abort signal.
sigABRT :: CInt

-- | Alias for <a>sigALRM</a>.
realTimeAlarm :: Signal

-- | Alarm clock.
sigALRM :: CInt

-- | Alias for <a>sigBUS</a>.
busError :: Signal

-- | Access to an undefined portion of a memory object.
sigBUS :: CInt

-- | Alias for <a>sigCHLD</a>.
processStatusChanged :: Signal

-- | Child process terminated, stopped, or continued.
sigCHLD :: CInt

-- | Alias for <a>sigCONT</a>.
continueProcess :: Signal

-- | Continue executing, if stopped.
sigCONT :: CInt

-- | Alias for <a>sigFPE</a>.
floatingPointException :: Signal

-- | Erroneous arithmetic operation.
sigFPE :: CInt

-- | Alias for <a>sigHUP</a>.
lostConnection :: Signal

-- | Hangup.
sigHUP :: CInt

-- | Alias for <a>sigILL</a>.
illegalInstruction :: Signal

-- | Illegal instruction.
sigILL :: CInt

-- | Alias for <a>sigINT</a>.
keyboardSignal :: Signal

-- | Terminal interrupt signal.
sigINT :: CInt

-- | Alias for <a>sigKILL</a>.
killProcess :: Signal

-- | Kill (cannot be caught or ignored).
sigKILL :: CInt

-- | Alias for <a>sigPIPE</a>.
openEndedPipe :: Signal

-- | Write on a pipe with no one to read it.
sigPIPE :: CInt

-- | Alias for <a>sigQUIT</a>.
keyboardTermination :: Signal

-- | Terminal quit signal.
sigQUIT :: CInt

-- | Alias for <a>sigSEGV</a>.
segmentationViolation :: Signal

-- | Invalid memory reference.
sigSEGV :: CInt

-- | Alias for <a>sigSTOP</a>.
softwareStop :: Signal

-- | Stop executing (cannot be caught or ignored).
sigSTOP :: CInt

-- | Alias for <a>sigTERM</a>.
softwareTermination :: Signal

-- | Termination signal.
sigTERM :: CInt

-- | Alias for <a>sigTSTP</a>.
keyboardStop :: Signal

-- | Terminal stop signal.
sigTSTP :: CInt

-- | Alias for <a>sigTTIN</a>.
backgroundRead :: Signal

-- | Background process attempting read.
sigTTIN :: CInt

-- | Alias for <a>sigTTOU</a>.
backgroundWrite :: Signal

-- | Background process attempting write.
sigTTOU :: CInt

-- | Alias for <a>sigUSR1</a>.
userDefinedSignal1 :: Signal

-- | User-defined signal 1.
sigUSR1 :: CInt

-- | Alias for <a>sigUSR2</a>.
userDefinedSignal2 :: Signal

-- | User-defined signal 2.
sigUSR2 :: CInt

-- | Alias for <a>sigPOLL</a>.
pollableEvent :: Signal

-- | Pollable event.
sigPOLL :: CInt

-- | Alias for <a>sigPROF</a>.
profilingTimerExpired :: Signal

-- | Profiling timer expired.
sigPROF :: CInt

-- | Alias for <a>sigSYS</a>.
badSystemCall :: Signal

-- | Bad system call.
sigSYS :: CInt

-- | Alias for <a>sigTRAP</a>.
breakpointTrap :: Signal

-- | Trace/breakpoint trap.
sigTRAP :: CInt

-- | Alias for <a>sigURG</a>.
urgentDataAvailable :: Signal

-- | High bandwidth data is available at a socket.
sigURG :: CInt

-- | Alias for <a>sigVTALRM</a>.
virtualTimerExpired :: Signal

-- | Virtual timer expired.
sigVTALRM :: CInt

-- | Alias for <a>sigXCPU</a>.
cpuTimeLimitExceeded :: Signal

-- | CPU time limit exceeded.
sigXCPU :: CInt

-- | Alias for <a>sigXFSZ</a>.
fileSizeLimitExceeded :: Signal

-- | File size limit exceeded.
sigXFSZ :: CInt

-- | <tt>raiseSignal int</tt> calls <tt>kill</tt> to signal the current
°5uprocess with interrupt signal <tt>int</tt>.
raiseSignal :: Signal -> IO ()

-- | <tt>signalProcess int pid</tt> calls <tt>kill</tt> to signal process
°5u<tt>pid</tt> with interrupt signal <tt>int</tt>.
signalProcess :: Signal -> ProcessID -> IO ()

-- | <tt>signalProcessGroup int pgid</tt> calls <tt>kill</tt> to signal all
°5uprocesses in group <tt>pgid</tt> with interrupt signal <tt>int</tt>.
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 <tt>siginfo_t</tt>).
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
°5u<tt>siginfo_t</tt>).
data SignalSpecificInfo
NoSignalSpecificInfo :: SignalSpecificInfo
SigChldInfo :: ProcessID -> UserID -> ProcessStatus -> SignalSpecificInfo
[siginfoPid] :: SignalSpecificInfo -> ProcessID
[siginfoUid] :: SignalSpecificInfo -> UserID
[siginfoStatus] :: SignalSpecificInfo -> ProcessStatus

-- | <tt>installHandler int handler iset</tt> calls <tt>sigaction</tt> to
°5uinstall an interrupt handler for signal <tt>int</tt>. If
°5u<tt>handler</tt> is <tt>Default</tt>, <tt>SIG_DFL</tt> is installed;
°5uif <tt>handler</tt> is <tt>Ignore</tt>, <tt>SIG_IGN</tt> is installed;
°5uif <tt>handler</tt> is <tt>Catch action</tt>, a handler is installed
°5uwhich will invoke <tt>action</tt> in a new thread when (or shortly
°5uafter) the signal is received. If <tt>iset</tt> is <tt>Just s</tt>,
°5uthen the <tt>sa_mask</tt> of the <tt>sigaction</tt> structure is set
°5uto <tt>s</tt>; otherwise it is cleared. The previously installed
°5usignal handler for <tt>int</tt> 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
°5uwill normally include either <a>sigVTALRM</a> or <a>sigALRM</a>.
reservedSignals :: SignalSet
addSignal :: Signal -> SignalSet -> SignalSet
infixr 9 `addSignal`
deleteSignal :: Signal -> SignalSet -> SignalSet
infixr 9 `deleteSignal`
inSignalSet :: Signal -> SignalSet -> Bool

-- | <tt>getSignalMask</tt> calls <tt>sigprocmask</tt> to determine the set
°5uof interrupts which are currently being blocked.
getSignalMask :: IO SignalSet

-- | <tt>setSignalMask mask</tt> calls <tt>sigprocmask</tt> with
°5u<tt>SIG_SETMASK</tt> to block all interrupts in <tt>mask</tt>.
setSignalMask :: SignalSet -> IO ()

-- | <tt>blockSignals mask</tt> calls <tt>sigprocmask</tt> with
°5u<tt>SIG_BLOCK</tt> to add all interrupts in <tt>mask</tt> to the set
°5uof blocked interrupts.
blockSignals :: SignalSet -> IO ()

-- | <tt>unblockSignals mask</tt> calls <tt>sigprocmask</tt> with
°5u<tt>SIG_UNBLOCK</tt> to remove all interrupts in <tt>mask</tt> from
°5uthe set of blocked interrupts.
unblockSignals :: SignalSet -> IO ()

-- | <tt>scheduleAlarm i</tt> calls <tt>alarm</tt> to schedule a real time
°5ualarm at least <tt>i</tt> seconds in the future.
scheduleAlarm :: Int -> IO Int

-- | <tt>getPendingSignals</tt> calls <tt>sigpending</tt> to obtain the set
°5uof interrupts which have been received but are currently blocked.
getPendingSignals :: IO SignalSet

-- | <tt>awaitSignal iset</tt> suspends execution until an interrupt is
°5ureceived. If <tt>iset</tt> is <tt>Just s</tt>, <tt>awaitSignal</tt>
°5ucalls <tt>sigsuspend</tt>, installing <tt>s</tt> as the new signal
°5umask before suspending execution; otherwise, it calls
°5u<tt>sigsuspend</tt> with current signal mask. Note that RTS scheduler
°5usignal (either <a>virtualTimerExpired</a> or <a>realTimeAlarm</a>)
°5ucould cause premature termination of this call. It might be necessary
°5uto block that signal before invocation of <tt>awaitSignal</tt> with
°5u<a>blockSignals</a> <a>reservedSignals</a>.
°5u
°5u<tt>awaitSignal</tt> returns when signal was received and processed by
°5ua signal handler, or if the signal could not be caught. If you have
°5uinstalled any signal handlers with <tt>installHandler</tt>, it may be
°5uwise to call <tt>yield</tt> directly after <tt>awaitSignal</tt> to
°5uensure that the signal handler runs as promptly as possible.
awaitSignal :: Maybe SignalSet -> IO ()

-- | Tells the system whether or not to set the <tt>SA_NOCLDSTOP</tt> flag
°5uwhen 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
°5u<a>FilePath</a> is the (possibly relative) path of the created file,
°5uwhich is padded with 6 random characters. The argument is the desired
°5uprefix of the filepath of the temporary file to be created.
°5u
°5uIf you aren't using GHC or Hugs then this function simply wraps mktemp
°5uand 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
°5ureading/writing. The returned <a>FilePath</a> is the (possibly
°5urelative) path of the created file, which contains 6 random characters
°5uin between the prefix and suffix. The first argument is the desired
°5uprefix of the filepath of the temporary file to be created. The second
°5uargument is the suffix of the temporary file to be created.
°5u
°5uIf you are using as system that doesn't support the mkstemps glibc
°5ufunction (supported in glibc &gt; 2.11) then this function simply
°5uthrows an error.
mkstemps :: String -> String -> IO (FilePath, Handle)

-- | Make a unique directory. The returned <a>FilePath</a> is the path of
°5uthe created directory, which is padded with 6 random characters. The
°5uargument is the desired prefix of the filepath of the temporary
°5udirectory to be created.
°5u
°5uIf you are using as system that doesn't support the mkdtemp glibc
°5ufunction (supported in glibc &gt; 2.1.91) then this function uses
°5umktemp 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
°5u<a>RawFilePath</a> is the (possibly relative) path of the created
°5ufile, which is padded with 6 random characters. The argument is the
°5udesired prefix of the filepath of the temporary file to be created.
°5u
°5uIf you aren't using GHC or Hugs then this function simply wraps mktemp
°5uand so shouldn't be considered safe.
mkstemp :: ByteString -> IO (RawFilePath, Handle)

-- | <a>mkstemps</a> - make a unique filename with a given prefix and
°5usuffix and open it for reading/writing (only safe on GHC &amp; Hugs).
°5uThe returned <a>RawFilePath</a> is the (possibly relative) path of the
°5ucreated file, which contains 6 random characters in between the prefix
°5uand suffix.
mkstemps :: ByteString -> ByteString -> IO (RawFilePath, Handle)

-- | Make a unique directory. The returned <a>RawFilePath</a> is the path
°5uof the created directory, which is padded with 6 random characters.
°5uThe argument is the desired prefix of the filepath of the temporary
°5udirectory to be created.
°5u
°5uIf you aren't using GHC or Hugs then this function simply wraps mktemp
°5uand so shouldn't be considered safe.
mkdtemp :: ByteString -> IO RawFilePath


-- | POSIX Terminal support
module System.Posix.Terminal.ByteString
data TerminalAttributes

-- | <tt>getTerminalAttributes fd</tt> calls <tt>tcgetattr</tt> to obtain
°5uthe <tt>TerminalAttributes</tt> associated with <tt>Fd</tt>
°5u<tt>fd</tt>.
getTerminalAttributes :: Fd -> IO TerminalAttributes
data TerminalState
Immediately :: TerminalState
WhenDrained :: TerminalState
WhenFlushed :: TerminalState

-- | <tt>setTerminalAttributes fd attr ts</tt> calls <tt>tcsetattr</tt> to
°5uchange the <tt>TerminalAttributes</tt> associated with <tt>Fd</tt>
°5u<tt>fd</tt> to <tt>attr</tt>, when the terminal is in the state
°5uindicated by <tt>ts</tt>.
setTerminalAttributes :: Fd -> TerminalAttributes -> TerminalState -> IO ()
data TerminalMode

-- | <tt>BRKINT</tt> - Signal interrupt on break
InterruptOnBreak :: TerminalMode

-- | <tt>ICRNL</tt> - Map CR to NL on input
MapCRtoLF :: TerminalMode

-- | <tt>IGNBRK</tt> - Ignore break condition
IgnoreBreak :: TerminalMode

-- | <tt>IGNCR</tt> - Ignore CR
IgnoreCR :: TerminalMode

-- | <tt>IGNPAR</tt> - Ignore characters with parity errors
IgnoreParityErrors :: TerminalMode

-- | <tt>INLCR</tt> - Map NL to CR on input
MapLFtoCR :: TerminalMode

-- | <tt>INPCK</tt> - Enable input parity check
CheckParity :: TerminalMode

-- | <tt>ISTRIP</tt> - Strip character
StripHighBit :: TerminalMode

-- | <tt>IXANY</tt> - Enable any character to restart output
RestartOnAny :: TerminalMode

-- | <tt>IXOFF</tt> - Enable start/stop input control
StartStopInput :: TerminalMode

-- | <tt>IXON</tt> - Enable start/stop output control
StartStopOutput :: TerminalMode

-- | <tt>PARMRK</tt> - Mark parity errors
MarkParityErrors :: TerminalMode

-- | <tt>OPOST</tt> - Post-process output
ProcessOutput :: TerminalMode

-- | <tt>ONLCR</tt> - (XSI) Map NL to CR-NL on output
MapLFtoCRLF :: TerminalMode

-- | <tt>OCRNL</tt> - (XSI) Map CR to NL on output
OutputMapCRtoLF :: TerminalMode

-- | <tt>ONOCR</tt> - (XSI) No CR output at column 0
NoCRAtColumnZero :: TerminalMode

-- | <tt>ONLRET</tt> - (XSI) NL performs CR function
ReturnMeansLF :: TerminalMode

-- | <tt>TABDLY(TAB0)</tt> - (XSI) Select horizontal-tab delays: type 0
TabDelayMask0 :: TerminalMode

-- | <tt>TABDLY(TAB3)</tt> - (XSI) Select horizontal-tab delays: type 3
TabDelayMask3 :: TerminalMode

-- | <tt>CLOCAL</tt> - Ignore modem status lines
LocalMode :: TerminalMode

-- | <tt>CREAD</tt> - Enable receiver
ReadEnable :: TerminalMode

-- | <tt>CSTOPB</tt> - Send two stop bits, else one
TwoStopBits :: TerminalMode

-- | <tt>HUPCL</tt> - Hang up on last close
HangupOnClose :: TerminalMode

-- | <tt>PARENB</tt> - Parity enable
EnableParity :: TerminalMode

-- | <tt>PARODD</tt> - Odd parity, else even
OddParity :: TerminalMode

-- | <tt>ECHO</tt> - Enable echo
EnableEcho :: TerminalMode

-- | <tt>ECHOE</tt> - Echo erase character as error-correcting backspace
EchoErase :: TerminalMode

-- | <tt>ECHOK</tt> - Echo KILL
EchoKill :: TerminalMode

-- | <tt>ECHONL</tt> - Echo NL
EchoLF :: TerminalMode

-- | <tt>ICANON</tt> - Canonical input (erase and kill processing)
ProcessInput :: TerminalMode

-- | <tt>IEXTEN</tt> - Enable extended input character processing
ExtendedFunctions :: TerminalMode

-- | <tt>ISIG</tt> - Enable signals
KeyboardInterrupts :: TerminalMode

-- | <tt>NOFLSH</tt> - Disable flush after interrupt or quit
NoFlushOnInterrupt :: TerminalMode

-- | <tt>TOSTOP</tt> - Send <tt>SIGTTOU</tt> for background output
BackgroundWriteInterrupt :: TerminalMode
withoutMode :: TerminalAttributes -> TerminalMode -> TerminalAttributes
withMode :: TerminalAttributes -> TerminalMode -> TerminalAttributes
terminalMode :: TerminalMode -> TerminalAttributes -> Bool
bitsPerByte :: TerminalAttributes -> Int
withBits :: TerminalAttributes -> Int -> TerminalAttributes
data ControlCharacter
EndOfFile :: ControlCharacter
EndOfLine :: ControlCharacter
Erase :: ControlCharacter
Interrupt :: ControlCharacter
Kill :: ControlCharacter
Quit :: ControlCharacter
Start :: ControlCharacter
Stop :: ControlCharacter
Suspend :: ControlCharacter
controlChar :: TerminalAttributes -> ControlCharacter -> Maybe Char
withCC :: TerminalAttributes -> (ControlCharacter, Char) -> TerminalAttributes
withoutCC :: TerminalAttributes -> ControlCharacter -> TerminalAttributes
inputTime :: TerminalAttributes -> Int
withTime :: TerminalAttributes -> Int -> TerminalAttributes
minInput :: TerminalAttributes -> Int
withMinInput :: TerminalAttributes -> Int -> TerminalAttributes
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

-- | <tt>sendBreak fd duration</tt> calls <tt>tcsendbreak</tt> to transmit
°5ua continuous stream of zero-valued bits on <tt>Fd</tt> <tt>fd</tt> for
°5uthe specified implementation-dependent <tt>duration</tt>.
sendBreak :: Fd -> Int -> IO ()

-- | <tt>drainOutput fd</tt> calls <tt>tcdrain</tt> to block until all
°5uoutput written to <tt>Fd</tt> <tt>fd</tt> has been transmitted.
°5u
°5uThrows <a>IOError</a> ("unsupported operation") if platform does not
°5uprovide <tt>tcdrain(3)</tt> (use <tt>#if HAVE_TCDRAIN</tt> CPP guard
°5uto detect availability).
drainOutput :: Fd -> IO ()
data QueueSelector
InputQueue :: QueueSelector
OutputQueue :: QueueSelector
BothQueues :: QueueSelector

-- | <tt>discardData fd queues</tt> calls <tt>tcflush</tt> to discard
°5upending input and/or output for <tt>Fd</tt> <tt>fd</tt>, as indicated
°5uby the <tt>QueueSelector</tt> <tt>queues</tt>.
discardData :: Fd -> QueueSelector -> IO ()
data FlowAction

-- | TCOOFF
SuspendOutput :: FlowAction

-- | TCOON
RestartOutput :: FlowAction

-- | TCIOFF
TransmitStop :: FlowAction

-- | TCION
TransmitStart :: FlowAction

-- | <tt>controlFlow fd action</tt> calls <tt>tcflow</tt> to control the
°5uflow of data on <tt>Fd</tt> <tt>fd</tt>, as indicated by
°5u<tt>action</tt>.
controlFlow :: Fd -> FlowAction -> IO ()

-- | <tt>getTerminalProcessGroupID fd</tt> calls <tt>tcgetpgrp</tt> to
°5uobtain the <tt>ProcessGroupID</tt> of the foreground process group
°5uassociated with the terminal attached to <tt>Fd</tt> <tt>fd</tt>.
getTerminalProcessGroupID :: Fd -> IO ProcessGroupID

-- | <tt>setTerminalProcessGroupID fd pgid</tt> calls <tt>tcsetpgrp</tt> to
°5uset the <tt>ProcessGroupID</tt> of the foreground process group
°5uassociated with the terminal attached to <tt>Fd</tt> <tt>fd</tt> to
°5u<tt>pgid</tt>.
setTerminalProcessGroupID :: Fd -> ProcessGroupID -> IO ()

-- | <tt>queryTerminal fd</tt> calls <tt>isatty</tt> to determine whether
°5uor not <tt>Fd</tt> <tt>fd</tt> is associated with a terminal.
queryTerminal :: Fd -> IO Bool

-- | <tt>getTerminalName fd</tt> calls <tt>ttyname</tt> to obtain a name
°5uassociated with the terminal for <tt>Fd</tt> <tt>fd</tt>. If
°5u<tt>fd</tt> is associated with a terminal, <tt>getTerminalName</tt>
°5ureturns the name of the terminal.
getTerminalName :: Fd -> IO RawFilePath

-- | <tt>getControllingTerminalName</tt> calls <tt>ctermid</tt> to obtain a
°5uname associated with the controlling terminal for the process. If a
°5ucontrolling terminal exists, <tt>getControllingTerminalName</tt>
°5ureturns the name of the controlling terminal.
°5u
°5uThrows <a>IOError</a> ("unsupported operation") if platform does not
°5uprovide <tt>ctermid(3)</tt> (use <tt>#if HAVE_CTERMID</tt> CPP guard
°5uto detect availability).
getControllingTerminalName :: IO RawFilePath

-- | <tt>openPseudoTerminal</tt> creates a pseudoterminal (pty) pair, and
°5ureturns the newly created pair as a (<tt>master</tt>, <tt>slave</tt>)
°5utuple.
openPseudoTerminal :: IO (Fd, Fd)

-- | <tt>getSlaveTerminalName</tt> calls <tt>ptsname</tt> to obtain the
°5uname of the slave terminal associated with a pseudoterminal pair. The
°5ufile descriptor to pass in must be that of the master.
getSlaveTerminalName :: Fd -> IO RawFilePath


-- | POSIX Terminal support
module System.Posix.Terminal
data TerminalAttributes

-- | <tt>getTerminalAttributes fd</tt> calls <tt>tcgetattr</tt> to obtain
°5uthe <tt>TerminalAttributes</tt> associated with <tt>Fd</tt>
°5u<tt>fd</tt>.
getTerminalAttributes :: Fd -> IO TerminalAttributes
data TerminalState
Immediately :: TerminalState
WhenDrained :: TerminalState
WhenFlushed :: TerminalState

-- | <tt>setTerminalAttributes fd attr ts</tt> calls <tt>tcsetattr</tt> to
°5uchange the <tt>TerminalAttributes</tt> associated with <tt>Fd</tt>
°5u<tt>fd</tt> to <tt>attr</tt>, when the terminal is in the state
°5uindicated by <tt>ts</tt>.
setTerminalAttributes :: Fd -> TerminalAttributes -> TerminalState -> IO ()
data TerminalMode

-- | <tt>BRKINT</tt> - Signal interrupt on break
InterruptOnBreak :: TerminalMode

-- | <tt>ICRNL</tt> - Map CR to NL on input
MapCRtoLF :: TerminalMode

-- | <tt>IGNBRK</tt> - Ignore break condition
IgnoreBreak :: TerminalMode

-- | <tt>IGNCR</tt> - Ignore CR
IgnoreCR :: TerminalMode

-- | <tt>IGNPAR</tt> - Ignore characters with parity errors
IgnoreParityErrors :: TerminalMode

-- | <tt>INLCR</tt> - Map NL to CR on input
MapLFtoCR :: TerminalMode

-- | <tt>INPCK</tt> - Enable input parity check
CheckParity :: TerminalMode

-- | <tt>ISTRIP</tt> - Strip character
StripHighBit :: TerminalMode

-- | <tt>IXANY</tt> - Enable any character to restart output
RestartOnAny :: TerminalMode

-- | <tt>IXOFF</tt> - Enable start/stop input control
StartStopInput :: TerminalMode

-- | <tt>IXON</tt> - Enable start/stop output control
StartStopOutput :: TerminalMode

-- | <tt>PARMRK</tt> - Mark parity errors
MarkParityErrors :: TerminalMode

-- | <tt>OPOST</tt> - Post-process output
ProcessOutput :: TerminalMode

-- | <tt>ONLCR</tt> - (XSI) Map NL to CR-NL on output
MapLFtoCRLF :: TerminalMode

-- | <tt>OCRNL</tt> - (XSI) Map CR to NL on output
OutputMapCRtoLF :: TerminalMode

-- | <tt>ONOCR</tt> - (XSI) No CR output at column 0
NoCRAtColumnZero :: TerminalMode

-- | <tt>ONLRET</tt> - (XSI) NL performs CR function
ReturnMeansLF :: TerminalMode

-- | <tt>TABDLY(TAB0)</tt> - (XSI) Select horizontal-tab delays: type 0
TabDelayMask0 :: TerminalMode

-- | <tt>TABDLY(TAB3)</tt> - (XSI) Select horizontal-tab delays: type 3
TabDelayMask3 :: TerminalMode

-- | <tt>CLOCAL</tt> - Ignore modem status lines
LocalMode :: TerminalMode

-- | <tt>CREAD</tt> - Enable receiver
ReadEnable :: TerminalMode

-- | <tt>CSTOPB</tt> - Send two stop bits, else one
TwoStopBits :: TerminalMode

-- | <tt>HUPCL</tt> - Hang up on last close
HangupOnClose :: TerminalMode

-- | <tt>PARENB</tt> - Parity enable
EnableParity :: TerminalMode

-- | <tt>PARODD</tt> - Odd parity, else even
OddParity :: TerminalMode

-- | <tt>ECHO</tt> - Enable echo
EnableEcho :: TerminalMode

-- | <tt>ECHOE</tt> - Echo erase character as error-correcting backspace
EchoErase :: TerminalMode

-- | <tt>ECHOK</tt> - Echo KILL
EchoKill :: TerminalMode

-- | <tt>ECHONL</tt> - Echo NL
EchoLF :: TerminalMode

-- | <tt>ICANON</tt> - Canonical input (erase and kill processing)
ProcessInput :: TerminalMode

-- | <tt>IEXTEN</tt> - Enable extended input character processing
ExtendedFunctions :: TerminalMode

-- | <tt>ISIG</tt> - Enable signals
KeyboardInterrupts :: TerminalMode

-- | <tt>NOFLSH</tt> - Disable flush after interrupt or quit
NoFlushOnInterrupt :: TerminalMode

-- | <tt>TOSTOP</tt> - Send <tt>SIGTTOU</tt> for background output
BackgroundWriteInterrupt :: TerminalMode
withoutMode :: TerminalAttributes -> TerminalMode -> TerminalAttributes
withMode :: TerminalAttributes -> TerminalMode -> TerminalAttributes
terminalMode :: TerminalMode -> TerminalAttributes -> Bool
bitsPerByte :: TerminalAttributes -> Int
withBits :: TerminalAttributes -> Int -> TerminalAttributes
data ControlCharacter
EndOfFile :: ControlCharacter
EndOfLine :: ControlCharacter
Erase :: ControlCharacter
Interrupt :: ControlCharacter
Kill :: ControlCharacter
Quit :: ControlCharacter
Start :: ControlCharacter
Stop :: ControlCharacter
Suspend :: ControlCharacter
controlChar :: TerminalAttributes -> ControlCharacter -> Maybe Char
withCC :: TerminalAttributes -> (ControlCharacter, Char) -> TerminalAttributes
withoutCC :: TerminalAttributes -> ControlCharacter -> TerminalAttributes
inputTime :: TerminalAttributes -> Int
withTime :: TerminalAttributes -> Int -> TerminalAttributes
minInput :: TerminalAttributes -> Int
withMinInput :: TerminalAttributes -> Int -> TerminalAttributes
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

-- | <tt>sendBreak fd duration</tt> calls <tt>tcsendbreak</tt> to transmit
°5ua continuous stream of zero-valued bits on <tt>Fd</tt> <tt>fd</tt> for
°5uthe specified implementation-dependent <tt>duration</tt>.
sendBreak :: Fd -> Int -> IO ()

-- | <tt>drainOutput fd</tt> calls <tt>tcdrain</tt> to block until all
°5uoutput written to <tt>Fd</tt> <tt>fd</tt> has been transmitted.
°5u
°5uThrows <a>IOError</a> ("unsupported operation") if platform does not
°5uprovide <tt>tcdrain(3)</tt> (use <tt>#if HAVE_TCDRAIN</tt> CPP guard
°5uto detect availability).
drainOutput :: Fd -> IO ()
data QueueSelector
InputQueue :: QueueSelector
OutputQueue :: QueueSelector
BothQueues :: QueueSelector

-- | <tt>discardData fd queues</tt> calls <tt>tcflush</tt> to discard
°5upending input and/or output for <tt>Fd</tt> <tt>fd</tt>, as indicated
°5uby the <tt>QueueSelector</tt> <tt>queues</tt>.
discardData :: Fd -> QueueSelector -> IO ()
data FlowAction

-- | TCOOFF
SuspendOutput :: FlowAction

-- | TCOON
RestartOutput :: FlowAction

-- | TCIOFF
TransmitStop :: FlowAction

-- | TCION
TransmitStart :: FlowAction

-- | <tt>controlFlow fd action</tt> calls <tt>tcflow</tt> to control the
°5uflow of data on <tt>Fd</tt> <tt>fd</tt>, as indicated by
°5u<tt>action</tt>.
controlFlow :: Fd -> FlowAction -> IO ()

-- | <tt>getTerminalProcessGroupID fd</tt> calls <tt>tcgetpgrp</tt> to
°5uobtain the <tt>ProcessGroupID</tt> of the foreground process group
°5uassociated with the terminal attached to <tt>Fd</tt> <tt>fd</tt>.
getTerminalProcessGroupID :: Fd -> IO ProcessGroupID

-- | <tt>setTerminalProcessGroupID fd pgid</tt> calls <tt>tcsetpgrp</tt> to
°5uset the <tt>ProcessGroupID</tt> of the foreground process group
°5uassociated with the terminal attached to <tt>Fd</tt> <tt>fd</tt> to
°5u<tt>pgid</tt>.
setTerminalProcessGroupID :: Fd -> ProcessGroupID -> IO ()

-- | <tt>queryTerminal fd</tt> calls <tt>isatty</tt> to determine whether
°5uor not <tt>Fd</tt> <tt>fd</tt> is associated with a terminal.
queryTerminal :: Fd -> IO Bool

-- | <tt>getTerminalName fd</tt> calls <tt>ttyname</tt> to obtain a name
°5uassociated with the terminal for <tt>Fd</tt> <tt>fd</tt>. If
°5u<tt>fd</tt> is associated with a terminal, <tt>getTerminalName</tt>
°5ureturns the name of the terminal.
getTerminalName :: Fd -> IO FilePath

-- | <tt>getControllingTerminalName</tt> calls <tt>ctermid</tt> to obtain a
°5uname associated with the controlling terminal for the process. If a
°5ucontrolling terminal exists, <tt>getControllingTerminalName</tt>
°5ureturns the name of the controlling terminal.
°5u
°5uThrows <a>IOError</a> ("unsupported operation") if platform does not
°5uprovide <tt>ctermid(3)</tt> (use <tt>#if HAVE_CTERMID</tt> CPP guard
°5uto detect availability).
getControllingTerminalName :: IO FilePath

-- | <tt>openPseudoTerminal</tt> creates a pseudoterminal (pty) pair, and
°5ureturns the newly created pair as a (<tt>master</tt>, <tt>slave</tt>)
°5utuple.
openPseudoTerminal :: IO (Fd, Fd)

-- | <tt>getSlaveTerminalName</tt> calls <tt>ptsname</tt> to obtain the
°5uname of the slave terminal associated with a pseudoterminal pair. The
°5ufile descriptor to pass in must be that of the master.
getSlaveTerminalName :: Fd -> IO FilePath


-- | POSIX Time support
module System.Posix.Time

-- | <tt>epochTime</tt> calls <tt>time</tt> to obtain the number of seconds
°5uthat 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
°5uremaining (if the sleep was interrupted by a signal, for example).
°5u
°5u<i>GHC Note</i>: <a>threadDelay</a> is a better choice. Since GHC uses
°5usignals for its internal clock, a call to <a>sleep</a> will usually be
°5uinterrupted immediately. That makes <a>sleep</a> unusable in a program
°5ucompiled with GHC, unless the RTS timer is disabled (with <tt>+RTS
°5u-V0</tt>). Furthermore, without the <tt>-threaded</tt> option,
°5u<a>sleep</a> will block all other user threads. Even with the
°5u<tt>-threaded</tt> option, <a>sleep</a> requires a full OS thread to
°5uitself. <a>threadDelay</a> has none of these shortcomings.

-- | <i>Warning: This function has several shortcomings (see
°5udocumentation). Please consider using Control.Concurrent.threadDelay
°5uinstead.</i>
sleep :: Int -> IO Int

-- | Sleep for the specified duration (in microseconds).
°5u
°5u<i>GHC Note</i>: <a>threadDelay</a> is a better choice. Without the
°5u<tt>-threaded</tt> option, <a>usleep</a> will block all other user
°5uthreads. Even with the <tt>-threaded</tt> option, <a>usleep</a>
°5urequires a full OS thread to itself. <a>threadDelay</a> has neither of
°5uthese shortcomings.
usleep :: Int -> IO ()

-- | Sleep for the specified duration (in nanoseconds)
°5u
°5u<i>GHC Note</i>: the comment for <a>usleep</a> also applies here.
nanosleep :: Integer -> IO ()

-- | Performs <tt>fsync(2)</tt> operation on file-descriptor.
°5u
°5uThrows <a>IOError</a> ("unsupported operation") if platform does not
°5uprovide <tt>fsync(2)</tt> (use <tt>#if HAVE_FSYNC</tt> CPP guard to
°5udetect availability).
fileSynchronise :: Fd -> IO ()

-- | Performs <tt>fdatasync(2)</tt> operation on file-descriptor.
°5u
°5uThrows <a>IOError</a> ("unsupported operation") if platform does not
°5uprovide <tt>fdatasync(2)</tt> (use <tt>#if HAVE_FDATASYNC</tt> CPP
°5uguard to detect availability).
fileSynchroniseDataOnly :: Fd -> IO ()


-- | POSIX user/group support
module System.Posix.User

-- | <tt>getRealUserID</tt> calls <tt>getuid</tt> to obtain the real
°5u<tt>UserID</tt> associated with the current process.
getRealUserID :: IO UserID

-- | <tt>getRealGroupID</tt> calls <tt>getgid</tt> to obtain the real
°5u<tt>GroupID</tt> associated with the current process.
getRealGroupID :: IO GroupID

-- | <tt>getEffectiveUserID</tt> calls <tt>geteuid</tt> to obtain the
°5ueffective <tt>UserID</tt> associated with the current process.
getEffectiveUserID :: IO UserID

-- | <tt>getEffectiveGroupID</tt> calls <tt>getegid</tt> to obtain the
°5ueffective <tt>GroupID</tt> associated with the current process.
getEffectiveGroupID :: IO GroupID

-- | <tt>getGroups</tt> calls <tt>getgroups</tt> to obtain the list of
°5usupplementary <tt>GroupID</tt>s associated with the current process.
getGroups :: IO [GroupID]

-- | <tt>getLoginName</tt> calls <tt>getlogin</tt> to obtain the login name
°5uassociated with the current process.
getLoginName :: IO String

-- | <tt>getEffectiveUserName</tt> gets the name associated with the
°5ueffective <tt>UserID</tt> 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]

-- | <tt>getGroupEntryForID gid</tt> calls <tt>getgrgid_r</tt> to obtain
°5uthe <tt>GroupEntry</tt> information associated with <tt>GroupID</tt>
°5u<tt>gid</tt>. This operation may fail with <a>isDoesNotExistError</a>
°5uif no such group exists.
getGroupEntryForID :: GroupID -> IO GroupEntry

-- | <tt>getGroupEntryForName name</tt> calls <tt>getgrnam_r</tt> to obtain
°5uthe <tt>GroupEntry</tt> information associated with the group called
°5u<tt>name</tt>. This operation may fail with <a>isDoesNotExistError</a>
°5uif no such group exists.
getGroupEntryForName :: String -> IO GroupEntry

-- | <tt>getAllGroupEntries</tt> returns all group entries on the system by
°5urepeatedly calling <tt>getgrent</tt>
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

-- | <tt>getUserEntryForID gid</tt> calls <tt>getpwuid_r</tt> to obtain the
°5u<tt>UserEntry</tt> information associated with <tt>UserID</tt>
°5u<tt>uid</tt>. This operation may fail with <a>isDoesNotExistError</a>
°5uif no such user exists.
getUserEntryForID :: UserID -> IO UserEntry

-- | <tt>getUserEntryForName name</tt> calls <tt>getpwnam_r</tt> to obtain
°5uthe <tt>UserEntry</tt> information associated with the user login
°5u<tt>name</tt>. This operation may fail with <a>isDoesNotExistError</a>
°5uif no such user exists.
getUserEntryForName :: String -> IO UserEntry

-- | <tt>getAllUserEntries</tt> returns all user entries on the system by
°5urepeatedly calling <tt>getpwent</tt>
getAllUserEntries :: IO [UserEntry]

-- | <tt>setUserID uid</tt> calls <tt>setuid</tt> to set the real,
°5ueffective, and saved set-user-id associated with the current process
°5uto <tt>uid</tt>.
setUserID :: UserID -> IO ()

-- | <tt>setGroupID gid</tt> calls <tt>setgid</tt> to set the real,
°5ueffective, and saved set-group-id associated with the current process
°5uto <tt>gid</tt>.
setGroupID :: GroupID -> IO ()

-- | <tt>setEffectiveUserID uid</tt> calls <tt>seteuid</tt> to set the
°5ueffective user-id associated with the current process to <tt>uid</tt>.
°5uThis does not update the real user-id or set-user-id.
setEffectiveUserID :: UserID -> IO ()

-- | <tt>setEffectiveGroupID uid</tt> calls <tt>setegid</tt> to set the
°5ueffective group-id associated with the current process to
°5u<tt>gid</tt>. This does not update the real group-id or set-group-id.
setEffectiveGroupID :: GroupID -> IO ()

-- | <tt>setGroups</tt> calls <tt>setgroups</tt> to set the list of
°5usupplementary <tt>GroupID</tt>s 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


-- | <a>POSIX.1-2008</a> support with <tt>ByteString</tt> file paths and
°5uenvironment strings.
°5u
°5uThis module exports exactly the same API as <a>System.Posix</a>,
°5uexcept that all file paths and environment strings are represented by
°5u<tt>ByteString</tt> instead of <a>String</a>. The <a>System.Posix</a>
°5uAPI implicitly translates all file paths and environment strings using
°5uthe locale encoding, whereas this version of the API does no encoding
°5uor decoding and works directly in terms of raw bytes.
°5u
°5uNote that if you do need to interpret file paths or environment
°5ustrings as text, then some Unicode encoding or decoding should be
°5uapplied first.
module System.Posix.ByteString

-- | A literal POSIX file path
type RawFilePath = ByteString

-- | Flags for <a>dlsym</a>. Notice that <a>Next</a> might not be available
°5uon your particular platform! Use <a>haveRtldNext</a>.
°5u
°5uIf <tt>RTLD_DEFAULT</tt> is not defined on your platform,
°5u<a>packDL</a> <a>Default</a> reduces to <a>nullPtr</a>.
data DL
Null :: DL
Next :: DL
DLHandle :: (Ptr ()) -> DL

-- | Flags for <a>dlopen</a>.
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) <tt>RTLD_NEXT</tt> (and
°5u<tt>RTLD_DEFAULT</tt>) are not visible without setting the macro
°5u<tt>_GNU_SOURCE</tt>. Since we don't want to define this macro, you
°5ucan use the function <a>haveRtldNext</a> to check wether the flag
°5u<a>Next</a> is available. Ideally, this will be optimized by the
°5ucompiler so that it should be as efficient as an <tt>#ifdef</tt>.
°5u
°5uIf you fail to test the flag and use it although it is undefined,
°5u<a>packDL</a> will throw an error.
haveRtldNext :: Bool

-- | <i>Deprecated: defaults to True</i>
haveRtldLocal :: Bool
packRTLDFlags :: [RTLDFlags] -> CInt
packDL :: DL -> Ptr ()
dlclose :: DL -> IO ()
dlerror :: IO String

-- | <a>dlsym</a> returns the address binding of the symbol described in
°5u<tt>symbol</tt>, as it occurs in the shared object identified by
°5u<tt>source</tt>.
dlsym :: DL -> String -> IO (FunPtr a)

-- | <a>undl</a> obtains the raw handle. You mustn't do something like
°5u<tt>withDL mod flags $ liftM undl &gt;&gt;= p -&gt; use p</tt>
undl :: DL -> Ptr ()
dlopen :: RawFilePath -> [RTLDFlags] -> IO DL
withDL :: RawFilePath -> [RTLDFlags] -> (DL -> IO a) -> IO a
withDL_ :: RawFilePath -> [RTLDFlags] -> (DL -> IO a) -> IO ()


-- | <a>POSIX.1-2008</a> support
module System.Posix

-- | Flags for <a>dlsym</a>. Notice that <a>Next</a> might not be available
°5uon your particular platform! Use <a>haveRtldNext</a>.
°5u
°5uIf <tt>RTLD_DEFAULT</tt> is not defined on your platform,
°5u<a>packDL</a> <a>Default</a> reduces to <a>nullPtr</a>.
data DL
Null :: DL
Next :: DL
DLHandle :: (Ptr ()) -> DL

-- | Flags for <a>dlopen</a>.
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) <tt>RTLD_NEXT</tt> (and
°5u<tt>RTLD_DEFAULT</tt>) are not visible without setting the macro
°5u<tt>_GNU_SOURCE</tt>. Since we don't want to define this macro, you
°5ucan use the function <a>haveRtldNext</a> to check wether the flag
°5u<a>Next</a> is available. Ideally, this will be optimized by the
°5ucompiler so that it should be as efficient as an <tt>#ifdef</tt>.
°5u
°5uIf you fail to test the flag and use it although it is undefined,
°5u<a>packDL</a> will throw an error.
haveRtldNext :: Bool

-- | <i>Deprecated: defaults to True</i>
haveRtldLocal :: Bool
packRTLDFlags :: [RTLDFlags] -> CInt
packDL :: DL -> Ptr ()
dlclose :: DL -> IO ()
dlerror :: IO String

-- | <a>dlsym</a> returns the address binding of the symbol described in
°5u<tt>symbol</tt>, as it occurs in the shared object identified by
°5u<tt>source</tt>.
dlsym :: DL -> String -> IO (FunPtr a)

-- | <a>undl</a> obtains the raw handle. You mustn't do something like
°5u<tt>withDL mod flags $ liftM undl &gt;&gt;= p -&gt; use p</tt>
undl :: DL -> Ptr ()
dlopen :: FilePath -> [RTLDFlags] -> IO DL
withDL :: String -> [RTLDFlags] -> (DL -> IO a) -> IO a
withDL_ :: String -> [RTLDFlags] -> (DL -> IO a) -> IO ()
