util: use HAVE_FDATASYNC to determine fdatasync() use
Summary:
Rather than just using it on Linux and NetBSD, use fdatasync() based
on whether it's available. i.e it is available in newer versions
of FreeBSD (11.1 and later).This also aligns our code more closely with what is being done in leveldb.
Was pointed out by Luke in #19430.
This is a backport of core#19614
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, majcosta
Reviewed By: #bitcoin_abc, majcosta
Differential Revision: https://reviews.bitcoinabc.org/D10060