Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
U
unix
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository 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
Glasgow Haskell Compiler
Packages
unix
Commits
b7b180d2
Commit
b7b180d2
authored
14 years ago
by
Simon Marlow
Browse files
Options
Downloads
Patches
Plain Diff
allow some syscalls in System.Posix.Directory to return EINTR (#5184)
parent
cdf2106d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
System/Posix/Directory.hsc
+7
-5
7 additions, 5 deletions
System/Posix/Directory.hsc
System/Posix/Error.hs
+6
-1
6 additions, 1 deletion
System/Posix/Error.hs
with
13 additions
and
6 deletions
System/Posix/Directory.hsc
+
7
−
5
View file @
b7b180d2
...
...
@@ -45,8 +45,10 @@ import Foreign.C
-- @mode@.
createDirectory :: FilePath -> FileMode -> IO ()
createDirectory name mode =
withCString name $ \s ->
throwErrnoPathIfMinus1_ "createDirectory" name (c_mkdir s mode)
withCString name $ \s ->
throwErrnoPathIfMinus1Retry_ "createDirectory" name (c_mkdir s mode)
-- POSIX doesn't allow mkdir() to return EINTR, but it does on
-- OS X (#5184), so we need the Retry variant here.
foreign import ccall unsafe "mkdir"
c_mkdir :: CString -> CMode -> IO CInt
...
...
@@ -58,7 +60,7 @@ newtype DirStream = DirStream (Ptr CDir)
openDirStream :: FilePath -> IO DirStream
openDirStream name =
withCString name $ \s -> do
dirp <- throwErrnoPathIfNull "openDirStream" name $ c_opendir s
dirp <- throwErrnoPathIfNull
Retry
"openDirStream" name $ c_opendir s
return (DirStream dirp)
foreign import ccall unsafe "__hsunix_opendir"
...
...
@@ -115,7 +117,7 @@ foreign import ccall unsafe "rewinddir"
-- the directory stream @dp@.
closeDirStream :: DirStream -> IO ()
closeDirStream (DirStream dirp) = do
throwErrnoIfMinus1_ "closeDirStream" (c_closedir dirp)
throwErrnoIfMinus1
Retry
_ "closeDirStream" (c_closedir dirp)
foreign import ccall unsafe "closedir"
c_closedir :: Ptr CDir -> IO CInt
...
...
@@ -190,7 +192,7 @@ foreign import ccall unsafe "rmdir"
changeWorkingDirectoryFd :: Fd -> IO ()
changeWorkingDirectoryFd (Fd fd) =
throwErrnoIfMinus1_ "changeWorkingDirectoryFd" (c_fchdir fd)
throwErrnoIfMinus1
Retry
_ "changeWorkingDirectoryFd" (c_fchdir fd)
foreign import ccall unsafe "fchdir"
c_fchdir :: CInt -> IO CInt
This diff is collapsed.
Click to expand it.
System/Posix/Error.hs
+
6
−
1
View file @
b7b180d2
...
...
@@ -21,7 +21,8 @@ module System.Posix.Error (
throwErrnoPathIfNullRetry
,
throwErrnoPathIfMinus1
,
throwErrnoPathIfMinus1_
,
throwErrnoPathIfMinus1Retry
throwErrnoPathIfMinus1Retry
,
throwErrnoPathIfMinus1Retry_
)
where
import
Foreign
...
...
@@ -31,6 +32,10 @@ throwErrnoPathIfMinus1Retry :: Num a => String -> FilePath -> IO a -> IO a
throwErrnoPathIfMinus1Retry
loc
path
f
=
throwErrnoPathIfRetry
(
==
-
1
)
loc
path
f
throwErrnoPathIfMinus1Retry_
::
Num
a
=>
String
->
FilePath
->
IO
a
->
IO
()
throwErrnoPathIfMinus1Retry_
loc
path
f
=
void
$
throwErrnoPathIfRetry
(
==
-
1
)
loc
path
f
throwErrnoPathIfNullRetry
::
String
->
FilePath
->
IO
(
Ptr
a
)
->
IO
(
Ptr
a
)
throwErrnoPathIfNullRetry
loc
path
f
=
throwErrnoPathIfRetry
(
==
nullPtr
)
loc
path
f
...
...
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