util: use HAVE_FDATASYNC to determine fdatasync() use
util: use HAVE_FDATASYNC to determine fdatasync() use

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.

apoelstra/bitcoin,cdecker/bitcoin,mm-s/bitcoin,n1bor/bitcoin,EthanHeilman/bitcoin,alecalve/bitcoin,jnewbery/bitcoin,lateminer/bitcoin,mm-s/bitcoin,rnicoll/dogecoin,domob1812/bitcoin,cdecker/bitcoin,pataquets/namecoin-core,jlopp/statoshi,bitcoinknots/bitcoin,andreaskern/bitcoin,domob1812/bitcoin,sipsorcery/bitcoin,fujicoin/fujicoin,practicalswift/bitcoin,namecoin/namecoin-core,jonasschnelli/bitcoin,qtumproject/qtum,bitcoinknots/bitcoin,jnewbery/bitcoin,lateminer/bitcoin,JeremyRubin/bitcoin,Xekyo/bitcoin,kallewoof/bitcoin,MarcoFalke/bitcoin,MeshCollider/bitcoin,anditto/bitcoin,pataquets/namecoin-core,MeshCollider/bitcoin,jamesob/bitcoin,domob1812/namecore,GroestlCoin/GroestlCoin,instagibbs/bitcoin,rnicoll/dogecoin,jnewbery/bitcoin,bitcoinsSG/bitcoin,litecoin-project/litecoin,jonasschnelli/bitcoin,apoelstra/bitcoin,qtumproject/qtum,litecoin-project/litecoin,ajtowns/bitcoin,mruddy/bitcoin,fanquake/bitcoin,pstratem/bitcoin,n1bor/bitcoin,namecoin/namecoin-core,Sjors/bitcoin,fujicoin/fujicoin,ajtowns/bitcoin,qtumproject/qtum,AkioNak/bitcoin,qtumproject/qtum,mm-s/bitcoin,achow101/bitcoin,namecoin/namecore,sstone/bitcoin,bitcoinsSG/bitcoin,ajtowns/bitcoin,namecoin/namecore,jamesob/bitcoin,practicalswift/bitcoin,Xekyo/bitcoin,yenliangl/bitcoin,fujicoin/fujicoin,bitcoin/bitcoin,ElementsProject/elements,rnicoll/dogecoin,bitcoin/bitcoin,prusnak/bitcoin,ajtowns/bitcoin,MeshCollider/bitcoin,Xekyo/bitcoin,JeremyRubin/bitcoin,mruddy/bitcoin,MarcoFalke/bitcoin,sstone/bitcoin,prusnak/bitcoin,sipsorcery/bitcoin,AkioNak/bitcoin,mruddy/bitcoin,GroestlCoin/GroestlCoin,mruddy/bitcoin,jambolo/bitcoin,bitcoin/bitcoin,jlopp/statoshi,dscotese/bitcoin,n1bor/bitcoin,bitcoinknots/bitcoin,particl/particl-core,domob1812/namecore,ElementsProject/elements,sstone/bitcoin,rnicoll/bitcoin,achow101/bitcoin,domob1812/bitcoin,Sjors/bitcoin,Sjors/bitcoin,sipsorcery/bitcoin,cdecker/bitcoin,instagibbs/bitcoin,pstratem/bitcoin,particl/particl-core,anditto/bitcoin,jamesob/bitcoin,ElementsProject/elements,jlopp/statoshi,particl/particl-core,domob1812/bitcoin,pataquets/namecoin-core,tecnovert/particl-core,MarcoFalke/bitcoin,n1bor/bitcoin,JeremyRubin/bitcoin,tecnovert/particl-core,Sjors/bitcoin,jlopp/statoshi,mm-s/bitcoin,litecoin-project/litecoin,anditto/bitcoin,andreaskern/bitcoin,namecoin/namecoin-core,bitcoin/bitcoin,practicalswift/bitcoin,rnicoll/dogecoin,andreaskern/bitcoin,domob1812/bitcoin,sstone/bitcoin,ElementsProject/elements,particl/particl-core,dscotese/bitcoin,rnicoll/bitcoin,jamesob/bitcoin,jambolo/bitcoin,apoelstra/bitcoin,n1bor/bitcoin,lateminer/bitcoin,jonasschnelli/bitcoin,GroestlCoin/GroestlCoin,MeshCollider/bitcoin,prusnak/bitcoin,dscotese/bitcoin,lateminer/bitcoin,bitcoin/bitcoin,pstratem/bitcoin,dscotese/bitcoin,apoelstra/bitcoin,prusnak/bitcoin,kallewoof/bitcoin,kallewoof/bitcoin,AkioNak/bitcoin,Sjors/bitcoin,ElementsProject/elements,anditto/bitcoin,alecalve/bitcoin,cdecker/bitcoin,namecoin/namecore,GroestlCoin/bitcoin,fujicoin/fujicoin,jambolo/bitcoin,sstone/bitcoin,bitcoinsSG/bitcoin,pataquets/namecoin-core,achow101/bitcoin,Xekyo/bitcoin,pataquets/namecoin-core,yenliangl/bitcoin,Xekyo/bitcoin,jonasschnelli/bitcoin,ajtowns/bitcoin,apoelstra/bitcoin,yenliangl/bitcoin,jambolo/bitcoin,jamesob/bitcoin,rnicoll/bitcoin,domob1812/namecore,MarcoFalke/bitcoin,bitcoinknots/bitcoin,namecoin/namecoin-core,alecalve/bitcoin,domob1812/namecore,dscotese/bitcoin,qtumproject/qtum,ElementsProject/elements,namecoin/namecore,EthanHeilman/bitcoin,rnicoll/dogecoin,jnewbery/bitcoin,sipsorcery/bitcoin,fanquake/bitcoin,litecoin-project/litecoin,ajtowns/bitcoin,dscotese/bitcoin,particl/particl-core,sipsorcery/bitcoin,andreaskern/bitcoin,prusnak/bitcoin,achow101/bitcoin,tecnovert/particl-core,n1bor/bitcoin,JeremyRubin/bitcoin,andreaskern/bitcoin,cdecker/bitcoin,tecnovert/particl-core,lateminer/bitcoin,anditto/bitcoin,pstratem/bitcoin,GroestlCoin/bitcoin,instagibbs/bitcoin,mm-s/bitcoin,GroestlCoin/bitcoin,AkioNak/bitcoin,pstratem/bitcoin,domob1812/bitcoin,domob1812/namecore,yenliangl/bitcoin,andreaskern/bitcoin,sstone/bitcoin,bitcoin/bitcoin,cdecker/bitcoin,rnicoll/bitcoin,GroestlCoin/bitcoin,lateminer/bitcoin,fanquake/bitcoin,bitcoinsSG/bitcoin,pataquets/namecoin-core,EthanHeilman/bitcoin,particl/particl-core,mm-s/bitcoin,MarcoFalke/bitcoin,fujicoin/fujicoin,rnicoll/bitcoin,GroestlCoin/bitcoin,EthanHeilman/bitcoin,MeshCollider/bitcoin,practicalswift/bitcoin,MeshCollider/bitcoin,practicalswift/bitcoin,EthanHeilman/bitcoin,GroestlCoin/GroestlCoin,achow101/bitcoin,tecnovert/particl-core,instagibbs/bitcoin,JeremyRubin/bitcoin,EthanHeilman/bitcoin,domob1812/namecore,AkioNak/bitcoin,alecalve/bitcoin,MarcoFalke/bitcoin,kallewoof/bitcoin,alecalve/bitcoin,jambolo/bitcoin,instagibbs/bitcoin,kallewoof/bitcoin,sipsorcery/bitcoin,qtumproject/qtum,yenliangl/bitcoin,jlopp/statoshi,jamesob/bitcoin,GroestlCoin/bitcoin,litecoin-project/litecoin,alecalve/bitcoin,practicalswift/bitcoin,anditto/bitcoin,instagibbs/bitcoin,fujicoin/fujicoin,mruddy/bitcoin,bitcoinsSG/bitcoin,jlopp/statoshi,namecoin/namecoin-core,kallewoof/bitcoin,GroestlCoin/GroestlCoin,apoelstra/bitcoin,namecoin/namecore,fanquake/bitcoin,jnewbery/bitcoin,AkioNak/bitcoin,Xekyo/bitcoin,bitcoinknots/bitcoin,fanquake/bitcoin,jambolo/bitcoin,jonasschnelli/bitcoin,JeremyRubin/bitcoin,fanquake/bitcoin,tecnovert/particl-core,pstratem/bitcoin,rnicoll/bitcoin,prusnak/bitcoin,achow101/bitcoin,mruddy/bitcoin,yenliangl/bitcoin,bitcoinsSG/bitcoin,litecoin-project/litecoin,qtumproject/qtum,namecoin/namecoin-core,GroestlCoin/GroestlCoin,namecoin/namecore