Skip to content
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

Implement an fdatasync alternative on OS X #43

Open
argiopetech opened this issue Mar 9, 2015 · 2 comments
Open

Implement an fdatasync alternative on OS X #43

argiopetech opened this issue Mar 9, 2015 · 2 comments

Comments

@argiopetech
Copy link
Contributor

fdatasync() is not supported (as such) on OS X. An alternative using fcntl() is detailed in a picoc issue.

We should provide the fcntl()-based alternative on OS X (and presumably iOS).

@hvr
Copy link
Member

hvr commented Jan 30, 2016

Even though this may appear convenient at first, I'm very sceptical about making unix into an emulation layer. I'd rather have unix's goal be focusing on providing API bindings for system calls provided by the underlying OS, unless there's a generic and portable fallback implementation possible that accurately implements the required semantics.

I'm strongly against starting to clutter the code with all sorts of #if darwin_HOST_OS conditionals, as this violates Autoconf's philosophy of checking for features rather than os/versions.

@hasufell
Copy link
Member

fcntl is documented by posix: https://pubs.opengroup.org/onlinepubs/007904975/functions/fcntl.html

We seem to have a module for it: https://github.com/haskell/unix/blob/master/System/Posix/Fcntl.hsc

But no binding to it.

The main caveat is that fcntl is a variadic function. With the capi calling convention we can interface with such functions, but still have to give them a constant number of arguments: https://downloads.haskell.org/~ghc/8.10.7/docs/html/users_guide/ffi-chap.html?highlight=capi#varargs-not-supported-by-ccall-calling-convention

So I'm not sure how useful a raw binding would be here.

My guess would be someone can implement an alternative to fdatasync in a new library?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants