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


-- | POSIX functionality
gr
grThis package gives you access to the set of operating system services
grstandardised by <a>POSIX.1-2008</a> (or the IEEE Portable Operating
grSystem Interface for Computing Environments - IEEE Std. 1003.1).
gr
grThe 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
grappropriate.
throwErrnoPath :: String -> RawFilePath -> IO a

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

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

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

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

-- | as <a>throwErrnoIfMinus1_</a>, but exceptions include the given path
grwhen 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
grdirectory, <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
grdirectory stream for <tt>dir</tt>.
openDirStream :: RawFilePath -> IO DirStream

-- | <tt>readDirStream dp</tt> calls <tt>readdir</tt> to obtain the next
grdirectory entry (<tt>struct dirent</tt>) for the open directory stream
gr<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
grdirectory stream <tt>dp</tt> at the beginning of the directory.
rewindDirStream :: DirStream -> IO ()

-- | <tt>closeDirStream dp</tt> calls <tt>closedir</tt> to close the
grdirectory 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
grof the current working directory.
getWorkingDirectory :: IO RawFilePath

-- | <tt>changeWorkingDirectory dir</tt> calls <tt>chdir</tt> to change the
grcurrent 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
grM.Weber &amp; M.Chakravarty which is part of c2hs. I left the API more
gror 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
gr<tt>RTLD_DEFAULT</tt>) are not visible without setting the macro
gr<tt>_GNU_SOURCE</tt>. Since we don't want to define this macro, you
grcan use the function <a>haveRtldNext</a> to check wether the flag
gr<a>Next</a> is available. Ideally, this will be optimized by the
grcompiler so that it should be as efficient as an <tt>#ifdef</tt>.
gr
grIf you fail to test the flag and use it although it is undefined,
gr<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
gron your particular platform! Use <a>haveRtldNext</a>.
gr
grIf <tt>RTLD_DEFAULT</tt> is not defined on your platform,
gr<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
gr<tt>symbol</tt>, as it occurs in the shared object identified by
gr<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
gr<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
gr<tt>symbol</tt>, as it occurs in the shared object identified by
gr<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
gr<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;
grM.Chakravarty which is part of c2hs I left the API more or less the
grsame, 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;
grM.Chakravarty which is part of c2hs I left the API more or less the
grsame, 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
grprogrammer can specify a fallback if the variable is not found in the
grenvironment.
getEnvDefault :: String -> String -> IO String
getEnvironmentPrim :: IO [String]

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

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

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

-- | The <a>setEnv</a> function inserts or resets the environment variable
grname in the current environment list. If the variable <tt>name</tt>
grdoes not exist in the list, it is inserted with the given value. If
grthe variable does exist, the argument <tt>overwrite</tt> is tested; if
gr<tt>overwrite</tt> is <tt>False</tt>, the variable is not reset,
grotherwise it is reset to the given value.
setEnv :: String -> String -> Bool -> IO ()

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

-- | The <a>clearEnv</a> function clears the environment of all name-value
grpairs.
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
grprogrammer can specify a fallback if the variable is not found in the
grenvironment.
getEnvDefault :: ByteString -> ByteString -> IO ByteString
getEnvironmentPrim :: IO [ByteString]

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

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

-- | The <a>setEnv</a> function inserts or resets the environment variable
grname in the current environment list. If the variable <tt>name</tt>
grdoes not exist in the list, it is inserted with the given value. If
grthe variable does exist, the argument <tt>overwrite</tt> is tested; if
gr<tt>overwrite</tt> is <tt>False</tt>, the variable is not reset,
grotherwise it is reset to the given value.
setEnv :: ByteString -> ByteString -> Bool -> IO ()

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

-- | Computation <a>getArgs</a> returns a list of the program's command
grline arguments (not including the program name), as
gr<a>ByteString</a>s.
gr
grUnlike <a>getArgs</a>, this function does no Unicode decoding of the
grarguments; you get the exact bytes that were passed to the program by
grthe OS. To interpret the arguments as text, some Unicode decoding
grshould be applied.
getArgs :: IO [ByteString]


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

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

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

-- | as <a>throwErrnoIf_</a>, but exceptions include the given path when
grappropriate.
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
grappropriate.
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
grwhen appropriate.
throwErrnoPathIfMinus1 :: (Eq a, Num a) => String -> FilePath -> IO a -> IO a

-- | as <a>throwErrnoIfMinus1_</a>, but exceptions include the given path
grwhen 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
grdirectory, <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
grdirectory stream for <tt>dir</tt>.
openDirStream :: FilePath -> IO DirStream

-- | <tt>readDirStream dp</tt> calls <tt>readdir</tt> to obtain the next
grdirectory entry (<tt>struct dirent</tt>) for the open directory stream
gr<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
grdirectory stream <tt>dp</tt> at the beginning of the directory.
rewindDirStream :: DirStream -> IO ()

-- | <tt>closeDirStream dp</tt> calls <tt>closedir</tt> to close the
grdirectory 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
grof the current working directory.
getWorkingDirectory :: IO FilePath

-- | <tt>changeWorkingDirectory dir</tt> calls <tt>chdir</tt> to change the
grcurrent 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.
gr
grFor 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.
gr
grIf platform does not provide <tt>posix_fadvise(2)</tt>
gr<a>fileAdvise</a> becomes a no-op.
gr
gr(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.
gr
grThrows <a>IOError</a> ("unsupported operation") if platform does not
grprovide <tt>posix_fallocate(2)</tt>.
gr
gr(use <tt>#if HAVE_POSIX_FALLOCATE</tt> CPP guard to detect
gravailability).
fileAllocate :: Fd -> FileOffset -> FileOffset -> IO ()
instance GHC.Classes.Eq System.Posix.Fcntl.Advice


-- | Functions defined by the POSIX standards for manipulating and querying
grthe file system. Names of underlying POSIX functions are indicated
grwhenever possible. A more complete documentation of the POSIX
grfunctions together with a more detailed description of different error
grconditions are usually available in the system's manual pages or from
gr<a>http://www.unix.org/version3/online.html</a> (free registration
grrequired).
gr
grWhen a function that calls an underlying POSIX function fails, the
grerrno code is converted to an <a>IOError</a> using
gr<a>errnoToIOError</a>. For a list of which errno codes may be
grgenerated, consult the POSIX documentation for the underlying
grfunction.
module System.Posix.Files.ByteString

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

-- | Combines two file modes into one that only contains modes that appear
grin 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
gr<tt>path</tt> to <tt>mode</tt>. This operation may fail with
gr<a>throwErrnoPathIfMinus1_</a> if <tt>path</tt> doesn't exist or if
grthe effective user ID of the current process is not that of the file's
growner.
gr
grNote: calls <tt>chmod</tt>.
setFileMode :: RawFilePath -> FileMode -> IO ()

