HPlogo HP-UX Reference > P

pset_ctl(2)

HP-UX 11i Version 2: December 2007 Update
» 

Technical documentation

 » Table of Contents

 » Index

NAME

pset_ctl() — processor set control

SYNOPSIS

#include <sys/pset.h> int pset_ctl( pset_request_t request, psetid_t pset, id_t id);

DESCRIPTION

The pset_ctl() function provides a means to query the system processor set configuration and assignment information. The request argument specifies what information is needed for the pset processor set. The following request values are supported:

PSET_GETCURRENTPSET

Return the ID of the processor set binding for the calling thread. The pset and id arguments are ignored.

PSET_GETFIRSTLDOM

Return the ID of the first locality domain contributing to the processor set pset. The id argument is ignored.

PSET_GETFIRSTPSET

Return the ID of the first processor set in the system. The pset and id arguments are ignored.

PSET_GETFIRSTSPU

Return the ID of the first processor in the processor set pset. It will return -1 if the processor set is empty. Any processors in the processor set that is in transition are ignored. The id argument is ignored.

PSET_GETNEXTLDOM

Return the ID of the next locality domain after the locality domain specified in id that contributes to the processor set pset.

Typically, PSET_GETFIRSTLDOM is called to determine the first locality domain in a processor set. PSET_GETNEXTLDOM is then called in a loop (until the call returns -1) to determine the IDs of the remaining locality domain in the processor set.

PSET_GETNEXTPSET

Return the ID of the next processor set in the system after pset. The id argument is ignored.

Typically, PSET_GETFIRSTPSET is called to determine the first processor set. PSET_GETNEXTPSET is then called in a loop (until the call returns -1) to determine the IDs of the remaining processor sets in the system.

PSET_GETNEXTSPU

Return the ID of next processor in the processor set pset after the processor specified in id.

Typically, PSET_GETFIRSTSPU is called to determine the first processor in a processor set. PSET_GETNEXTSPU is then called in a loop (until the call returns -1) to determine the IDs of the remaining processors in the processor set.

PSET_GETNUMLDOMS

Return the number of locality domains that have at least one processor assigned to the processor set pset. The id argument is ignored.

PSET_GETNUMPSETS

Return the current number of processor sets in the system. It will always be greater than or equal to one. The pset and id arguments are ignored.

PSET_GETNUMSPUS

Return the number of processors assigned to the processor set pset. Any processors in the processor set that is in transition are not included. The id argument is ignored.

PSET_LDOMSPUS

Return number of processors contributed by the locality domain specified by id to the processor set pset.

PSET_SPUTOPSET

Return the ID of the processor set assigned for the processor specified in id. If the processor is not enabled or is in transition from one processor set to another, -1 is returned with an error. The pset argument is ignored.

Any user may query the system processor set topology using the pset_ctl() function.

Use sysconf() with _SC_PSET_SUPPORT name to see if the processor set functionality is supported by the underlying HP-UX operating system version.

EXAMPLES

Get total count and IDs of all processor sets in the system.

#include <sys/pset.h> /* * Get list of all processor sets in the system. */ psetid_t *all_psets; int pset_count, idx; psetid_t pset; /* Get total count of processor sets in the system */ pset_count = pset_ctl(PSET_GETNUMPSETS, 0, 0); if (pset_count < 1) { perror("pset_ctl(PSET_GETNUMPSETS)"); exit(1); } all_psets = (psetid_t *) malloc(sizeof(psetid_t)*pset_count); memset(all_psets, 0, sizeof(psetid_t)*pset_count); idx = 0; /* Get first processor set */ pset = pset_ctl(PSET_GETFIRSTPSET, 0, 0); if (pset < 0) { perror("pset_ctl(PSET_GETFIRSTPSET)"); exit(2); } all_psets[idx++] = pset; /* Get remaining processor sets */ while (idx < pset_count) { pset = pset_ctl(PSET_GETNEXTPSET, pset, 0); if (pset < 0) { perror("pset_ctl(PSET_GETNEXTPSET)"); exit(3); } else { all_psets[idx++] = pset; } }

RETURN VALUE

pset_ctl() returns a value based on request on successful completion. Otherwise, -1 is returned and errno is set to indicate the error.

ERRORS

pset_ctl() fails if one or more of the following is true:

EINVAL

The request is invalid.

EINVAL

The specified processor set pset, or the processor or the locality domain specified by id is invalid.

EINVAL

The request is PSET_GETNEXTPSET and there is no other processor set after pset, or the request is PSET_GETNEXTSPU and there is no other processor after id in pset, or the request is PSET_GETNEXTLDOM and there is no other locality domain after id in pset.

ENOSYS

The processor set functionality is not supported by the underlying HP-UX version.

AUTHOR

pset_ctl() was developed by HP.