(Fwd) Re: DOSFS bug fixes, IDE drivers and sample released

Joel Sherrill joel.sherrill at OARcorp.com
Thu Apr 17 13:08:30 UTC 2003



"Victor V. Vengerov" wrote:
> 
> Angelo Fraietta wrote:
> 
> >
> > I tried fflush (using fopen), without effect.
> 
> fflush() flushes only buffers maintained inside the libc library.
> 
> The following quote is from fflush(3) Linux man page:
> ***
> NOTES
>        Note that fflush() only flushes the user space buffers provided
> by  the
>        C  library.   To  ensure that the data is physically stored on
> disk the
>        kernel buffers must be flushed too, e.g. with sync(2) or fsync(2).
> ***
> It completely in sync with newlib fflush() implementation.
> 
> I agree, it is reasonable to flush buffers when file closed. People may
> expect that data synchronized when file closed. Nevertheless, Linux
> man page close(3) declares that:
> 
> ***
> NOTES
>        ...
>        A  successful  close does not guarantee that the data has been
> success-
>        fully saved to disk, as the kernel defers writes. It is not
> common  for
>        a  filesystem  to  flush  the buffers when the stream is closed.
> If you
>        need to be sure that the data is physically stored use
> fsync(2).   (It
>        will depend on the disk hardware at this point.)
> ***
> 
> I don't think that data synchronization on close() contradict to POSIX, but
> it impacts on close() performance.
> 
> Any opinions?

Sounds like the behavior is correct and this is just one of those
cases where when you look too close you don't see what you expected.

> Victor
> 
> --
> Victor V. Vengerov
> OKTET Ltd.
> Ulianovskaya st., 1, office 533, St.-Petersburg 198504 Russia
> phone: +7 812 4284384 (work), +7 812 9389372 (mobile), +7 812 4281653 (home)

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985



More information about the users mailing list