-- | <tt>setFdMode fd mode</tt> acts like <tt>setFileMode</tt> but uses a
grfile descriptor <tt>fd</tt> instead of a <a>FilePath</a>.
gr
grNote: calls <tt>fchmod</tt>.
setFdMode :: Fd -> FileMode -> IO ()

-- | <tt>setFileCreationMask mode</tt> sets the file mode creation mask to
gr<tt>mode</tt>. Modes set by this operation are subtracted from files
grand directories upon creation. The previous file creation mask is
grreturned.
gr
grNote: calls <tt>umask</tt>.
setFileCreationMask :: FileMode -> IO FileMode

-- | <tt>fileAccess name read write exec</tt> checks if the file (or other
grfile system object) <tt>name</tt> can be accessed for reading, writing
grand/or executing. To check a permission set the corresponding argument
grto <a>True</a>.
gr
grNote: calls <tt>access</tt>.
fileAccess :: RawFilePath -> Bool -> Bool -> Bool -> IO Bool

-- | Checks for the existence of the file.
gr
grNote: calls <tt>access</tt>.
fileExist :: RawFilePath -> IO Bool

-- | POSIX defines operations to get information, such as owner,
grpermissions, size and access times, about a file. This information is
grrepresented by the <a>FileStatus</a> type.
gr
grNote: see <tt>chmod</tt>.
data FileStatus

-- | <tt>getFileStatus path</tt> calls gets the <tt>FileStatus</tt>
grinformation (user ID, size, access times, etc.) for the file
gr<tt>path</tt>.
gr
grNote: calls <tt>stat</tt>.
getFileStatus :: RawFilePath -> IO FileStatus

-- | <tt>getFdStatus fd</tt> acts as <tt>getFileStatus</tt> but uses a file
grdescriptor <tt>fd</tt>.
gr
grNote: calls <tt>fstat</tt>.
getFdStatus :: Fd -> IO FileStatus

-- | Acts as <a>getFileStatus</a> except when the <a>RawFilePath</a> refers
grto a symbolic link. In that case the <tt>FileStatus</tt> information
grof the symbolic link itself is returned instead of that of the file it
grpoints to.
gr
grNote: 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
grthe 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,
gretc.).
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.)
grin 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,
gr<tt>fifo</tt>, with permissions based on <tt>mode</tt>. May fail with
gr<a>throwErrnoPathIfMinus1_</a> if a file named <tt>name</tt> already
grexists or if the effective user ID of the current process doesn't have
grpermission to create the pipe.
gr
grNote: calls <tt>mkfifo</tt>.
createNamedPipe :: RawFilePath -> FileMode -> IO ()

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

-- | <tt>createLink old new</tt> creates a new path, <tt>new</tt>, linked
grto an existing file, <tt>old</tt>.
gr
grNote: calls <tt>link</tt>.
createLink :: RawFilePath -> RawFilePath -> IO ()

-- | <tt>removeLink path</tt> removes the link named <tt>path</tt>.
gr
grNote: calls <tt>unlink</tt>.
removeLink :: RawFilePath -> IO ()

-- | <tt>createSymbolicLink file1 file2</tt> creates a symbolic link named
gr<tt>file2</tt> which points to the file <tt>file1</tt>.
gr
grSymbolic links are interpreted at run-time as if the contents of the
grlink had been substituted into the path being followed to find a file
gror directory.
gr
grNote: calls <tt>symlink</tt>.
createSymbolicLink :: RawFilePath -> RawFilePath -> IO ()

-- | Reads the <tt>RawFilePath</tt> pointed to by the symbolic link and
grreturns it.
gr
grNote: calls <tt>readlink</tt>.
readSymbolicLink :: RawFilePath -> IO RawFilePath

-- | <tt>rename old new</tt> renames a file or directory from <tt>old</tt>
grto <tt>new</tt>.
gr
grNote: calls <tt>rename</tt>.
rename :: RawFilePath -> RawFilePath -> IO ()

-- | <tt>setOwnerAndGroup path uid gid</tt> changes the owner and group of
gr<tt>path</tt> to <tt>uid</tt> and <tt>gid</tt>, respectively.
gr
grIf <tt>uid</tt> or <tt>gid</tt> is specified as -1, then that ID is
grnot changed.
gr
grNote: calls <tt>chown</tt>.
setOwnerAndGroup :: RawFilePath -> UserID -> GroupID -> IO ()

-- | Acts as <tt>setOwnerAndGroup</tt> but uses a file descriptor instead
grof a <a>FilePath</a>.
gr
grNote: calls <tt>fchown</tt>.
setFdOwnerAndGroup :: Fd -> UserID -> GroupID -> IO ()

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

-- | <tt>setFileTimes path atime mtime</tt> sets the access and
grmodification times associated with file <tt>path</tt> to
gr<tt>atime</tt> and <tt>mtime</tt>, respectively.
gr
grNote: calls <tt>utime</tt>.
setFileTimes :: RawFilePath -> EpochTime -> EpochTime -> IO ()

-- | Like <a>setFileTimes</a> but timestamps can have sub-second
grresolution.
gr
grNote: calls <tt>utimensat</tt> or <tt>utimes</tt>.
setFileTimesHiRes :: RawFilePath -> POSIXTime -> POSIXTime -> IO ()

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

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

-- | <tt>touchFile path</tt> sets the access and modification times
grassociated with file <tt>path</tt> to the current time.
gr
grNote: calls <tt>utime</tt>.
touchFile :: RawFilePath -> IO ()

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

-- | Like <a>touchFile</a> but does not follow symbolic links. This
groperation is not supported on all platforms. On these platforms, this
grfunction will raise an exception.
gr
grNote: calls <tt>lutimes</tt>.
touchSymbolicLink :: RawFilePath -> IO ()

-- | Truncates the file down to the specified length. If the file was
grlarger than the given length before this operation was performed the
grextra is lost.
gr
grNote: calls <tt>truncate</tt>.
setFileSize :: RawFilePath -> FileOffset -> IO ()

-- | Acts as <tt>setFileSize</tt> but uses a file descriptor instead of a
gr<a>FilePath</a>.
gr
grNote: 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
grrequested configurable file limit or option associated with file or
grdirectory <tt>path</tt>. For defined file limits, <tt>getPathVar</tt>
grreturns the associated value. For defined file options, the result of
gr<tt>getPathVar</tt> is undefined, but not failure.
gr
grNote: calls <tt>pathconf</tt>.
getPathVar :: RawFilePath -> PathVar -> IO Limit

