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

-- | Portable POSIX-compatibility layer.
--   
--   This package provides portable implementations of parts of the unix
--   package. This package re-exports the unix package when available. When
--   it isn't available, portable implementations are used.
@package unix-compat
@version 0.7.4.1

-- | This module makes the operations exported by
--   System.Posix.Files available on all platforms. On POSIX
--   systems it re-exports operations from System.Posix.Files. On
--   other platforms it emulates the operations as far as possible.
--   
--   /NOTE: the portable implementations are not well tested, in some cases
--   functions are only stubs./
module System.PosixCompat.Files

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

-- | Combines two file modes into one that only contains modes that appear
--   in both.
intersectFileModes :: FileMode -> FileMode -> FileMode

-- | No permissions.
nullFileMode :: FileMode

-- | Owner has read permission.
ownerReadMode :: FileMode

-- | Owner has write permission.
ownerWriteMode :: FileMode

-- | Owner has execute permission.
ownerExecuteMode :: FileMode

-- | Owner has read, write and execute permission.
ownerModes :: FileMode

-- | Group has read permission.
groupReadMode :: FileMode

-- | Group has write permission.
groupWriteMode :: FileMode

-- | Group has execute permission.
groupExecuteMode :: FileMode

-- | Group has read, write and execute permission.
groupModes :: FileMode

-- | Others have read permission.
otherReadMode :: FileMode

-- | Others have write permission.
otherWriteMode :: FileMode

-- | Others have execute permission.
otherExecuteMode :: FileMode

-- | Others have read, write and execute permission.
otherModes :: FileMode

-- | Set user ID on execution.
setUserIDMode :: FileMode

-- | Set group ID on execution.
setGroupIDMode :: FileMode

-- | Owner, group and others have read and write permission.
stdFileMode :: FileMode

-- | Owner, group and others have read, write and execute permission.
accessModes :: FileMode

-- | setFileMode path mode changes permission of the file given by
--   path to mode. This operation may fail with
--   throwErrnoPathIfMinus1_ if path doesn't exist or if
--   the effective user ID of the current process is not that of the file's
--   owner.
--   
--   Note: calls chmod.
setFileMode :: FilePath -> FileMode -> IO ()

-- | setFdMode fd mode acts like setFileMode but uses a
--   file descriptor fd instead of a FilePath.
--   
--   Note: calls fchmod.
setFdMode :: Fd -> FileMode -> IO ()

-- | setFileCreationMask mode sets the file mode creation mask to
--   mode. Modes set by this operation are subtracted from files
--   and directories upon creation. The previous file creation mask is
--   returned.
--   
--   Note: calls umask.
setFileCreationMask :: FileMode -> IO FileMode

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

-- | Checks for the existence of the file.
--   
--   Note: calls access.
fileExist :: FilePath -> IO Bool

-- | POSIX defines operations to get information, such as owner,
--   permissions, size and access times, about a file. This information is
--   represented by the FileStatus type.
--   
--   Note: see chmod.
--   
--   Limitations: Support for high resolution timestamps is filesystem
--   dependent:
--   
--   
--   
- HFS+ volumes on OS X only support whole-second times.
--   
data FileStatus

-- | getFileStatus path calls gets the FileStatus
--   information (user ID, size, access times, etc.) for the file
--   path.
--   
--   Note: calls stat.
getFileStatus :: FilePath -> IO FileStatus

-- | getFdStatus fd acts as getFileStatus but uses a file
--   descriptor fd.
--   
--   Note: calls fstat.
getFdStatus :: Fd -> IO FileStatus

-- | Acts as getFileStatus except when the FilePath refers to
--   a symbolic link. In that case the FileStatus information of
--   the symbolic link itself is returned instead of that of the file it
--   points to.
--   
--   Note: calls lstat.
getSymbolicLinkStatus :: FilePath -> IO FileStatus

-- | ID of the device on which this file resides.
deviceID :: FileStatus -> DeviceID

-- | inode number
fileID :: FileStatus -> FileID

-- | File mode (such as permissions).
fileMode :: FileStatus -> FileMode

-- | Number of hard links to this file.
linkCount :: FileStatus -> LinkCount

-- | ID of owner.
fileOwner :: FileStatus -> UserID

-- | ID of group.
fileGroup :: FileStatus -> GroupID

-- | Describes the device that this file represents.
specialDeviceID :: FileStatus -> DeviceID

-- | Size of the file in bytes. If this file is a symbolic link the size is
--   the length of the pathname it contains.
fileSize :: FileStatus -> FileOffset

-- | Time of last access.
accessTime :: FileStatus -> EpochTime

