If I'm writing to a file/device in blocking mode does the write()
call return on writing all the bytes(assume no signal interruption) to Buffered Cache(Kernel Buffer)
or it returns on writing all bytes to the file/device? (This is extension to my earlier question).
Asked
Active
Viewed 230 times
2

Community
- 1
- 1

FourOfAKind
- 2,298
- 5
- 31
- 34
1 Answers
1
If successful, write
returns after writing the data to kernel memory. The write
system call makes no guarantees about writing to the disk, you need fsync
for that. Actually, fsync
does not guarantee that the bits were actually written to the platter itself: just that the IO operation is complete.
(Of course, there are various platform-specific modes and settings you can use to alter this behavior.)

Dietrich Epp
- 205,541
- 37
- 345
- 415