-- | <tt>getFdPathVar var fd</tt> obtains the dynamic value of the
grrequested configurable file limit or option associated with the file
gror directory attached to the open channel <tt>fd</tt>. For defined
grfile limits, <tt>getFdPathVar</tt> returns the associated value. For
grdefined file options, the result of <tt>getFdPathVar</tt> is
grundefined, but not failure.
gr
grNote: calls <tt>fpathconf</tt>.
getFdPathVar :: Fd -> PathVar -> IO Limit


-- | Functions defined by the POSIX standards for manipulating and querying
grthe file system. Names of underlying POSIX functions are indicated
grwhenever possible. A more complete documentation of the POSIX
grfunctions together with a more detailed description of different error
grconditions are usually available in the system's manual pages or from
gr<a>http://www.unix.org/version3/online.html</a> (free registration
grrequired).
gr
grWhen a function that calls an underlying POSIX function fails, the
grerrno code is converted to an <a>IOError</a> using
gr<a>errnoToIOError</a>. For a list of which errno codes may be
grgenerated, consult the POSIX documentation for the underlying
grfunction.
module System.Posix.Files

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

-- | Combines two file modes into one that only contains modes that appear
grin 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
gr<tt>path</tt> to <tt>mode</tt>. This operation may fail with
gr<a>throwErrnoPathIfMinus1_</a> if <tt>path</tt> doesn't exist or if
grthe effective user ID of the current process is not that of the file's
growner.
gr
grNote: calls <tt>chmod</tt>.
setFileMode :: FilePath -> FileMode -> IO ()

-- | <tt>setFdMode fd mode</tt> acts like <tt>setFileMode</tt> but uses a
grfile descriptor <tt>fd</tt> instead of a <a>FilePath</a>.
gr
grNote: calls <tt>fchmod</tt>.
setFdMode :: Fd -> FileMode -> IO ()

-- | <tt>setFileCreationMask mode</tt> sets the file mode creation mask to
gr<tt>mode</tt>. Modes set by this operation are subtracted from files
grand directories upon creation. The previous file creation mask is
grreturned.
gr
grNote: calls <tt>umask</tt>.
setFileCreationMask :: FileMode -> IO FileMode

-- | <tt>fileAccess name read write exec</tt> checks if the file (or other
grfile system object) <tt>name</tt> can be accessed for reading, writing
grand/or executing. To check a permission set the corresponding argument
grto <a>True</a>.
gr
grNote: calls <tt>access</tt>.
fileAccess :: FilePath -> Bool -> Bool -> Bool -> IO Bool

-- | Checks for the existence of the file.
gr
grNote: calls <tt>access</tt>.
fileExist :: FilePath -> IO Bool

-- | POSIX defines operations to get information, such as owner,
grpermissions, size and access times, about a file. This information is
grrepresented by the <a>FileStatus</a> type.
gr
grNote: see <tt>chmod</tt>.
data FileStatus

-- | <tt>getFileStatus path</tt> calls gets the <tt>FileStatus</tt>
grinformation (user ID, size, access times, etc.) for the file
gr<tt>path</tt>.
gr
grNote: calls <tt>stat</tt>.
getFileStatus :: FilePath -> IO FileStatus

-- | <tt>getFdStatus fd</tt> acts as <tt>getFileStatus</tt> but uses a file
grdescriptor <tt>fd</tt>.
gr
grNote: calls <tt>fstat</tt>.
getFdStatus :: Fd -> IO FileStatus

-- | Acts as <a>getFileStatus</a> except when the <a>FilePath</a> refers to
gra symbolic link. In that case the <tt>FileStatus</tt> information of
grthe symbolic link itself is returned instead of that of the file it
grpoints to.
gr
grNote: 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
grthe 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,
gretc.).
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.)
grin 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,
gr<tt>fifo</tt>, with permissions based on <tt>mode</tt>. May fail with
gr<a>throwErrnoPathIfMinus1_</a> if a file named <tt>name</tt> already
grexists or if the effective user ID of the current process doesn't have
grpermission to create the pipe.
gr
grNote: calls <tt>mkfifo</tt>.
createNamedPipe :: FilePath -> FileMode -> IO ()

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

-- | <tt>createLink old new</tt> creates a new path, <tt>new</tt>, linked
grto an existing file, <tt>old</tt>.
gr
grNote: calls <tt>link</tt>.
createLink :: FilePath -> FilePath -> IO ()

-- | <tt>removeLink path</tt> removes the link named <tt>path</tt>.
gr
grNote: calls <tt>unlink</tt>.
removeLink :: FilePath -> IO ()

-- | <tt>createSymbolicLink file1 file2</tt> creates a symbolic link named
gr<tt>file2</tt> which points to the file <tt>file1</tt>.
gr
grSymbolic links are interpreted at run-time as if the contents of the
grlink had been substituted into the path being followed to find a file
gror directory.
gr
grNote: calls <tt>symlink</tt>.
createSymbolicLink :: FilePath -> FilePath -> IO ()

-- | Reads the <tt>FilePath</tt> pointed to by the symbolic link and
grreturns it.
gr
grNote: calls <tt>readlink</tt>.
readSymbolicLink :: FilePath -> IO FilePath

-- | <tt>rename old new</tt> renames a file or directory from <tt>old</tt>
grto <tt>new</tt>.
gr
grNote: calls <tt>rename</tt>.
rename :: FilePath -> FilePath -> IO ()

-- | <tt>setOwnerAndGroup path uid gid</tt> changes the owner and group of
gr<tt>path</tt> to <tt>uid</tt> and <tt>gid</tt>, respectively.
gr
grIf <tt>uid</tt> or <tt>gid</tt> is specified as -1, then that ID is
grnot changed.
gr
grNote: calls <tt>chown</tt>.
setOwnerAndGroup :: FilePath -> UserID -> GroupID -> IO ()

-- | Acts as <tt>setOwnerAndGroup</tt> but uses a file descriptor instead
grof a <a>FilePath</a>.
gr
grNote: calls <tt>fchown</tt>.
setFdOwnerAndGroup :: Fd -> UserID -> GroupID -> IO ()

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

-- | <tt>setFileTimes path atime mtime</tt> sets the access and
grmodification times associated with file <tt>path</tt> to
gr<tt>atime</tt> and <tt>mtime</tt>, respectively.
gr
grNote: calls <tt>utime</tt>.
setFileTimes :: FilePath -> EpochTime -> EpochTime -> IO ()

