|
System.Posix.Files | Portability | non-portable (requires POSIX) | Stability | provisional | Maintainer | libraries@haskell.org |
|
|
|
|
|
Description |
POSIX file support
|
|
Synopsis |
|
|
|
|
File modes
|
|
unionFileModes :: FileMode -> FileMode -> FileMode |
|
intersectFileModes :: FileMode -> FileMode -> FileMode |
|
nullFileMode :: FileMode |
|
ownerReadMode :: FileMode |
|
ownerWriteMode :: FileMode |
|
ownerExecuteMode :: FileMode |
|
ownerModes :: FileMode |
|
groupReadMode :: FileMode |
|
groupWriteMode :: FileMode |
|
groupExecuteMode :: FileMode |
|
groupModes :: FileMode |
|
otherReadMode :: FileMode |
|
otherWriteMode :: FileMode |
|
otherExecuteMode :: FileMode |
|
otherModes :: FileMode |
|
setUserIDMode :: FileMode |
|
setGroupIDMode :: FileMode |
|
stdFileMode :: FileMode |
|
accessModes :: FileMode |
|
Setting file modes
|
|
setFileMode :: FilePath -> FileMode -> IO () |
setFileMode path mode calls chmod to set the
permission bits associated with file path to mode.
|
|
setFdMode :: Fd -> FileMode -> IO () |
|
setFileCreationMask :: FileMode -> IO FileMode |
setFileCreationMask mode calls umask to set
the process's file creation mask to mode. The previous file
creation mask is returned.
|
|
Checking file existence and permissions
|
|
fileAccess :: FilePath -> Bool -> Bool -> Bool -> IO Bool |
|
fileExist :: FilePath -> IO Bool |
|
File status
|
|
data FileStatus |
|
|
Obtaining file status
|
|
getFileStatus :: FilePath -> IO FileStatus |
getFileStatus path calls stat to get the
FileStatus information for the file path.
|
|
getFdStatus :: Fd -> IO FileStatus |
getFdStatus fd calls fstat to get the
FileStatus information for the file associated with
Fd fd.
|
|
getSymbolicLinkStatus :: FilePath -> IO FileStatus |
|
Querying file status
|
|
deviceID :: FileStatus -> DeviceID |
|
fileID :: FileStatus -> FileID |
|
fileMode :: FileStatus -> FileMode |
|
linkCount :: FileStatus -> LinkCount |
|
fileOwner :: FileStatus -> UserID |
|
fileGroup :: FileStatus -> GroupID |
|
specialDeviceID :: FileStatus -> DeviceID |
|
fileSize :: FileStatus -> FileOffset |
|
accessTime :: FileStatus -> EpochTime |
|
modificationTime :: FileStatus -> EpochTime |
|
statusChangeTime :: FileStatus -> EpochTime |
|
isBlockDevice :: FileStatus -> Bool |
|
isCharacterDevice :: FileStatus -> Bool |
|
isNamedPipe :: FileStatus -> Bool |
|
isRegularFile :: FileStatus -> Bool |
|
isDirectory :: FileStatus -> Bool |
|
isSymbolicLink :: FileStatus -> Bool |
|
isSocket :: FileStatus -> Bool |
|
Creation
|
|
createNamedPipe :: FilePath -> FileMode -> IO () |
createNamedPipe fifo mode calls mkfifo to
create a new named pipe, fifo, with permissions based on
mode.
|
|
createDevice :: FilePath -> FileMode -> DeviceID -> IO () |
|
Hard links
|
|
createLink :: FilePath -> FilePath -> IO () |
createLink old new calls link to create a
new path, new, linked to an existing file, old.
|
|
removeLink :: FilePath -> IO () |
removeLink path calls unlink to remove the link
named path.
|
|
Symbolic links
|
|
createSymbolicLink :: FilePath -> FilePath -> IO () |
|
readSymbolicLink :: FilePath -> IO FilePath |
|
Renaming files
|
|
rename :: FilePath -> FilePath -> IO () |
rename old new calls rename to rename a
file or directory from old to new.
|
|
Changing file ownership
|
|
setOwnerAndGroup :: FilePath -> UserID -> GroupID -> IO () |
setOwnerAndGroup path uid gid calls chown to
set the UserID and GroupID associated with file
path to uid and gid, respectively.
|
|
setFdOwnerAndGroup :: Fd -> UserID -> GroupID -> IO () |
|
setSymbolicLinkOwnerAndGroup :: FilePath -> UserID -> GroupID -> IO () |
|
Changing file timestamps
|
|
setFileTimes :: FilePath -> EpochTime -> EpochTime -> IO () |
setFileTimes path atime mtime calls utime to
set the access and modification times associated with file
path to atime and mtime, respectively.
|
|
touchFile :: FilePath -> IO () |
touchFile path calls utime to
set the access and modification times associated with file
path to the current time.
|
|
Setting file sizes
|
|
setFileSize :: FilePath -> FileOffset -> IO () |
|
setFdSize :: Fd -> FileOffset -> IO () |
|
Find system-specific limits for a file
|
|
data PathVar |
Constructors | FileSizeBits | | LinkLimit | | InputLineLimit | | InputQueueLimit | | FileNameLimit | | PathNameLimit | | PipeBufferLimit | | SymbolicLinkLimit | | SetOwnerAndGroupIsRestricted | | FileNamesAreNotTruncated | | VDisableChar | | AsyncIOAvailable | | PrioIOAvailable | | SyncIOAvailable | |
|
|
|
getPathVar :: FilePath -> PathVar -> IO Limit |
getPathVar var path calls pathconf to obtain 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.
|
|
getFdPathVar :: Fd -> PathVar -> IO Limit |
getFdPathVar var fd calls fpathconf to obtain 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.
|
|
Produced by Haddock version 0.7 |