3 ms·
Dumb question: is close() the same as fsync() for getting data written?
by ape4 7y ago
Dumb question: is close() the same as fsync() for getting data written?
- nwallin 7y agoNo. (and it's only a dumb question if you don't ask) close() flushes the application buffer into the vfs buffer, but it does not guarantee the vfs buffer is flushed to the disk buffer, nor does it guarantee the disk buffer flushes to disk. A successful fsync() call guarantees these things.\* \* except if the disk drive controller lies about flushing its buffer to disk, but there's nothing you can do about that besides buying a better disk.
- zAy0LfpBZLC8mAC 7y ago> close() flushes the application buffer into the vfs buffer No, close() only closes the file descriptor. fclose() potentially also flushes a userspace buffer.