---
name: "getosreldate"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/getosreldate"
---

# getosreldate(3)

get the value of \_\_FreeBSD\_version

## NAME

**getosreldate** – get the value of \_\_FreeBSD\_version

## LIBRARY

Standard C Library (libc, -lc)

## SYNOPSIS

**#include \<unistd.h\>**

*int*\

**getosreldate**(*void*);

## DESCRIPTION

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/**

## RETURN VALUES

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.

## ENVIRONMENT

- OSVERSION

  If the environment variable OSVERSION is set, it will override the **getosreldate**() return value.

## EXAMPLES

An example can be found in */usr/share/examples/FreeBSD\_version*.

## ERRORS

The **getosreldate**() function may fail and set *errno* for any of the errors specified for the library function [sysctl(3)](/sysctl/3.md).

## SEE ALSO

*The Porter's Handbook*.

## HISTORY

The **getosreldate**() function appeared in FreeBSD 2.0.
