cpusetGetCPUList(3x)                                      cpusetGetCPUList(3x)


NAME
     cpusetGetCPUList - get the list of all CPUs assigned to a cpuset

SYNOPSIS
     #include <cpuset.h>

     cpuset_CPUList_t *cpusetGetCPUList(char *qname);

DESCRIPTION
     The cpusetGetCPUList function is used to obtain the list of the CPUs
     assigned to the specified cpuset.  Only processes running with a user ID
     or group ID that has read access permissions on the permissions file can
     successfully execute this function.  The qname argument is the name of
     the specified cpuset.

     The function returns a pointer to a structure of type cpuset_CPUList_t
     (defined in <cpuset.h>).  The function cpusetGetCPUList allocates the
     memory for the structure and the user is responsible for freeing the
     memory using the function cpusetFreeCPUList(3x).  The cpuset_CPUList_t
     structure looks similar to this:

               typedef struct {
                   int     count;
                   cpuid_t *list;
               } cpuset_CPUList_t;


     count is the number of CPU IDs in the list.  list references the memory
     array that holds the list of CPU IDs.  The memory for list is allocated
     when the cpuset_CPUList_t is allocated and it is released when the
     cpuset_CPUList_t structure is released.

EXAMPLES
     This example obtains the list of CPUs asigned to the cpuset mpi_set and
     prints out the CPU ID values.

               char             *qname = "mpi_set";
               cpuset_CPUList_t *cpus;

               /* Get the list of CPUs else print error & exit */
               if ( !(cpus = cpusetGetCPUList(qname)) ) {
                   perror("cpusetGetCPUList");
                   exit(1);
               }
               if (cpus->count == 0) {
                   printf("CPUSET[%s] has 0 assigned CPUs\n",
                           qname);
               } else {
                   int i;

                   printf("CPUSET[%s] assigned CPUs:\n",
                           qname);


                       for (i = 0; i < cpus->count; i++)
                           printf("CPU_ID[%d]\n", cpus->list[i]);
               }
               cpusetFreeCPUList(cpus);


NOTES
     cpusetGetCPUList is found in the library "libcpuset.so", and will be
     loaded if the option -lcpuset is used with cc(1) or ld(1).

SEE ALSO
     cpuset(1), cpusetFreeCPUList(3x), cpuset(5).

DIAGNOSTICS
     If successful, cpusetGetCPUList returns a pointer to a cpuset_CPUList_t
     structure.  If cpusetGetCPUList fails, it returns NULL and errno is set
     to indicate the error.  The possible values for errno include those
     values as set by sysmp(2) and sbrk(2).


                                                                        Page 2