cpusetGetNameList - get the list of names for all defined
cpusets
SYNOPSIS
#include <cpuset.h>
cpuset_NameList_t *cpusetGetNameList(void);
DESCRIPTION
The cpusetGetNameList function is used to obtain a list of
the names for all the cpusets on the system.
The function returns a pointer to a structure of type
cpuset_NameList_t (defined in <cpuset.h>). The function
cpusetGetNameList allocates the memory for the structure
and all of its associated data. The user is responsible
for freeing the memory using the function cpuset
FreeNameList(3x). The cpuset_NameList_t structure is
defined as follows:
typedef struct {
int count;
char **list;
int *status;
} cpuset_NameList_t;
count is the number of cpuset names in the list.
list references the list of names.
status is a list of status flags that indicate the status
of the corresponding cpuset name in list. The following
flag values may be used:
CCPPUUSSEETT_QQUUEEUUEE_NNAAMMEE
Indicates that the corresponding name in list is
the name of a cpuset queue.
CCPPUUSSEETT_CCPPUU_NNAAMMEE
Indicates that the corresponding name in list is
the CPU ID for a restricted CPU.
The memory for list and status is allocated when the
cpuset_NameList_t is allocated and it is released when the
cpuset_NameList_t structure is released.
EXAMPLES
This example obtains the list of names for all cpuset
queues configured on the system. The list of cpusets or
restricted CPU IDs is then printed.
cpuset_NameList_t *names;
if ( !(names = cpusetGetNameList()) ) {
perror("cpusetGetNameList");
exit(1);
}
if (names->count == 0) {
printf("No defined CPUSETs or restricted
CPUs\n");
} else {
int i;
printf("CPUSET and restricted CPU names:\n");
for (i = 0; i < names->count; i++) {
if (names->status[i] == CPUSET_CPU_NAME) {
printf("CPU_ID[%s]\n", names->list[i]);
} else {
printf("CPUSET[%s]\n", names->list[i]);
}
}
}
cpusetFreeNameList(names);
NOTES
cpusetGetNameList is found in the library "libcpuset.so",
and will be loaded if the option --llccppuusseett is used with
cc(1) or ld(1).
RESTRICTIONS
Not all of the above capabilities are implemented. See
the RESTRICTIONS secion in manual entry cpuset(4) for
details.
SEE ALSO
cpuset(1), cpusetFreeNameList(3x), cpuset(5).
DIAGNOSTICS
If successful, cpusetGetNameList returns a pointer to a
cpuset_NameList_t structure. If cpusetGetNameList fails,
it returns NULL and errno is set to indicate the error.
The possible values for errno include those values set by
sbrk(2).
Man(1) output converted with
man2html