-- | Like <a>setFileTimes</a> but timestamps can have sub-second
grresolution.
gr
grNote: calls <tt>utimensat</tt> or <tt>utimes</tt>.
setFileTimesHiRes :: FilePath -> POSIXTime -> POSIXTime -> IO ()

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

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

-- | <tt>touchFile path</tt> sets the access and modification times
grassociated with file <tt>path</tt> to the current time.
gr
grNote: calls <tt>utime</tt>.
touchFile :: FilePath -> IO ()

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

-- | Like <a>touchFile</a> but does not follow symbolic links. This
groperation is not supported on all platforms. On these platforms, this
grfunction will raise an exception.
gr
grNote: calls <tt>lutimes</tt>.
touchSymbolicLink :: FilePath -> IO ()

-- | Truncates the file down to the specified length. If the file was
grlarger than the given length before this operation was performed the
grextra is lost.
gr
grNote: calls <tt>truncate</tt>.
setFileSize :: FilePath -> FileOffset -> IO ()

-- | Acts as <tt>setFileSize</tt> but uses a file descriptor instead of a
gr<a>FilePath</a>.
gr
grNote: 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
grrequested configurable file limit or option associated with file or
grdirectory <tt>path</tt>. For defined file limits, <tt>getPathVar</tt>
grreturns the associated value. For defined file options, the result of
gr<tt>getPathVar</tt> is undefined, but not failure.
gr
grNote: calls <tt>pathconf</tt>.
getPathVar :: FilePath -> PathVar -> IO Limit

-- | <tt>getFdPathVar var fd</tt> obtains the dynamic value of the
grrequested configurable file limit or option associated with the file
gror directory attached to the open channel <tt>fd</tt>. For defined
grfile limits, <tt>getFdPathVar</tt> returns the associated value. For
grdefined file options, the result of <tt>getFdPathVar</tt> is
grundefined, but not failure.
gr
grNote: calls <tt>fpathconf</tt>.
getFdPathVar :: Fd -> PathVar -> IO Limit


-- | POSIX IO support. These types and functions correspond to the unix
grfunctions open(2), close(2), etc. For more portable functions which
grare 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
grappend, exclusive, noctty, nonBlock, and trunc.
defaultFileFlags :: OpenFileFlags

-- | Open and optionally create this file. See <a>Files</a> for information
gron 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
gr<a>openFd</a>. See <a>Files</a> for information on how to use the
gr<a>FileMode</a> type.
createFile :: RawFilePath -> FileMode -> IO Fd

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

-- | Read data from an <a>Fd</a> and convert it to a <a>String</a> using
grthe locale encoding. Throws an exception if this is an invalid
grdescriptor, 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
grthe 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
grthe 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
grdescriptors. The first component is the fd to read from, the second is
grthe write end. Although pipes may be bidirectional, this behaviour is
grnot portable and programmers should use two separate pipes for this
grpurpose. 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
grside effect of closing the <a>Handle</a> and flushing its write
grbuffer, if necessary.
handleToFd :: Handle -> IO Fd

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


-- | POSIX IO support. These types and functions correspond to the unix
grfunctions open(2), close(2), etc. For more portable functions which
grare 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
grappend, exclusive, noctty, nonBlock, and trunc.
defaultFileFlags :: OpenFileFlags

-- | Open and optionally create this file. See <a>Files</a> for information
gron 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
gr<a>openFd</a>. See <a>Files</a> for information on how to use the
gr<a>FileMode</a> type.
createFile :: FilePath -> FileMode -> IO Fd

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

-- | Read data from an <a>Fd</a> and convert it to a <a>String</a> using
grthe locale encoding. Throws an exception if this is an invalid
grdescriptor, 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
grthe 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
grthe 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
grdescriptors. The first component is the fd to read from, the second is
grthe write end. Although pipes may be bidirectional, this behaviour is
grnot portable and programmers should use two separate pipes for this
grpurpose. 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
grside effect of closing the <a>Handle</a> and flushing its write
grbuffer, if necessary.
handleToFd :: Handle -> IO Fd

-- | Converts an <a>Fd</a> into a <a>Handle</a> that can be used with the
grstandard 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
gr<tt>main</tt>
Exited :: ExitCode -> ProcessStatus

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

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

-- | Variant of <a>forkProcess</a> in the style of
gr<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
gr<tt>execv*</tt> family, depending on whether or not the current PATH
gris to be searched for the command, and whether or not an environment
gris provided to supersede the process's current environment. The
grbasename (leading directory names suppressed) of the command is passed
grto <tt>execv*</tt> as <tt>arg[0]</tt>; the argument list passed to
gr<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
grterminate the process with the indicated exit <tt>status</tt>. The
groperation never returns.
exitImmediately :: ExitCode -> IO ()

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

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

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

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

-- | <tt><a>createProcessGroupFor</a> pid</tt> calls <tt>setpgid</tt> to
grmake 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
grthe <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
grset the <tt>ProcessGroupIDOf</tt> for process <tt>pid</tt> to
gr<tt>pgid</tt>.
setProcessGroupIDOf :: ProcessID -> ProcessGroupID -> IO ()

-- | <a>createSession</a> calls <tt>setsid</tt> to create a new session
grwith 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
grinformation 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
gr<tt>main</tt>
Exited :: ExitCode -> ProcessStatus

-- | the process was terminated by a signal, the <tt>Bool</tt> is
gr<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
gr<tt>waitpid</tt>, returning <tt><a>Just</a> tc</tt>, the
gr<a>ProcessStatus</a> for process <tt>pid</tt> if it is available,
gr<a>Nothing</a> otherwise. If <tt>blk</tt> is <a>False</a>, then
gr<tt>WNOHANG</tt> is set in the options for <tt>waitpid</tt>, otherwise
grnot. If <tt>stopped</tt> is <a>True</a>, then <tt>WUNTRACED</tt> is
grset in the options for <tt>waitpid</tt>, otherwise not.
getProcessStatus :: Bool -> Bool -> ProcessID -> IO (Maybe ProcessStatus)

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

-- | <tt><a>getGroupProcessStatus</a> blk stopped pgid</tt> calls
gr<tt>waitpid</tt>, returning <tt><a>Just</a> (pid, tc)</tt>, the
gr<a>ProcessID</a> and <a>ProcessStatus</a> for any process in group
gr<tt>pgid</tt> if one is available, or <a>Nothing</a> if there are
grchild processes but none have exited. If there are no child processes,
grthen <a>getGroupProcessStatus</a> raises an
gr<tt>isDoesNotExistError</tt> exception.
gr
grIf <tt>blk</tt> is <a>False</a>, then <tt>WNOHANG</tt> is set in the
groptions for <tt>waitpid</tt>, otherwise not. If <tt>stopped</tt> is
gr<a>True</a>, then <tt>WUNTRACED</tt> is set in the options for
gr<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
grprocess <tt>pid</tt> a new process group leader. This function is
grcurrently deprecated, and might be changed to making the current
grprocess a new process group leader in future versions.

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

