THe isc_stdio_sync() would call fsync() and have an extra check that
sync is called only over regular files. Remove the extra check and use
fdatasync() instead of fsync() to lighten the load.
isc_result_t
isc_stdio_sync(FILE *f);
/*%<
- * Invoke fsync() on the file descriptor underlying an stdio stream, or an
+ * Invoke fdatasync() on the file descriptor underlying an stdio stream, or an
* equivalent system-dependent operation. Note that this function has no
* direct counterpart in the stdio library.
*/
}
}
-/*
- * OpenBSD has deprecated ENOTSUP in favor of EOPNOTSUPP.
- */
-#if defined(EOPNOTSUPP) && !defined(ENOTSUP)
-#define ENOTSUP EOPNOTSUPP
-#endif /* if defined(EOPNOTSUPP) && !defined(ENOTSUP) */
-
isc_result_t
isc_stdio_sync(FILE *f) {
- struct stat buf;
- int r;
-
- if (fstat(fileno(f), &buf) != 0) {
- return isc__errno2result(errno);
- }
-
- /*
- * Only call fsync() on regular files.
- */
- if ((buf.st_mode & S_IFMT) != S_IFREG) {
- return ISC_R_SUCCESS;
- }
-
- r = fsync(fileno(f));
+ int r = fdatasync(fileno(f));
if (r == 0) {
return ISC_R_SUCCESS;
} else {