write() guarantees that the bits have been sent to the disk, and the disk reports that they have been written (or, if a nonvolatile cache is available, it is in the cache).
At least for Linux, I think that's dangerously untrue. On my machine, 'man write' even includes an explicit warning:
A successful return from write() does not make any
guarantee that data has been committed to disk.
In fact, on some buggy implementations, it does not
even guarantee that space has successfully been reserved
for the data. The only way to be sure is to call
fsync(2) after you are done writing all your data.
There are ways to configure a file system so this is not the case, but they are rare. Is there a reference you could point to that would clarify what you are saying?
At least for Linux, I think that's dangerously untrue. On my machine, 'man write' even includes an explicit warning:
There are ways to configure a file system so this is not the case, but they are rare. Is there a reference you could point to that would clarify what you are saying?