pset_ctl(2) pset_ctl(2)
NAME [Toc] [Back]
pset_ctl - processor set control
SYNOPSIS [Toc] [Back]
#include <sys/pset.h>
int pset_ctl(
pset_request_t request,
psetid_t pset,
id_t id);
DESCRIPTION [Toc] [Back]
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 [Toc] [Back]
Return the ID of the processor set binding for the calling
thread. The pset and id arguments are ignored.
PSET_GETFIRSTLDOM [Toc] [Back]
Return the ID of the first locality domain contributing to
the processor set pset. The id argument is ignored.
PSET_GETFIRSTPSET [Toc] [Back]
Return the ID of the first processor set in the system. The
pset and id arguments are ignored.
PSET_GETFIRSTSPU [Toc] [Back]
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 [Toc] [Back]
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 [Toc] [Back]
Return the ID of the next processor set in the system after
pset. The id argument is ignored.
Hewlett-Packard Company - 1 - HP-UX 11i Version 2: August 2003
pset_ctl(2) pset_ctl(2)
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 [Toc] [Back]
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 [Toc] [Back]
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 [Toc] [Back]
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 [Toc] [Back]
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 [Toc] [Back]
Return number of processors contributed by the locality
domain specified by id to the processor set pset.
PSET_SPUTOPSET [Toc] [Back]
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.
EXAMPLE [Toc] [Back]
Get total count and IDs of all processor sets in the system.
#include <sys/pset.h>
Hewlett-Packard Company - 2 - HP-UX 11i Version 2: August 2003
pset_ctl(2) pset_ctl(2)
/*
* 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 [Toc] [Back]
pset_ctl returns a value based on request on successful completion.
Otherwise, -1 is returned and errno is set to indicate the error.
ERRORS [Toc] [Back]
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
Hewlett-Packard Company - 3 - HP-UX 11i Version 2: August 2003
pset_ctl(2) pset_ctl(2)
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 [Toc] [Back]
pset_ctl was developed by HP.
SEE ALSO [Toc] [Back]
psrset(1M), pset_assign(2), pset_bind(2), pset_create(2),
pset_destroy(2), pset_getattr(2), pset_setattr(2), sysconf(2).
Hewlett-Packard Company - 4 - HP-UX 11i Version 2: August 2003 [ Back ] |