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


Hi,
> There is no fsync() call for the stream, there is no direct access
> to file descriptor, flush() is reported not to mimic fsync().
>
> 1. Is there some way how to force fsync()?
> 2. If not should be this considered as bug/enh request for libstdc++?
>   
My first reaction to this issue, is that in general the C++ fstreams, as
specified in the ISO C++ Standard which we are implementing, don't do
anything special beyond the C way of opening and closing files. Thus, if
in C you have to call fsync by hand, I don't think there is anything to
fix in the C++ library. About fsync itself, then, there is the rather
well known problem with the C++ fstreams not exporting the underlying
FILE*: for that issue, we are providing a thin wrapper, called
stdio_filebuf, <ext/stdio_filebuf.h>, which you may find useful, or look
on the net for more complete solutions. There are many.

I don't think there is something new in C++1x about this specific
issue... but I may be wrong, in case just let me know, and I'll see if
we can raise the priority for implementing those bits.

Paolo.


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