3 ms·
From SQLite's unix.c: /* ** We do not trust systems to provide a working fdatasync(). Some do. ** Others do no. To be safe, we will stick with th
by rhencke 6y ago
From SQLite's unix.c:
/*
** We do not trust systems to provide a working fdatasync(). Some do.
** Others do no. To be safe, we will stick with the (slightly slower)
** fsync(). If you know that your system does support fdatasync() correctly,
** then simply compile with -Dfdatasync=fdatasync or -DHAVE_FDATASYNC
*/
#if !defined(fdatasync) && !HAVE_FDATASYNC
# define fdatasync fsync
#endif
- jlokier 6y agoFrom SQLite's autoconf/configure.ac: AC_CHECK_FUNCS([fdatasync usleep fullfsync localtime_r gmtime_r]) In other words, it automatically uses fdatasync if that's available on any target OS. SQLite's os_unix.c actually confirms my suspicions about fdatasync: /* fdatasync() on HFS+ doesn't yet flush the file size if it changed correctly Given its portability, and the folklore around fdatasync not flushing the file size on other OSes at some time (and the current FreeBSD man page), I'm still surprised the code as written assumes the size issue only exists on OSX.