* Andy Lutomirski:
I think I mostly agree with your analysis except that I really don't
like the ENOSPC. The kernel actually has the ability to commit to
having space for pending writes on an fd *without syncing*, then I
think that capability should be expose to userspace. fsync is a
pretty poor alternative for code that just wants to make sure that, in
the absence of a bug, crash or physical failure, the data won't be
lost.
It's something we might want to call from fflush.
As a replacement, dup3/close doesn't quite work because it releases
POSIX advisory locks on the original descriptor (as they are per
process, not per descriptor).
Thanks,
Florian