FreeBSD 12 has a getrandom syscall; see D471 for discussion
Revisions and Commits
Confirmed my theory of getentropy(3): https://reviews.freebsd.org/rS331279
Since our usage of getrandom is with flag 0, which is same as getentropy, I think that it's good to add HAVE_GETENTROPY feature macro to support getentropy for *BSD (both of FreeBSD and OpenBSD in mind).
My point is: Let us support OpenBSD too.
In my patch, for OpenBSD and FreeBSD (well, other than GNU/Linux), it uses getentropy if available. For GNU/Linux, we use the local macro of getentropy (regardless of the availability of the function), keeping exactly same behavior of syscall with __NR_getrandom.