cpusetGetName(3x) cpusetGetName(3x) NAME cpusetGetName - get the name of the cpuset to which a process is attached SYNOPSIS #include <cpuset.h> cpuset_NameList_t *cpusetGetName(pid_t pid); DESCRIPTION The cpusetGetName function is used to obtain the name of the cpuset to which the specified process has been attached. The pid argument specifies the process ID. The function returns a pointer to a structure of type cpuset_NameList_t (defined in <cpuset.h>). The function cpusetGetName allocates the memory for the structure and all of its associated data. The user is responsible for freeing the memory using the function cpusetFreeNameList(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. In the case of cpusetGetName this member will should only contain the values of 0 and 1. 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: CPUSET_QUEUE_NAME Indicates that the corresponding name in list is the name of a cpuset queue. CPUSET_CPU_NAME 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 cpuset name or CPU ID to which the current process is attached: cpuset_NameList_t *name; /* Get the name else print error & exit */ if ( !(name = cpusetGetName(0)) ) { perror("cpusetGetName"); exit(1); } if (name->count == 0) { printf("Current process not attached\n"); } else { if (name->status[0] == CPUSET_CPU_NAME) { printf("Current process attached to" " CPU_ID[%s]\n", name->list[0]); } else { printf("Current process attached to" " CPUSET[%s]\n", name->list[0]); } } cpusetFreeNameList(name); NOTES cpusetGetName 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), cpusetFreeNameList(3x), cpusetGetNameList(3x), cpuset(5). DIAGNOSTICS If successful, cpusetGetName returns a pointer to a cpuset_NameList_t structure. If cpusetGetName 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), sbrk(2), and the following: EINVAL Invalid value for pid was supplied. ERANGE Number of CPUs configured on the system is not a value greater than or equal to 1. Page 2