Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
U
unix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Rinat Striungis
unix
Commits
d0defcf5
Commit
d0defcf5
authored
11 years ago
by
bos
Browse files
Options
Downloads
Patches
Plain Diff
Drop trailing whitespace
parent
c1983d5a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
System/Posix/Files/Common.hsc
+17
-17
17 additions, 17 deletions
System/Posix/Files/Common.hsc
with
17 additions
and
17 deletions
System/Posix/Files/Common.hsc
+
17
−
17
View file @
d0defcf5
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
-- Module : System.Posix.Files.Common
-- Module : System.Posix.Files.Common
-- Copyright : (c) The University of Glasgow 2002
-- Copyright : (c) The University of Glasgow 2002
-- License : BSD-style (see the file libraries/base/LICENSE)
-- License : BSD-style (see the file libraries/base/LICENSE)
--
--
-- Maintainer : libraries@haskell.org
-- Maintainer : libraries@haskell.org
-- Stability : provisional
-- Stability : provisional
-- Portability : non-portable (requires POSIX)
-- Portability : non-portable (requires POSIX)
...
@@ -155,8 +155,8 @@ setGroupIDMode = (#const S_ISGID)
...
@@ -155,8 +155,8 @@ setGroupIDMode = (#const S_ISGID)
-- | Owner, group and others have read and write permission.
-- | Owner, group and others have read and write permission.
stdFileMode :: FileMode
stdFileMode :: FileMode
stdFileMode = ownerReadMode .|. ownerWriteMode .|.
stdFileMode = ownerReadMode .|. ownerWriteMode .|.
groupReadMode .|. groupWriteMode .|.
groupReadMode .|. groupWriteMode .|.
otherReadMode .|. otherWriteMode
otherReadMode .|. otherWriteMode
-- | Owner has read, write and execute permission.
-- | Owner has read, write and execute permission.
...
@@ -217,7 +217,7 @@ setFdMode :: Fd -> FileMode -> IO ()
...
@@ -217,7 +217,7 @@ setFdMode :: Fd -> FileMode -> IO ()
setFdMode (Fd fd) m =
setFdMode (Fd fd) m =
throwErrnoIfMinus1_ "setFdMode" (c_fchmod fd m)
throwErrnoIfMinus1_ "setFdMode" (c_fchmod fd m)
foreign import ccall unsafe "fchmod"
foreign import ccall unsafe "fchmod"
c_fchmod :: CInt -> CMode -> IO CInt
c_fchmod :: CInt -> CMode -> IO CInt
-- | @setFileCreationMask mode@ sets the file mode creation mask to @mode@.
-- | @setFileCreationMask mode@ sets the file mode creation mask to @mode@.
...
@@ -268,9 +268,9 @@ statusChangeTime :: FileStatus -> EpochTime
...
@@ -268,9 +268,9 @@ statusChangeTime :: FileStatus -> EpochTime
-- | Time of last status change (i.e. owner, group, link count, mode, etc.) in sub-second resolution.
-- | Time of last status change (i.e. owner, group, link count, mode, etc.) in sub-second resolution.
statusChangeTimeHiRes :: FileStatus -> POSIXTime
statusChangeTimeHiRes :: FileStatus -> POSIXTime
deviceID (FileStatus stat) =
deviceID (FileStatus stat) =
unsafePerformIO $ withForeignPtr stat $ (#peek struct stat, st_dev)
unsafePerformIO $ withForeignPtr stat $ (#peek struct stat, st_dev)
fileID (FileStatus stat) =
fileID (FileStatus stat) =
unsafePerformIO $ withForeignPtr stat $ (#peek struct stat, st_ino)
unsafePerformIO $ withForeignPtr stat $ (#peek struct stat, st_ino)
fileMode (FileStatus stat) =
fileMode (FileStatus stat) =
unsafePerformIO $ withForeignPtr stat $ (#peek struct stat, st_mode)
unsafePerformIO $ withForeignPtr stat $ (#peek struct stat, st_mode)
...
@@ -375,19 +375,19 @@ isSymbolicLink :: FileStatus -> Bool
...
@@ -375,19 +375,19 @@ isSymbolicLink :: FileStatus -> Bool
-- | Checks if this file is a socket device.
-- | Checks if this file is a socket device.
isSocket :: FileStatus -> Bool
isSocket :: FileStatus -> Bool
isBlockDevice stat =
isBlockDevice stat =
(fileMode stat `intersectFileModes` fileTypeModes) == blockSpecialMode
(fileMode stat `intersectFileModes` fileTypeModes) == blockSpecialMode
isCharacterDevice stat =
isCharacterDevice stat =
(fileMode stat `intersectFileModes` fileTypeModes) == characterSpecialMode
(fileMode stat `intersectFileModes` fileTypeModes) == characterSpecialMode
isNamedPipe stat =
isNamedPipe stat =
(fileMode stat `intersectFileModes` fileTypeModes) == namedPipeMode
(fileMode stat `intersectFileModes` fileTypeModes) == namedPipeMode
isRegularFile stat =
isRegularFile stat =
(fileMode stat `intersectFileModes` fileTypeModes) == regularFileMode
(fileMode stat `intersectFileModes` fileTypeModes) == regularFileMode
isDirectory stat =
isDirectory stat =
(fileMode stat `intersectFileModes` fileTypeModes) == directoryMode
(fileMode stat `intersectFileModes` fileTypeModes) == directoryMode
isSymbolicLink stat =
isSymbolicLink stat =
(fileMode stat `intersectFileModes` fileTypeModes) == symbolicLinkMode
(fileMode stat `intersectFileModes` fileTypeModes) == symbolicLinkMode
isSocket stat =
isSocket stat =
(fileMode stat `intersectFileModes` fileTypeModes) == socketMode
(fileMode stat `intersectFileModes` fileTypeModes) == socketMode
-- | @getFdStatus fd@ acts as 'getFileStatus' but uses a file descriptor @fd@.
-- | @getFdStatus fd@ acts as 'getFileStatus' but uses a file descriptor @fd@.
...
@@ -395,7 +395,7 @@ isSocket stat =
...
@@ -395,7 +395,7 @@ isSocket stat =
-- Note: calls @fstat@.
-- Note: calls @fstat@.
getFdStatus :: Fd -> IO FileStatus
getFdStatus :: Fd -> IO FileStatus
getFdStatus (Fd fd) = do
getFdStatus (Fd fd) = do
fp <- mallocForeignPtrBytes (#const sizeof(struct stat))
fp <- mallocForeignPtrBytes (#const sizeof(struct stat))
withForeignPtr fp $ \p ->
withForeignPtr fp $ \p ->
throwErrnoIfMinus1_ "getFdStatus" (c_fstat fd p)
throwErrnoIfMinus1_ "getFdStatus" (c_fstat fd p)
return (FileStatus fp)
return (FileStatus fp)
...
@@ -511,7 +511,7 @@ touchFd =
...
@@ -511,7 +511,7 @@ touchFd =
--
--
-- Note: calls @fchown@.
-- Note: calls @fchown@.
setFdOwnerAndGroup :: Fd -> UserID -> GroupID -> IO ()
setFdOwnerAndGroup :: Fd -> UserID -> GroupID -> IO ()
setFdOwnerAndGroup (Fd fd) uid gid =
setFdOwnerAndGroup (Fd fd) uid gid =
throwErrnoIfMinus1_ "setFdOwnerAndGroup" (c_fchown fd uid gid)
throwErrnoIfMinus1_ "setFdOwnerAndGroup" (c_fchown fd uid gid)
foreign import ccall unsafe "fchown"
foreign import ccall unsafe "fchown"
...
@@ -603,8 +603,8 @@ pathVarConst v = case v of
...
@@ -603,8 +603,8 @@ pathVarConst v = case v of
-- Note: calls @fpathconf@.
-- Note: calls @fpathconf@.
getFdPathVar :: Fd -> PathVar -> IO Limit
getFdPathVar :: Fd -> PathVar -> IO Limit
getFdPathVar (Fd fd) v =
getFdPathVar (Fd fd) v =
throwErrnoIfMinus1 "getFdPathVar" $
throwErrnoIfMinus1 "getFdPathVar" $
c_fpathconf fd (pathVarConst v)
c_fpathconf fd (pathVarConst v)
foreign import ccall unsafe "fpathconf"
foreign import ccall unsafe "fpathconf"
c_fpathconf :: CInt -> CInt -> IO CLong
c_fpathconf :: CInt -> CInt -> IO CLong
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment