Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ cpu_get_max(3) — Tru64 UNIX 5.1b

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cpusetops(3)

numa_intro(3)

cpu_get_info(3)  —  Subroutines

NAME

cpu_get_info, cpu_get_num, cpu_get_max − Query CPU information for the platform (libc library)

SYNOPSIS

#include <cpuset.h>
int cpu_get_info(
        ncpu_info_t ∗info ); int cpu_get_num(
        void ); int cpu_get_max(
        void );

PARAMETERS

infoPoints to an ncpu_info_t buffer to receive the CPU information for the booted configuration. 

DESCRIPTION

The cpu_get_info() function returns the following information about the platform CPU configuration in the buffer pointed to by the info parameter:

int ncpu_version
Revision number.

int ncpu_max
Maximum number of CPUs supported by the machine architecture.

cpuset_t ncpu_present
CPU processor set that is physically plugged into the system and recognized by the system console.

cpuset_t ncpu_running
Set of online CPUs in the caller’s partition; that is, the set of CPUs on which the caller can schedule work.

cpuset_t ncpu_binding
Set of CPUs in the partition that have processes bound to them.

cpuset_t ncpu_ex_binding
Set of CPUs in the partition whose processor set is marked for exclusive use.

The CPU sets specified in the ncpu_info_t structure must have been created by the caller prior to the call.  If the caller specifies zero for a CPU set, the function silently ignores filling in data for that set. 

The information returned by the cpu_get_info() function is relative to the caller’s partition. 

The cpu_get_num() function returns the actual number of CPUs available in the caller’s partition. 

The cpu_get_max() function returns the maximum number of CPUs, including unpopulated CPU slots, that can be configured in the system. 

NOTES

A cpu_get_info() call is similar to a getsysinfo(GSI_CPU_INFO, ...) call.  The principal difference is that the  main ncpu_info_t structure fields returned by cpu_get_info() are of type cpuset_t, whereas the same information returned by getsysinfo()is of type ulong_t.  Furthermore, a getsysinfo(GSI_CPU_INFO, ...) call returns information only about the first n CPUs, where n is the number of bits in a ulong_t field, or (sizeof(ulong_t)∗8). 

For cpu_get_info(), the ncpu_version field of the info argument must be set to NCPU_INFO_VERSION prior to the call. 

RESTRICTIONS

The information returned by these functions is a snapshot of the platform/partition configuration at the time the information is sampled.  The data may be stale by the time the caller uses the information. 

RETURN VALUES

The cpu_get_info() function returns the following values:

0Success. 

−1Failure. In this case, errno is set to indicate the error. 

The cpu_get_num() and cpu_get_max() functions return values as stated in the DESCRIPTION. These functions always complete successfully. 

ERRORS

The cpu_get_info() function fails,  it sets errno to one of the following values:

[EFAULT]
The info argument or one of the cpuset_t elements, points to an invalid address. 

[EINVAL]
One or more of the cpuset_t elements of the info argument points to an invalid CPU set, possibly one that was not created by cpusetcreate(). 

[EPERM]
The version number specified in the ncpu_version field of the info argument is not recognized by the system. 

SEE ALSO

Functions: cpusetops(3), numa_intro(3)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026