OSVERSION
If the environment variable OSVERSION is set, it will override the getosreldate() return value.
Get the value of __freebsd_version
#include <unistd.h>
int
getosreldate(void);
Standard C Library (libc, -lc)
The getosreldate() function returns an integer showing the version of the currently running FreeBSD kernel. Definitions of the values can be found in
https://www.FreeBSD.org/doc/en/books/porters-handbook/
Upon successful completion, getosreldate() returns the value requested; otherwise the value -1 is returned and the global variable errno is set to indicate the error.
OSVERSION
If the environment variable OSVERSION is set, it will override the getosreldate() return value.
An example can be found in /usr/share/examples/FreeBSD_version.
The getosreldate() function may fail and set errno for any of the errors specified for the library function sysctl(3).
59 releases since FreeBSD 4.8-RELEASE; the text changed 34 times.