bdbuf and file write

Chris Johns chrisj at rtems.org
Sat Apr 7 01:19:19 UTC 2012


On 6/04/12 8:32 PM, ali nasir wrote:
>
> Hi,
>
> With the RTEMS4.9, When we try to write a file on an SDCARD using the fwrite(..), we see that even after fwrite call has returned, the write operation is still in progress in the background on the SDCARD. This we see because the low level sdc ard drivers are still being getting called by the swapout task even after the fwrite has returned.
>
> Is there a way for the application (the task who calls the fwrite(..)) to know that data writing to the physical device is complete?
>

There is the sync API in bdbuf where you can ask to wait until a 
specific device has sync'ed all its data to the media. I think there is 
an ioctl call to access it.

There is also the fsync call in newlib that you need to make to flush 
the libc layer buffers.

The RTEMS libcsupport for sync needed some work to cover the bdbuf 
layer. I do not think that has happened yet. That means you may need a 
sync or fsync call and a device ioctl call to make sure all the data is 
written to the physical media.

Chris



More information about the users mailing list