diff options
author | Herbert Valerio Riedel <hvr@gnu.org> | 2014-12-06 17:08:06 +0100 |
---|---|---|
committer | Herbert Valerio Riedel <hvr@gnu.org> | 2014-12-06 17:08:06 +0100 |
commit | 078666f4399f368e2f3dd82b5081dc1ad9b9fdc2 (patch) | |
tree | 247882ab50a9e32a659aa513751f9e16ec310207 /System/Posix/Files | |
parent | 558b0fb4eaa4aebc823022b3e1d560da3faad658 (diff) |
`M-x untabify` && `M-x delete-trailing-whitespace`
Diffstat (limited to 'System/Posix/Files')
-rw-r--r-- | System/Posix/Files/ByteString.hsc | 30 | ||||
-rw-r--r-- | System/Posix/Files/Common.hsc | 66 |
2 files changed, 48 insertions, 48 deletions
diff --git a/System/Posix/Files/ByteString.hsc b/System/Posix/Files/ByteString.hsc index ec58cb1..0d19ae8 100644 --- a/System/Posix/Files/ByteString.hsc +++ b/System/Posix/Files/ByteString.hsc @@ -8,7 +8,7 @@ -- Module : System.Posix.Files.ByteString -- Copyright : (c) The University of Glasgow 2002 -- License : BSD-style (see the file libraries/base/LICENSE) --- +-- -- Maintainer : libraries@haskell.org -- Stability : provisional -- Portability : non-portable (requires POSIX) @@ -62,7 +62,7 @@ module System.Posix.Files.ByteString ( isDirectory, isSymbolicLink, isSocket, -- * Creation - createNamedPipe, + createNamedPipe, createDevice, -- * Hard links @@ -143,7 +143,7 @@ fileAccess name readOK writeOK execOK = access name flags -- -- Note: calls @access@. fileExist :: RawFilePath -> IO Bool -fileExist name = +fileExist name = withFilePath name $ \s -> do r <- c_access s (#const F_OK) if (r == 0) @@ -154,7 +154,7 @@ fileExist name = else throwErrnoPath "fileExist" name access :: RawFilePath -> CMode -> IO Bool -access name flags = +access name flags = withFilePath name $ \s -> do r <- c_access s (fromIntegral flags) if (r == 0) @@ -172,9 +172,9 @@ access name flags = -- Note: calls @stat@. getFileStatus :: RawFilePath -> IO FileStatus getFileStatus path = do - fp <- mallocForeignPtrBytes (#const sizeof(struct stat)) + fp <- mallocForeignPtrBytes (#const sizeof(struct stat)) withForeignPtr fp $ \p -> - withFilePath path $ \s -> + withFilePath path $ \s -> throwErrnoPathIfMinus1Retry_ "getFileStatus" path (c_stat s p) return (FileStatus fp) @@ -185,9 +185,9 @@ getFileStatus path = do -- Note: calls @lstat@. getSymbolicLinkStatus :: RawFilePath -> IO FileStatus getSymbolicLinkStatus path = do - fp <- mallocForeignPtrBytes (#const sizeof(struct stat)) + fp <- mallocForeignPtrBytes (#const sizeof(struct stat)) withForeignPtr fp $ \p -> - withFilePath path $ \s -> + withFilePath path $ \s -> throwErrnoPathIfMinus1_ "getSymbolicLinkStatus" path (c_lstat s p) return (FileStatus fp) @@ -203,7 +203,7 @@ foreign import ccall unsafe "__hsunix_lstat" -- Note: calls @mkfifo@. createNamedPipe :: RawFilePath -> FileMode -> IO () createNamedPipe name mode = do - withFilePath name $ \s -> + withFilePath name $ \s -> throwErrnoPathIfMinus1_ "createNamedPipe" name (c_mkfifo s mode) -- | @createDevice path mode dev@ creates either a regular or a special file @@ -219,7 +219,7 @@ createDevice path mode dev = withFilePath path $ \s -> throwErrnoPathIfMinus1_ "createDevice" path (c_mknod s mode dev) -foreign import ccall unsafe "__hsunix_mknod" +foreign import ccall unsafe "__hsunix_mknod" c_mknod :: CString -> CMode -> CDev -> IO CInt -- ----------------------------------------------------------------------------- @@ -278,7 +278,7 @@ readSymbolicLink :: RawFilePath -> IO RawFilePath readSymbolicLink file = allocaArray0 (#const PATH_MAX) $ \buf -> do withFilePath file $ \s -> do - len <- throwErrnoPathIfMinus1 "readSymbolicLink" file $ + len <- throwErrnoPathIfMinus1 "readSymbolicLink" file $ c_readlink s buf (#const PATH_MAX) peekFilePathLen (buf,fromIntegral len) @@ -419,7 +419,7 @@ touchSymbolicLink = -- -- Note: calls @truncate@. setFileSize :: RawFilePath -> FileOffset -> IO () -setFileSize file off = +setFileSize file off = withFilePath file $ \s -> throwErrnoPathIfMinus1_ "setFileSize" file (c_truncate s off) @@ -438,9 +438,9 @@ foreign import capi unsafe "HsUnix.h truncate" -- Note: calls @pathconf@. getPathVar :: RawFilePath -> PathVar -> IO Limit getPathVar name v = do - withFilePath name $ \ nameP -> - throwErrnoPathIfMinus1 "getPathVar" name $ + withFilePath name $ \ nameP -> + throwErrnoPathIfMinus1 "getPathVar" name $ c_pathconf nameP (pathVarConst v) -foreign import ccall unsafe "pathconf" +foreign import ccall unsafe "pathconf" c_pathconf :: CString -> CInt -> IO CLong diff --git a/System/Posix/Files/Common.hsc b/System/Posix/Files/Common.hsc index 62fff6b..586b417 100644 --- a/System/Posix/Files/Common.hsc +++ b/System/Posix/Files/Common.hsc @@ -159,8 +159,8 @@ setGroupIDMode = (#const S_ISGID) -- | Owner, group and others have read and write permission. stdFileMode :: FileMode stdFileMode = ownerReadMode .|. ownerWriteMode .|. - groupReadMode .|. groupWriteMode .|. - otherReadMode .|. otherWriteMode + groupReadMode .|. groupWriteMode .|. + otherReadMode .|. otherWriteMode -- | Owner has read, write and execute permission. ownerModes :: FileMode @@ -534,67 +534,67 @@ setFdSize (Fd fd) off = -- pathconf()/fpathconf() support data PathVar - = FileSizeBits {- _PC_FILESIZEBITS -} + = FileSizeBits {- _PC_FILESIZEBITS -} | LinkLimit {- _PC_LINK_MAX -} | InputLineLimit {- _PC_MAX_CANON -} | InputQueueLimit {- _PC_MAX_INPUT -} | FileNameLimit {- _PC_NAME_MAX -} | PathNameLimit {- _PC_PATH_MAX -} | PipeBufferLimit {- _PC_PIPE_BUF -} - -- These are described as optional in POSIX: - {- _PC_ALLOC_SIZE_MIN -} - {- _PC_REC_INCR_XFER_SIZE -} - {- _PC_REC_MAX_XFER_SIZE -} - {- _PC_REC_MIN_XFER_SIZE -} - {- _PC_REC_XFER_ALIGN -} - | SymbolicLinkLimit {- _PC_SYMLINK_MAX -} + -- These are described as optional in POSIX: + {- _PC_ALLOC_SIZE_MIN -} + {- _PC_REC_INCR_XFER_SIZE -} + {- _PC_REC_MAX_XFER_SIZE -} + {- _PC_REC_MIN_XFER_SIZE -} + {- _PC_REC_XFER_ALIGN -} + | SymbolicLinkLimit {- _PC_SYMLINK_MAX -} | SetOwnerAndGroupIsRestricted {- _PC_CHOWN_RESTRICTED -} | FileNamesAreNotTruncated {- _PC_NO_TRUNC -} - | VDisableChar {- _PC_VDISABLE -} - | AsyncIOAvailable {- _PC_ASYNC_IO -} - | PrioIOAvailable {- _PC_PRIO_IO -} - | SyncIOAvailable {- _PC_SYNC_IO -} + | VDisableChar {- _PC_VDISABLE -} + | AsyncIOAvailable {- _PC_ASYNC_IO -} + | PrioIOAvailable {- _PC_PRIO_IO -} + | SyncIOAvailable {- _PC_SYNC_IO -} pathVarConst :: PathVar -> CInt pathVarConst v = case v of - LinkLimit -> (#const _PC_LINK_MAX) - InputLineLimit -> (#const _PC_MAX_CANON) - InputQueueLimit -> (#const _PC_MAX_INPUT) - FileNameLimit -> (#const _PC_NAME_MAX) - PathNameLimit -> (#const _PC_PATH_MAX) - PipeBufferLimit -> (#const _PC_PIPE_BUF) - SetOwnerAndGroupIsRestricted -> (#const _PC_CHOWN_RESTRICTED) - FileNamesAreNotTruncated -> (#const _PC_NO_TRUNC) - VDisableChar -> (#const _PC_VDISABLE) + LinkLimit -> (#const _PC_LINK_MAX) + InputLineLimit -> (#const _PC_MAX_CANON) + InputQueueLimit -> (#const _PC_MAX_INPUT) + FileNameLimit -> (#const _PC_NAME_MAX) + PathNameLimit -> (#const _PC_PATH_MAX) + PipeBufferLimit -> (#const _PC_PIPE_BUF) + SetOwnerAndGroupIsRestricted -> (#const _PC_CHOWN_RESTRICTED) + FileNamesAreNotTruncated -> (#const _PC_NO_TRUNC) + VDisableChar -> (#const _PC_VDISABLE) #ifdef _PC_SYNC_IO - SyncIOAvailable -> (#const _PC_SYNC_IO) + SyncIOAvailable -> (#const _PC_SYNC_IO) #else - SyncIOAvailable -> error "_PC_SYNC_IO not available" + SyncIOAvailable -> error "_PC_SYNC_IO not available" #endif #ifdef _PC_ASYNC_IO - AsyncIOAvailable -> (#const _PC_ASYNC_IO) + AsyncIOAvailable -> (#const _PC_ASYNC_IO) #else - AsyncIOAvailable -> error "_PC_ASYNC_IO not available" + AsyncIOAvailable -> error "_PC_ASYNC_IO not available" #endif #ifdef _PC_PRIO_IO - PrioIOAvailable -> (#const _PC_PRIO_IO) + PrioIOAvailable -> (#const _PC_PRIO_IO) #else - PrioIOAvailable -> error "_PC_PRIO_IO not available" + PrioIOAvailable -> error "_PC_PRIO_IO not available" #endif #if _PC_FILESIZEBITS - FileSizeBits -> (#const _PC_FILESIZEBITS) + FileSizeBits -> (#const _PC_FILESIZEBITS) #else - FileSizeBits -> error "_PC_FILESIZEBITS not available" + FileSizeBits -> error "_PC_FILESIZEBITS not available" #endif #if _PC_SYMLINK_MAX - SymbolicLinkLimit -> (#const _PC_SYMLINK_MAX) + SymbolicLinkLimit -> (#const _PC_SYMLINK_MAX) #else - SymbolicLinkLimit -> error "_PC_SYMLINK_MAX not available" + SymbolicLinkLimit -> error "_PC_SYMLINK_MAX not available" #endif -- | @getFdPathVar var fd@ obtains the dynamic value of the requested |