-- | <tt><a>setProcessGroupID</a> pid pgid</tt> calls <tt>setpgid</tt> to
grset the <a>ProcessGroupID</a> for process <tt>pid</tt> to
gr<tt>pgid</tt>. This function is currently deprecated, and might be
grchanged to setting the <a>ProcessGroupID</a> for the current process
grin future versions.

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


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

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

-- | Variant of <a>forkProcess</a> in the style of
gr<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
gr<tt>execv*</tt> family, depending on whether or not the current PATH
gris to be searched for the command, and whether or not an environment
gris provided to supersede the process's current environment. The
grbasename (leading directory names suppressed) of the command is passed
grto <tt>execv*</tt> as <tt>arg[0]</tt>; the argument list passed to
gr<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
grterminate the process with the indicated exit <tt>status</tt>. The
groperation never returns.
exitImmediately :: ExitCode -> IO ()

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

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

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

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

-- | <tt><a>createProcessGroupFor</a> pid</tt> calls <tt>setpgid</tt> to
grmake 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
grthe <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
grset the <tt>ProcessGroupIDOf</tt> for process <tt>pid</tt> to
gr<tt>pgid</tt>.
setProcessGroupIDOf :: ProcessID -> ProcessGroupID -> IO ()

-- | <a>createSession</a> calls <tt>setsid</tt> to create a new session
grwith 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
grinformation 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
gr<tt>main</tt>
Exited :: ExitCode -> ProcessStatus

-- | the process was terminated by a signal, the <tt>Bool</tt> is
gr<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
gr<tt>waitpid</tt>, returning <tt><a>Just</a> tc</tt>, the
gr<a>ProcessStatus</a> for process <tt>pid</tt> if it is available,
gr<a>Nothing</a> otherwise. If <tt>blk</tt> is <a>False</a>, then
gr<tt>WNOHANG</tt> is set in the options for <tt>waitpid</tt>, otherwise
grnot. If <tt>stopped</tt> is <a>True</a>, then <tt>WUNTRACED</tt> is
grset in the options for <tt>waitpid</tt>, otherwise not.
getProcessStatus :: Bool -> Bool -> ProcessID -> IO (Maybe ProcessStatus)

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

-- | <tt><a>getGroupProcessStatus</a> blk stopped pgid</tt> calls
gr<tt>waitpid</tt>, returning <tt><a>Just</a> (pid, tc)</tt>, the
gr<a>ProcessID</a> and <a>ProcessStatus</a> for any process in group
gr<tt>pgid</tt> if one is available, or <a>Nothing</a> if there are
grchild processes but none have exited. If there are no child processes,
grthen <a>getGroupProcessStatus</a> raises an
gr<tt>isDoesNotExistError</tt> exception.
gr
grIf <tt>blk</tt> is <a>False</a>, then <tt>WNOHANG</tt> is set in the
groptions for <tt>waitpid</tt>, otherwise not. If <tt>stopped</tt> is
gr<a>True</a>, then <tt>WUNTRACED</tt> is set in the options for
gr<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
grprocess <tt>pid</tt> a new process group leader. This function is
grcurrently deprecated, and might be changed to making the current
grprocess a new process group leader in future versions.

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

-- | <tt><a>setProcessGroupID</a> pid pgid</tt> calls <tt>setpgid</tt> to
grset the <a>ProcessGroupID</a> for process <tt>pid</tt> to
gr<tt>pgid</tt>. This function is currently deprecated, and might be
grchanged to setting the <a>ProcessGroupID</a> for the current process
grin future versions.

-- | <i>Deprecated: This function is scheduled to be replaced by something
grdifferent in the future, we therefore recommend that you do not use
grthis 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
grvalue.
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
grdone through a system call, this will block the *entire runtime*, not
grjust the current thread. If this is not the behaviour you want, use
grsemThreadWait instead.
semWait :: Semaphore -> IO ()

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

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

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

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


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

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

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

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

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

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

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


-- | POSIX signal support
module System.Posix.Signals
type Signal = CInt
nullSignal :: Signal
internalAbort :: Signal
sigABRT :: CInt
realTimeAlarm :: Signal
sigALRM :: CInt
busError :: Signal
sigBUS :: CInt
processStatusChanged :: Signal
sigCHLD :: CInt
continueProcess :: Signal
sigCONT :: CInt
floatingPointException :: Signal
sigFPE :: CInt
lostConnection :: Signal
sigHUP :: CInt
illegalInstruction :: Signal
sigILL :: CInt
keyboardSignal :: Signal
sigINT :: CInt
killProcess :: Signal
sigKILL :: CInt
openEndedPipe :: Signal
sigPIPE :: CInt
keyboardTermination :: Signal
sigQUIT :: CInt
segmentationViolation :: Signal
sigSEGV :: CInt
softwareStop :: Signal
sigSTOP :: CInt
softwareTermination :: Signal
sigTERM :: CInt
keyboardStop :: Signal
sigTSTP :: CInt
backgroundRead :: Signal
sigTTIN :: CInt
backgroundWrite :: Signal
sigTTOU :: CInt
userDefinedSignal1 :: Signal
sigUSR1 :: CInt
userDefinedSignal2 :: Signal
sigUSR2 :: CInt
pollableEvent :: Signal
sigPOLL :: CInt
profilingTimerExpired :: Signal
sigPROF :: CInt
badSystemCall :: Signal
sigSYS :: CInt
breakpointTrap :: Signal
sigTRAP :: CInt
urgentDataAvailable :: Signal
sigURG :: CInt
virtualTimerExpired :: Signal
sigVTALRM :: CInt
cpuTimeLimitExceeded :: Signal
sigXCPU :: CInt
fileSizeLimitExceeded :: Signal
sigXFSZ :: CInt

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

-- | <tt>signalProcess int pid</tt> calls <tt>kill</tt> to signal process
gr<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
grprocesses 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
gr<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
grinstall an interrupt handler for signal <tt>int</tt>. If
gr<tt>handler</tt> is <tt>Default</tt>, <tt>SIG_DFL</tt> is installed;
grif <tt>handler</tt> is <tt>Ignore</tt>, <tt>SIG_IGN</tt> is installed;
grif <tt>handler</tt> is <tt>Catch action</tt>, a handler is installed
grwhich will invoke <tt>action</tt> in a new thread when (or shortly
grafter) the signal is received. If <tt>iset</tt> is <tt>Just s</tt>,
grthen the <tt>sa_mask</tt> of the <tt>sigaction</tt> structure is set
grto <tt>s</tt>; otherwise it is cleared. The previously installed
grsignal 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
grwill 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
grof interrupts which are currently being blocked.
getSignalMask :: IO SignalSet

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

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

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

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

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

