Re: FILE_FLAG_WRITE_THROUGH

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rebelde wrote:

> On Windows XP I can write directly to disk whitout cache write using the 
> CreateFile function with FILE_FLAG_WRITE_THROUGH. Could someone tell me 
> how to make this on Linux?

Pass the O_SYNC flag to open(). This will cause write() calls to block
until the data has been sent to the drive.

The O_DIRECT flag suggested by Steve is probably overkill. It requires
that the buffer start address, buffer size and file offset are all
multiples of the filesystem's block size, and only works on some
filesystems.

-- 
Glynn Clements <glynn@xxxxxxxxxxxxxxxxxx>
-
: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux