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 pro­
       cesses running with a user ID or group ID  that  has  read
       access  permissions  on  the permissions file can success­
       fully 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;
                pid_t  *list;
            } cpuset_CPUList_t;

       count is the number of CPU IDs in the list.   list  refer­
       ences  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",

                    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  --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), 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
       sbrk(2).


Man(1) output converted with man2html