cpusetGetPIDList(3x) cpusetGetPIDList(3x) NAME cpusetGetPIDList - get a list of all PIDs attached to a cpuset SYNOPSIS #include <cpuset.h> cpuset_PIDList_t *cpusetGetPIDList(char *qname); DESCRIPTION The cpusetGetPIDList function is used to obtain a list of the PIDs for all processes currently attached to the specified cpuset. Only processes with a user ID or group ID that has read permissions on the permissions file can successfully execute this function. The qname argument is the name of the cpuset to which the current process should be attached. The function returns a pointer to a structure of type cpuset_PIDList_t (defined in <cpuset.h>). The function cpusetGetPIDList allocates the memory for the structure and the user is responsible for freeing the memory using the function cpusetFreePIDList(3x). The cpuset_PIDList_t structure looks similar to this: typedef struct { int count; pid_t *list; } cpuset_PIDList_t; count is the number of PID values in the list. list references an array that holds the list of PID values. The memory for list is allocated when the cpuset_PIDList_t is allocated and it is released when the cpuset_PIDList_t structure is released. EXAMPLES This example obtains the list of PIDs attached to the cpuset mpi_set and prints out the PID values. char *qname = "mpi_set"; cpuset_PIDList_t *pids; /* Get the list of PIDs else print error & exit */ if ( !(pids = cpusetGetPIDList(qname)) ) { perror("cpusetGetPIDList"); exit(1); } if (pids->count == 0) { printf("CPUSET[%s] has 0 processes attached\n", qname); } else { int i; printf("CPUSET[%s] attached PIDs:\n", qname); for (i = 0; i < pids->count; i++) printf("PID[%d]0, pids->list[i]); } cpusetFreePIDList(pids); NOTES cpusetGetPIDList 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), cpusetFreePIDList(3x), cpuset(5). DIAGNOSTICS If successful, cpusetGetPIDList returns a pointer to a cpuset_PIDList_t structure. If cpusetGetPIDList fails, it returns NULL and errno is set to indicate the error. The possible values for errno are the same as the values set by sysmp(2) and sbrk(2). Page 2