...forgot a few folks on the "Thank you" list....
many thanks to:
Weirick, Robert
Tarasyuk, Nik
sysadmin_at_astro.su.se
Markley, Sean
Udo Grabowski
Chris Bryant
Vipin Gokhale
Best response was to use the cfg_subsys_query(3) function.
Sample program:
#include <errno.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/sysconfig.h>
#include <cfg.h>
main(int argc, char **argv)
{
cfg_handle_t *handle_ptr=NULL;
cfg_status_t retval;
cfg_attr_t attributes;
/* Initialize attribute names for the query */
strcpy (attributes.name, "env_current_temp");
/* Call the cfg_subsys_query() routine */
retval = cfg_subsys_query(handle_ptr, "envmon", &attributes, 1);
if (retval != CFG_SUCCESS) printf( "error\n" );
printf ( "System temperature = %d\n", attributes.attr.num.val );
} /* end of main() */
Original Question:
Dear Admins,
I looked in the archives and found the command to get the system temperature
interactively:
% sysconfig -q envmon env_current_temp
Does anyone know of a C callable function that I can use to get the
temperature from inside a program?
Thanks,
Jim
Received on Wed Jan 16 2002 - 13:40:53 NZDT