-- | <tt>awaitSignal iset</tt> suspends execution until an interrupt is
grreceived. If <tt>iset</tt> is <tt>Just s</tt>, <tt>awaitSignal</tt>
grcalls <tt>sigsuspend</tt>, installing <tt>s</tt> as the new signal
grmask before suspending execution; otherwise, it calls
gr<tt>sigsuspend</tt> with current signal mask. Note that RTS scheduler
grsignal (either <a>virtualTimerExpired</a> or <a>realTimeAlarm</a>)
grcould cause premature termination of this call. It might be necessary
grto block that signal before invocation of <tt>awaitSignal</tt> with
gr<a>blockSignals</a> <a>reservedSignals</a>.
gr
gr<tt>awaitSignal</tt> returns when signal was received and processed by
gra signal handler, or if the signal could not be caught. If you have
grinstalled any signal handlers with <tt>installHandler</tt>, it may be
grwise to call <tt>yield</tt> directly after <tt>awaitSignal</tt> to
grensure 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
grwhen 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
gr<a>FilePath</a> is the (possibly relative) path of the created file,
grwhich is padded with 6 random characters. The argument is the desired
grprefix of the filepath of the temporary file to be created.
gr
grIf you aren't using GHC or Hugs then this function simply wraps mktemp
grand 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
grreading/writing. The returned <a>FilePath</a> is the (possibly
grrelative) path of the created file, which contains 6 random characters
grin between the prefix and suffix. The first argument is the desired
grprefix of the filepath of the temporary file to be created. The second
grargument is the suffix of the temporary file to be created.
gr
grIf you are using as system that doesn't support the mkstemps glibc
grfunction (supported in glibc &gt; 2.11) then this function simply
grthrows an error.
mkstemps :: String -> String -> IO (FilePath, Handle)

-- | Make a unique directory. The returned <a>FilePath</a> is the path of
grthe created directory, which is padded with 6 random characters. The
grargument is the desired prefix of the filepath of the temporary
grdirectory to be created.
gr
grIf you are using as system that doesn't support the mkdtemp glibc
grfunction (supported in glibc &gt; 2.1.91) then this function uses
grmktemp 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
gr<a>RawFilePath</a> is the (possibly relative) path of the created
grfile, which is padded with 6 random characters. The argument is the
grdesired prefix of the filepath of the temporary file to be created.
gr
grIf you aren't using GHC or Hugs then this function simply wraps mktemp
grand so shouldn't be considered safe.
mkstemp :: ByteString -> IO (RawFilePath, Handle)

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

-- | Make a unique directory. The returned <a>RawFilePath</a> is the path
grof the created directory, which is padded with 6 random characters.
grThe argument is the desired prefix of the filepath of the temporary
grdirectory to be created.
gr
grIf you aren't using GHC or Hugs then this function simply wraps mktemp
grand 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
grthe <tt>TerminalAttributes</tt> associated with <tt>Fd</tt>
gr<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
grchange the <tt>TerminalAttributes</tt> associated with <tt>Fd</tt>
gr<tt>fd</tt> to <tt>attr</tt>, when the terminal is in the state
grindicated by <tt>ts</tt>.
setTerminalAttributes :: Fd -> TerminalAttributes -> TerminalState -> IO ()
data TerminalMode
InterruptOnBreak :: TerminalMode
MapCRtoLF :: TerminalMode
IgnoreBreak :: TerminalMode
IgnoreCR :: TerminalMode
IgnoreParityErrors :: TerminalMode
MapLFtoCR :: TerminalMode
CheckParity :: TerminalMode
StripHighBit :: TerminalMode
StartStopInput :: TerminalMode
StartStopOutput :: TerminalMode
MarkParityErrors :: TerminalMode
ProcessOutput :: TerminalMode
LocalMode :: TerminalMode
ReadEnable :: TerminalMode
TwoStopBits :: TerminalMode
HangupOnClose :: TerminalMode
EnableParity :: TerminalMode
OddParity :: TerminalMode
EnableEcho :: TerminalMode
EchoErase :: TerminalMode
EchoKill :: TerminalMode
EchoLF :: TerminalMode
ProcessInput :: TerminalMode
ExtendedFunctions :: TerminalMode
KeyboardInterrupts :: TerminalMode
NoFlushOnInterrupt :: TerminalMode
BackgroundWriteInterrupt :: TerminalMode
withoutMode :: TerminalAttributes -> TerminalMode -> TerminalAttributes
withMode :: TerminalAttributes -> TerminalMode -> TerminalAttributes
terminalMode :: TerminalMode -> TerminalAttributes -> Bool
bitsPerByte :: TerminalAttributes -> Int
withBits :: TerminalAttributes -> Int -> TerminalAttributes
data ControlCharacter
EndOfFile :: ControlCharacter
EndOfLine :: ControlCharacter
Erase :: ControlCharacter
Interrupt :: ControlCharacter
Kill :: ControlCharacter
Quit :: ControlCharacter
Start :: ControlCharacter
Stop :: ControlCharacter
Suspend :: ControlCharacter
controlChar :: TerminalAttributes -> ControlCharacter -> Maybe Char
withCC :: TerminalAttributes -> (ControlCharacter, Char) -> TerminalAttributes
withoutCC :: TerminalAttributes -> ControlCharacter -> TerminalAttributes
inputTime :: TerminalAttributes -> Int
withTime :: TerminalAttributes -> Int -> TerminalAttributes
minInput :: TerminalAttributes -> Int
withMinInput :: TerminalAttributes -> Int -> TerminalAttributes
data BaudRate
B0 :: BaudRate
B50 :: BaudRate
B75 :: BaudRate
B110 :: BaudRate
B134 :: BaudRate
B150 :: BaudRate
B200 :: BaudRate
B300 :: BaudRate
B600 :: BaudRate
B1200 :: BaudRate
B1800 :: BaudRate
B2400 :: BaudRate
B4800 :: BaudRate
B9600 :: BaudRate
B19200 :: BaudRate
B38400 :: BaudRate
B57600 :: BaudRate
B115200 :: BaudRate
inputSpeed :: TerminalAttributes -> BaudRate
withInputSpeed :: TerminalAttributes -> BaudRate -> TerminalAttributes
outputSpeed :: TerminalAttributes -> BaudRate
withOutputSpeed :: TerminalAttributes -> BaudRate -> TerminalAttributes

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

