-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Where are the other open flags #6
Comments
The design is kind of gross there, I would have newtyped over the int and provided a Monoid instance. That said we're probably stuck with it now. Please send a pull request if you need the other flags (it will require a major version bump). |
I cannot say much about the other flags, but |
@gregorycollins If I want to add some things to this, how would I deal with cross-platform compatibility and what platforms to I have to take care of? Relatedly, this is the intersection of supported
And of those, the following are not implemented in the
|
Also, |
is there any reason why the alternative monoidal interface couldn't be added? |
@cartazio how exactly would you suggest doing that w/o breaking backward compatibility? |
add a new module? :) |
...or just by adding a new open function with a new name. I think we should deprecate the old style --- as noted on this bug, it doesn't cover all of the available flags, and extending the type or providing platform-specific flags is problematic because you will break pattern-matching if callers do that for some reason. The current API is also wasteful -- six heap allocations and all of those bools have to be walked by openFd. Newtype-over-int will probably get unboxed into a register. |
thats a better idea :) |
Fixes haskell#57 and wrt haskell#6 (only partly fixed)
Fixes haskell#57 Fixes haskell#58 Wrt haskell#6 (only partly fixed)
Fixes haskell#57 Fixes haskell#58 Wrt haskell#6 (only partly fixed)
unix-2.8.0.0 will have: data OpenFileFlags =
OpenFileFlags {
append :: Bool, -- ^ O_APPEND
exclusive :: Bool, -- ^ O_EXCL, result is undefined if O_CREAT is False
--
-- __NOTE__: Result is undefined if 'creat' is 'Nothing'.
noctty :: Bool, -- ^ O_NOCTTY
nonBlock :: Bool, -- ^ O_NONBLOCK
trunc :: Bool, -- ^ O_TRUNC
nofollow :: Bool, -- ^ O_NOFOLLOW
--
-- @since 2.8.0.0
creat :: Maybe FileMode, -- ^ O_CREAT
--
-- @since 2.8.0.0
cloexec :: Bool, -- ^ O_CLOEXEC
--
-- @since 2.8.0.0
directory :: Bool, -- ^ O_DIRECTORY
--
-- @since 2.8.0.0
sync :: Bool -- ^ O_SYNC
--
-- @since 2.8.0.0
}
So I think this can be closed. |
@hasufell Thank you, that is very useful. I am very looking forward to the unix-2.8.0.0 release; with #59 in there we will finally have a chance to tack The CLOEXEC problem across the Haskell ecosystem. Also thanks for your other recent |
I'd like to create an FD with
O_CLOEXEC
.What would be the most high-level way to do that?
http://hackage.haskell.org/package/unix-2.7.0.1/docs/System-Posix-IO.html#v:OpenFileFlags only gives me
append
,exclusive
,noctty
,nonBlock
,trunc
. What's the idea behind this selection, and can the other flags easily be added?The text was updated successfully, but these errors were encountered: