Reapply r326600 (by imp):
Since this is contrib code, create an upstreamable version of my
change. Now on FreeBSD and NetBSD if _STANDALONE is defined, we
include the kernel version with alloances for the quirky differences
between the two.
Sponsored by: Netflix
(cherry picked from commit dd6565b7a60d228f021190a538caeb652275dc5c)