
Rather than patching the Posix library to include stuff like O_SYNC, I'd like to see a Haskell binding to the Single UNIX (aka Unix98) instead - it subsumes the POSIX.1 APIs (and you can get at the specs without having to pay the extortionate rates that IEEE charges). Feel free to contribute such a binding!
I'm afraid I will not. There is pretty huge number of functions to bind, and I'm afraid to miss some. Then I'm not wery good Haskeller.
Moreover, I could not see the Single Unix features in the linux-2.2 (at least that nice O_DSYNC flag). Maybe they are presented in 2.4, but I have no plan to use it.
AFAIK no OS implements all of the Single Unix specification. Nevertheless, I think, Sigbjorn is right. Ideally, we should have a binding for Single Unix and on any particular OS, you will have a subset of it available (that's the same situation as you have with any other programming language).
As is pointed out in the open(2) man page, O_SYNC, O_DSYNC, and O_RSYNC are synonymous in Linux 2.2. In 2.4, at least with some file systems (eg, XFS) you can choose which behaviour O_SYNC should have.
I'd like to see a full SUS binding too. I also think that POSIX is a useful subset, because as Manuel says nobody implements the full SUS but pretty much everyone implements full POSIX (not always with the same semantics though :-). So my preferred solution would be a Unix library, from which Posix re-exports a subset. I started rewriting GHC's Posix library a while back - I got about half way though, and I'll get back onto it when I turn my attention to the new libraries again. I've kept all the suggestions from people on the lists regarding the Posix interface, and I'll put together a proposal for the new interface at some point. Discussion about the interface should probably move to libraries@haskell.org. Cheers, Simon