GETOSRELDATE(3)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

🌸 NAME 🌸

getosreldate β€” get the value of __FreeBSD_version! This is the GETOSRELDATE(3) page from the Library Functions Manual, and bestie we are about to make it make sense πŸ’…βœ¨

πŸŽ€ LIBRARY πŸŽ€

It's in the Standard C Library (libc, -lc) β€” yes, that's the one 🫢

πŸ¦‹ SYNOPSIS πŸ¦‹

#include <unistd.h>

int
getosreldate(void);

✨ DESCRIPTION ✨

The getosreldate() function returns an integer showing the version of the currently running FreeBSD kernel. That's it, that's the whole main character move: one int, kernel-version realness, no cap πŸ’–

Definitions of the values can be found in The Porter's Handbook:

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. Happy path = the value requested. Sad path = -1 plus errno, periodt 😭

🌈 ENVIRONMENT 🌈

  • OSVERSION β€” If the environment variable OSVERSION is set, it will override the getosreldate() return value. Lowkey powerful, highkey useful πŸ‘‘

πŸ“ EXAMPLES πŸ“

An example can be found in /usr/share/examples/FreeBSD_version. Go look bestie, it's right there πŸ“βœ¨

πŸ’€ ERRORS πŸ’€

The getosreldate() function may fail and set errno for any of the errors specified for the library function sysctl(3). So if it's giving error, that's the sysctl(3) error family β€” iykyk.

πŸ”₯ SEE ALSO πŸ”₯

  • The Porter's Handbook.

🧚 HISTORY 🧚

The getosreldate() function appeared in FreeBSD 2.0. Ancient? No bestie, iconic. It's been serving kernel-version realness since FreeBSD 2.0 πŸ‘‘


Okay that's the whole GETOSRELDATE(3) page from the Library Functions Manual, and the footer tea is: Debian, June 13, 2018, GETOSRELDATE(3) β€” mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from