-- | Time of last modification.
modificationTime :: FileStatus -> EpochTime

-- | Time of last status change (i.e. owner, group, link count, mode,
--   etc.).
statusChangeTime :: FileStatus -> EpochTime

-- | Time of last access in sub-second resolution. Depends on the timestamp
--   resolution of the underlying filesystem.
accessTimeHiRes :: FileStatus -> POSIXTime

-- | Time of last modification in sub-second resolution. Depends on the
--   timestamp resolution of the underlying filesystem.
modificationTimeHiRes :: FileStatus -> POSIXTime

-- | Time of last status change (i.e. owner, group, link count, mode, etc.)
--   in sub-second resolution. Depends on the timestamp resolution of the
--   underlying filesystem.
statusChangeTimeHiRes :: FileStatus -> POSIXTime

-- | Checks if this file is a block device.
isBlockDevice :: FileStatus -> Bool

-- | Checks if this file is a character device.
isCharacterDevice :: FileStatus -> Bool

-- | Checks if this file is a named pipe device.
isNamedPipe :: FileStatus -> Bool

-- | Checks if this file is a regular file device.
isRegularFile :: FileStatus -> Bool

-- | Checks if this file is a directory device.
isDirectory :: FileStatus -> Bool

-- | Checks if this file is a symbolic link device.
isSymbolicLink :: FileStatus -> Bool

-- | Checks if this file is a socket device.
isSocket :: FileStatus -> Bool

-- | createNamedPipe fifo mode creates a new named pipe,
--   fifo, with permissions based on mode. May fail with
--   throwErrnoPathIfMinus1_ if a file named name already
--   exists or if the effective user ID of the current process doesn't have
--   permission to create the pipe.
--   
--   Note: calls mkfifo.
createNamedPipe :: FilePath -> FileMode -> IO ()

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

-- | createLink old new creates a new path, new, linked
--   to an existing file, old.
--   
--   Note: calls link.
createLink :: FilePath -> FilePath -> IO ()

-- | removeLink path removes the link named path.
--   
--   Note: calls unlink.
removeLink :: FilePath -> IO ()

-- | createSymbolicLink name1 name2 creates a symbolic link named
--   name2 which points to the file name1.
--   
--   Symbolic links are interpreted at run-time as if the contents of the
--   link had been substituted into the path being followed to find a file
--   or directory.
--   
--   Note: calls symlink.
createSymbolicLink :: FilePath -> FilePath -> IO ()

-- | Reads the FilePath pointed to by the symbolic link and
--   returns it.
--   
--   Note: calls readlink.
readSymbolicLink :: FilePath -> IO FilePath

-- | rename old new renames a file or directory from old
--   to new.
--   
--   Note: calls rename.
rename :: FilePath -> FilePath -> IO ()

-- | setOwnerAndGroup path uid gid changes the owner and group of
--   path to uid and gid, respectively.
--   
--   If uid or gid is specified as -1, then that ID is
--   not changed.
--   
--   Note: calls chown.
setOwnerAndGroup :: FilePath -> UserID -> GroupID -> IO ()

-- | Acts as setOwnerAndGroup but uses a file descriptor instead
--   of a FilePath.
--   
--   Note: calls fchown.
setFdOwnerAndGroup :: Fd -> UserID -> GroupID -> IO ()

-- | Acts as setOwnerAndGroup but does not follow symlinks (and thus
--   changes permissions on the link itself).
--   
--   Note: calls lchown.
setSymbolicLinkOwnerAndGroup :: FilePath -> UserID -> GroupID -> IO ()

-- | setFileTimes path atime mtime sets the access and
--   modification times associated with file path to
--   atime and mtime, respectively.
--   
--   Note: calls utime.
setFileTimes :: FilePath -> EpochTime -> EpochTime -> IO ()

-- | touchFile path sets the access and modification times
--   associated with file path to the current time.
--   
--   Note: calls utime.
touchFile :: FilePath -> IO ()

-- | Truncates the file down to the specified length. If the file was
--   larger than the given length before this operation was performed the
--   extra is lost.
--   
--   Note: calls truncate.
setFileSize :: FilePath -> FileOffset -> IO ()

-- | Acts as setFileSize but uses a file descriptor instead of a
--   FilePath.
--   
--   Note: calls ftruncate.
setFdSize :: Fd -> FileOffset -> IO ()
data PathVar
FileSizeBits :: PathVar
LinkLimit :: PathVar
InputLineLimit :: PathVar
InputQueueLimit :: PathVar
FileNameLimit :: PathVar
PathNameLimit :: PathVar
PipeBufferLimit :: PathVar
SymbolicLinkLimit :: PathVar
SetOwnerAndGroupIsRestricted :: PathVar
FileNamesAreNotTruncated :: PathVar
VDisableChar :: PathVar
AsyncIOAvailable :: PathVar
PrioIOAvailable :: PathVar
SyncIOAvailable :: PathVar

