I was wondering how could I get/set a sysctl value from a C program. For example I want to get the value of 'sysctl kern.osrelease' or something else.. For setting env variables I could use setenv() or getenv(), but can I get the value of a sysctl string from a C program and how?

Thanks!

EDIT:
I've found it, I must have missed the sysctl() prototype in sys/sysctl.h. After reading the sysctl(3) man page gave me the needed results