View Single Post
  #1   (View Single Post)  
Old 29th September 2008
DNAeon DNAeon is offline
Shell Scout
 
Join Date: Sep 2008
Location: Bulgaria
Posts: 138
Default Get sysctl value from a C program

Hi!

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

Last edited by DNAeon; 29th September 2008 at 10:45 AM.
Reply With Quote