* using fsync() instead of fdatasync() for Darwin and FreeBSD compatibility