-- | getPathVar var path obtains the dynamic value of the
--   requested configurable file limit or option associated with file or
--   directory path. For defined file limits, getPathVar
--   returns the associated value. For defined file options, the result of
--   getPathVar is undefined, but not failure.
--   
--   Note: calls pathconf.
getPathVar :: FilePath -> PathVar -> IO Limit

-- | getFdPathVar var fd obtains the dynamic value of the
--   requested configurable file limit or option associated with the file
--   or directory attached to the open channel fd. For defined
--   file limits, getFdPathVar returns the associated value. For
--   defined file options, the result of getFdPathVar is
--   undefined, but not failure.
--   
--   Note: calls fpathconf.
getFdPathVar :: Fd -> PathVar -> IO Limit

-- | This module intends to make the operations of
--   System.Posix.Process available on all platforms.
module System.PosixCompat.Process

-- | getProcessID calls getpid to obtain the
--   ProcessID for the current process.
getProcessID :: IO ProcessID

-- | This module makes the operations exported by
--   System.Posix.Temp available on all platforms. On POSIX
--   systems it re-exports operations from System.Posix.Temp, on
--   other platforms it emulates the operations as far as possible.
module System.PosixCompat.Temp

-- | Make a unique filename and open it for reading/writing. The returned
--   FilePath is the (possibly relative) path of the created file,
--   which is padded with 6 random characters. The argument is the desired
--   prefix of the filepath of the temporary file to be created.
--   
--   If you aren't using GHC or Hugs then this function simply wraps mktemp
--   and so shouldn't be considered safe.
mkstemp :: String -> IO (FilePath, Handle)

-- | This module makes the operations exported by
--   System.Posix.Time available on all platforms. On POSIX
--   systems it re-exports operations from System.Posix.Time, on
--   other platforms it emulates the operations as far as possible.
module System.PosixCompat.Time

-- | epochTime calls time to obtain the number of seconds
--   that have elapsed since the epoch (Jan 01 00:00:00 GMT 1970).
epochTime :: IO EpochTime

-- | This module re-exports the types from System.Posix.Types on
--   all platforms.
--   
--   On Windows UserID, GroupID and LinkCount are
--   missing, so they are redefined by this module.
module System.PosixCompat.Types

-- | This module provides some functions not present in the unix package.
module System.PosixCompat.Extensions
type CMajor = CUInt
type CMinor = CUInt

-- | Gets the major number from a DeviceID for a device file.
--   
--   The portable implementation always returns 0.
deviceMajor :: DeviceID -> CMajor

-- | Gets the minor number from a DeviceID for a device file.
--   
--   The portable implementation always returns 0.
deviceMinor :: DeviceID -> CMinor

-- | Creates a DeviceID for a device file given a major and minor
--   number.
makeDeviceID :: CMajor -> CMinor -> DeviceID

-- | This module makes the operations exported by
--   System.Posix.Unistd available on all platforms. On POSIX
--   systems it re-exports operations from System.Posix.Unistd, on
--   other platforms it emulates the operations as far as possible.
module System.PosixCompat.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

-- | Sleep for the specified duration (in seconds). Returns the time
--   remaining (if the sleep was interrupted by a signal, for example).
--   
--   GHC Note: threadDelay is a better choice. Since GHC uses
--   signals for its internal clock, a call to sleep will usually be
--   interrupted immediately. That makes sleep unusable in a program
--   compiled with GHC, unless the RTS timer is disabled (with +RTS
--   -V0). Furthermore, without the -threaded option,
--   sleep will block all other user threads. Even with the
--   -threaded option, sleep requires a full OS thread to
--   itself. threadDelay has none of these shortcomings.
sleep :: Int -> IO Int

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

-- | Sleep for the specified duration (in nanoseconds)
--   
--   GHC Note: the comment for usleep also applies here.
nanosleep :: Integer -> IO ()

-- | The unix-compat package provides portable implementations of
--   parts of the unix package. On POSIX system it re-exports
--   operations from the unix package, on other platforms it
--   emulates the operations as far as possible.
module System.PosixCompat

-- | True if unix-compat is using its portable implementation, or
--   False if the unix package is simply being re-exported.
usingPortableImpl :: Bool