-- | <tt>drainOutput fd</tt> calls <tt>tcdrain</tt> to block until all
groutput written to <tt>Fd</tt> <tt>fd</tt> has been transmitted.
gr
grThrows <a>IOError</a> ("unsupported operation") if platform does not
grprovide <tt>tcdrain(3)</tt> (use <tt>#if HAVE_TCDRAIN</tt> CPP guard
grto detect availability).
drainOutput :: Fd -> IO ()
data QueueSelector
InputQueue :: QueueSelector
OutputQueue :: QueueSelector
BothQueues :: QueueSelector

-- | <tt>discardData fd queues</tt> calls <tt>tcflush</tt> to discard
grpending input and/or output for <tt>Fd</tt> <tt>fd</tt>, as indicated
grby 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
grflow of data on <tt>Fd</tt> <tt>fd</tt>, as indicated by
gr<tt>action</tt>.
controlFlow :: Fd -> FlowAction -> IO ()

-- | <tt>getTerminalProcessGroupID fd</tt> calls <tt>tcgetpgrp</tt> to
grobtain the <tt>ProcessGroupID</tt> of the foreground process group
grassociated 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
grset the <tt>ProcessGroupID</tt> of the foreground process group
grassociated with the terminal attached to <tt>Fd</tt> <tt>fd</tt> to
gr<tt>pgid</tt>.
setTerminalProcessGroupID :: Fd -> ProcessGroupID -> IO ()

-- | <tt>queryTerminal fd</tt> calls <tt>isatty</tt> to determine whether
gror 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
grassociated with the terminal for <tt>Fd</tt> <tt>fd</tt>. If
gr<tt>fd</tt> is associated with a terminal, <tt>getTerminalName</tt>
grreturns the name of the terminal.
getTerminalName :: Fd -> IO RawFilePath

-- | <tt>getControllingTerminalName</tt> calls <tt>ctermid</tt> to obtain a
grname associated with the controlling terminal for the process. If a
grcontrolling terminal exists, <tt>getControllingTerminalName</tt>
grreturns the name of the controlling terminal.
gr
grThrows <a>IOError</a> ("unsupported operation") if platform does not
grprovide <tt>ctermid(3)</tt> (use <tt>#if HAVE_CTERMID</tt> CPP guard
grto detect availability).
getControllingTerminalName :: IO RawFilePath

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

-- | <tt>getSlaveTerminalName</tt> calls <tt>ptsname</tt> to obtain the
grname of the slave terminal associated with a pseudoterminal pair. The
grfile 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
grthe <tt>TerminalAttributes</tt> associated with <tt>Fd</tt>
gr<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
grchange the <tt>TerminalAttributes</tt> associated with <tt>Fd</tt>
gr<tt>fd</tt> to <tt>attr</tt>, when the terminal is in the state
grindicated by <tt>ts</tt>.
setTerminalAttributes :: Fd -> TerminalAttributes -> TerminalState -> IO ()
data TerminalMode
InterruptOnBreak :: TerminalMode
MapCRtoLF :: TerminalMode
IgnoreBreak :: TerminalMode
IgnoreCR :: TerminalMode
IgnoreParityErrors :: TerminalMode
MapLFtoCR :: TerminalMode
CheckParity :: TerminalMode
StripHighBit :: TerminalMode
StartStopInput :: TerminalMode
StartStopOutput :: TerminalMode
MarkParityErrors :: TerminalMode
ProcessOutput :: TerminalMode
LocalMode :: TerminalMode
ReadEnable :: TerminalMode
TwoStopBits :: TerminalMode
HangupOnClose :: TerminalMode
EnableParity :: TerminalMode
OddParity :: TerminalMode
EnableEcho :: TerminalMode
EchoErase :: TerminalMode
EchoKill :: TerminalMode
EchoLF :: TerminalMode
ProcessInput :: TerminalMode
ExtendedFunctions :: TerminalMode
KeyboardInterrupts :: TerminalMode
NoFlushOnInterrupt :: TerminalMode
BackgroundWriteInterrupt :: TerminalMode
withoutMode :: TerminalAttributes -> TerminalMode -> TerminalAttributes
withMode :: TerminalAttributes -> TerminalMode -> TerminalAttributes
terminalMode :: TerminalMode -> TerminalAttributes -> Bool
bitsPerByte :: TerminalAttributes -> Int
withBits :: TerminalAttributes -> Int -> TerminalAttributes
data ControlCharacter
EndOfFile :: ControlCharacter
EndOfLine :: ControlCharacter
Erase :: ControlCharacter
Interrupt :: ControlCharacter
Kill :: ControlCharacter
Quit :: ControlCharacter
Start :: ControlCharacter
Stop :: ControlCharacter
Suspend :: ControlCharacter
controlChar :: TerminalAttributes -> ControlCharacter -> Maybe Char
withCC :: TerminalAttributes -> (ControlCharacter, Char) -> TerminalAttributes
withoutCC :: TerminalAttributes -> ControlCharacter -> TerminalAttributes
inputTime :: TerminalAttributes -> Int
withTime :: TerminalAttributes -> Int -> TerminalAttributes
minInput :: TerminalAttributes -> Int
withMinInput :: TerminalAttributes -> Int -> TerminalAttributes
data BaudRate
B0 :: BaudRate
B50 :: BaudRate
B75 :: BaudRate
B110 :: BaudRate
B134 :: BaudRate
B150 :: BaudRate
B200 :: BaudRate
B300 :: BaudRate
B600 :: BaudRate
B1200 :: BaudRate
B1800 :: BaudRate
B2400 :: BaudRate
B4800 :: BaudRate
B9600 :: BaudRate
B19200 :: BaudRate
B38400 :: BaudRate
B57600 :: BaudRate
B115200 :: BaudRate
inputSpeed :: TerminalAttributes -> BaudRate
withInputSpeed :: TerminalAttributes -> BaudRate -> TerminalAttributes
outputSpeed :: TerminalAttributes -> BaudRate
withOutputSpeed :: TerminalAttributes -> BaudRate -> TerminalAttributes

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

-- | <tt>drainOutput fd</tt> calls <tt>tcdrain</tt> to block until all
groutput written to <tt>Fd</tt> <tt>fd</tt> has been transmitted.
gr
grThrows <a>IOError</a> ("unsupported operation") if platform does not
grprovide <tt>tcdrain(3)</tt> (use <tt>#if HAVE_TCDRAIN</tt> CPP guard
grto detect availability).
drainOutput :: Fd -> IO ()
data QueueSelector
InputQueue :: QueueSelector
OutputQueue :: QueueSelector
BothQueues :: QueueSelector

