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

Ralf Corsepius corsepiu at faw.uni-ulm.de
Thu May 22 08:23:36 UTC 2003


Am Don, 2003-05-22 um 04.05 schrieb Angelo Fraietta:
> fsync does not seem to be working as I think it should.
> 
> I have a large file that already exists on the drive.
> 
> I do the following:
> File* fp = fopen (filename, "w+b");
> 
> if (fp)
> {
>     char c = 'a';
>     fwrite (&a, 1, 1, fp);
>     fsync(fileno(fp));
>     fclose (fp);
>     restartRtems();
> }
> 
> The file on disk remains unchanged

Have you tried using sync(2)?

I.e. something similar to this:

fwrite( ...);
fclose(..);

sync();
restartRtems();

[fclose should implicitly fflush the file, while the sync() should flush
the physical buffers.]

Ralf





More information about the users mailing list