processor_info(3)processor_info(3)NAMEprocessor_info - determine type and status of a processor
SYNOPSIS
#include <sys/type.h> #include <sys/processor.h>
int processor_info(
processorid_t processorid,
processor_info_t *infop );
LIBRARY
SVR4 Library (libsvr4)
PARAMETERS
The type for processor name or CPU number. Returns information about
the CPU. Data structure fields consist of P_ONLINE or P_OFFLINE, ASCII
CPU types, ASCII FPU types and CPU clock frequency in MHz.
DESCRIPTION
The processor_info() function obtains information about a single pro‐
cessor in the system. The information is returned in the proces‐
sor_info_t structure pointed to by infop. The structure contains the
following fields: Either P_ONLINE or P_OFFLINE. If the processor is
offline, the other fields are meaningless. A null terminated ASCII
string specifying the type of processor. A null terminated ASCII
string specifying the type of floating point hardware available. The
string contains zero or more floating point identifier strings, sepa‐
rated by commas. The frequency of the processor clock, in megahertz,
rounded to the nearest integer.
NOTES
Some of the files that are referenced by absolute path in the System V
Environment for Tru64 UNIX man pages may actually be located relative
to /usr/opt/svr4.
RETURN VALUES
Success. Failure.
ERRORS
Failure may result from: The infop pointer points to an invalid memory
address. The processorid does not refer to an existing processor.
EXAMPLES
To get the processor info of processor #0.
#include <stdio.h> #include <errno.h> #include <processor.h>
main() {
int x;
processor_info_t buffer;
x = processor_info(0, buffer);
if(x < 0)
perror("processor_info");
else {
printf("processor_info returned %d\n",x);
printf("State is %d\n", buffer.pi_state);
printf("CPU type is %s\n", buffer.pi_processor_type);
printf("FPU type is %s\n", buffer.pi_fputypes);
printf("Freq. is %d\n", buffer.pi_clock);
}
exit(0); }
SEE ALSO
Commands: pinfo(1m), psrinfo(1m)processor_info(3)