-- | <tt>discardData fd queues</tt> calls <tt>tcflush</tt> to discard
grpending input and/or output for <tt>Fd</tt> <tt>fd</tt>, as indicated
grby 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
grflow of data on <tt>Fd</tt> <tt>fd</tt>, as indicated by
gr<tt>action</tt>.
controlFlow :: Fd -> FlowAction -> IO ()

-- | <tt>getTerminalProcessGroupID fd</tt> calls <tt>tcgetpgrp</tt> to
grobtain the <tt>ProcessGroupID</tt> of the foreground process group
grassociated 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
grset the <tt>ProcessGroupID</tt> of the foreground process group
grassociated with the terminal attached to <tt>Fd</tt> <tt>fd</tt> to
gr<tt>pgid</tt>.
setTerminalProcessGroupID :: Fd -> ProcessGroupID -> IO ()

-- | <tt>queryTerminal fd</tt> calls <tt>isatty</tt> to determine whether
gror 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
grassociated with the terminal for <tt>Fd</tt> <tt>fd</tt>. If
gr<tt>fd</tt> is associated with a terminal, <tt>getTerminalName</tt>
grreturns the name of the terminal.
getTerminalName :: Fd -> IO FilePath

-- | <tt>getControllingTerminalName</tt> calls <tt>ctermid</tt> to obtain a
grname associated with the controlling terminal for the process. If a
grcontrolling terminal exists, <tt>getControllingTerminalName</tt>
grreturns the name of the controlling terminal.
gr
grThrows <a>IOError</a> ("unsupported operation") if platform does not
grprovide <tt>ctermid(3)</tt> (use <tt>#if HAVE_CTERMID</tt> CPP guard
grto detect availability).
getControllingTerminalName :: IO FilePath

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

-- | <tt>getSlaveTerminalName</tt> calls <tt>ptsname</tt> to obtain the
grname of the slave terminal associated with a pseudoterminal pair. The
grfile 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
grthat 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
grremaining (if the sleep was interrupted by a signal, for example).
gr
gr<i>GHC Note</i>: <a>threadDelay</a> is a better choice. Since GHC uses
grsignals for its internal clock, a call to <a>sleep</a> will usually be
grinterrupted immediately. That makes <a>sleep</a> unusable in a program
grcompiled with GHC, unless the RTS timer is disabled (with <tt>+RTS
gr-V0</tt>). Furthermore, without the <tt>-threaded</tt> option,
gr<a>sleep</a> will block all other user threads. Even with the
gr<tt>-threaded</tt> option, <a>sleep</a> requires a full OS thread to
gritself. <a>threadDelay</a> has none of these shortcomings.

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

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

-- | Sleep for the specified duration (in nanoseconds)
gr
gr<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.
gr
grThrows <a>IOError</a> ("unsupported operation") if platform does not
grprovide <tt>fsync(2)</tt> (use <tt>#if HAVE_FSYNC</tt> CPP guard to
grdetect availability).
fileSynchronise :: Fd -> IO ()

-- | Performs <tt>fdatasync(2)</tt> operation on file-descriptor.
gr
grThrows <a>IOError</a> ("unsupported operation") if platform does not
grprovide <tt>fdatasync(2)</tt> (use <tt>#if HAVE_FDATASYNC</tt> CPP
grguard 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
gr<tt>UserID</tt> associated with the current process.
getRealUserID :: IO UserID

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

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

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

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

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

-- | <tt>getEffectiveUserName</tt> gets the name associated with the
greffective <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
grthe <tt>GroupEntry</tt> information associated with <tt>GroupID</tt>
gr<tt>gid</tt>. This operation may fail with <a>isDoesNotExistError</a>
grif no such group exists.
getGroupEntryForID :: GroupID -> IO GroupEntry

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

-- | <tt>getAllGroupEntries</tt> returns all group entries on the system by
grrepeatedly 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
gr<tt>UserEntry</tt> information associated with <tt>UserID</tt>
gr<tt>uid</tt>. This operation may fail with <a>isDoesNotExistError</a>
grif no such user exists.
getUserEntryForID :: UserID -> IO UserEntry

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

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

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

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

-- | <tt>setEffectiveUserID uid</tt> calls <tt>seteuid</tt> to set the
greffective user-id associated with the current process to <tt>uid</tt>.
grThis 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
greffective group-id associated with the current process to
gr<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
grsupplementary <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
grenvironment strings.
gr
grThis module exports exactly the same API as <a>System.Posix</a>,
grexcept that all file paths and environment strings are represented by
gr<tt>ByteString</tt> instead of <a>String</a>. The <a>System.Posix</a>
grAPI implicitly translates all file paths and environment strings using
grthe locale encoding, whereas this version of the API does no encoding
gror decoding and works directly in terms of raw bytes.
gr
grNote that if you do need to interpret file paths or environment
grstrings as text, then some Unicode encoding or decoding should be
grapplied 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
gron your particular platform! Use <a>haveRtldNext</a>.
gr
grIf <tt>RTLD_DEFAULT</tt> is not defined on your platform,
gr<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
gr<tt>RTLD_DEFAULT</tt>) are not visible without setting the macro
gr<tt>_GNU_SOURCE</tt>. Since we don't want to define this macro, you
grcan use the function <a>haveRtldNext</a> to check wether the flag
gr<a>Next</a> is available. Ideally, this will be optimized by the
grcompiler so that it should be as efficient as an <tt>#ifdef</tt>.
gr
grIf you fail to test the flag and use it although it is undefined,
gr<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
gr<tt>symbol</tt>, as it occurs in the shared object identified by
gr<tt>source</tt>.
dlsym :: DL -> String -> IO (FunPtr a)

-- | <a>undl</a> obtains the raw handle. You mustn't do something like
gr<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
gron your particular platform! Use <a>haveRtldNext</a>.
gr
grIf <tt>RTLD_DEFAULT</tt> is not defined on your platform,
gr<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
gr<tt>RTLD_DEFAULT</tt>) are not visible without setting the macro
gr<tt>_GNU_SOURCE</tt>. Since we don't want to define this macro, you
grcan use the function <a>haveRtldNext</a> to check wether the flag
gr<a>Next</a> is available. Ideally, this will be optimized by the
grcompiler so that it should be as efficient as an <tt>#ifdef</tt>.
gr
grIf you fail to test the flag and use it although it is undefined,
gr<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
gr<tt>symbol</tt>, as it occurs in the shared object identified by
gr<tt>source</tt>.
dlsym :: DL -> String -> IO (FunPtr a)

-- | <a>undl</a> obtains the raw handle. You mustn't do something like
gr<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 ()
