This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ofstream, fsync and data loss bugs


> It's an interesting problem, if not a new one.  There is no way to
> fsync in portable C, you have to use fileno to get a descriptor from a
> FILE* ... but if you're in a POSIX environment you know you can do
> that. The problem in C++ is similar, except there's not even a
> portable way to get a "native handle" which can then be used with with
> fsync (via fileno if necessary.)
> 
> The new C++ standard acknowledges the existence of POSIX and the
> threading components provide implementation-defined ways to access
> non-portable native handles, it's a shame we didn't revisit iostreams
> to do something similar. I don't have a good answer, and it's too late
> to deal with it for C++1x.

Isn't possible that C++ standard could be interpreted in the way that
you are free to use fsync() inside close() implementation? 

Pavel


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]