p If .Fa psid is set to .Dv PS_QUERY , then the current processor set ID will be returned into .Fa psid , and no assignment will be performed.
p If .Fa psid is set to .Dv PS_MYID , then the processor set ID of the calling process will be used, and .Fa psid will be ignored.
p If .Fa psid is set to .Dv PS_NONE , any assignment to the processor will be cleared. t Fn pset_bind psid type id opsid Binds the target specified by .Fa id to the processor set specified by .Fa psid . The current processor set ID to which the target is bound or .Dv PS_NONE will be returned in .Fa opsid , if the pointer is not .Dv NULL . .Nx supports the following types of targets specified by .Fa type : l -tag -width P_PID t Dv P_PID Process identified by the PID. t Dv P_LWPID Thread of the calling process indentified by the LID. .El
p If .Fa psid is set to .Dv PS_QUERY , then the current processor set ID to which the target is bound or .Dv PS_NONE will be returned in .Fa opsid , and no binding will be performed. If .Fa psid is set to .Dv PS_MYID , then the processor set ID of the calling process will be used.
p If .Fa psid is set to .Dv PS_NONE , the specified target will be unbound from the processor set. t Fn pset_destroy psid Destroys the processor set specified by .Fa psid . Before destroying the processor set, all related assignments of the processors will be cleared, and all bound threads will be unbound.
p If .Fa psid is .Dv PS_MYID , the processor set ID of the caller thread will be used. .El .Sh NOTES The .Fa pset_bind function can return the current processor set ID to which the target is bound, or .Dv PS_NONE . However, for example, the process may have many threads, which could be bound to different processor sets. In such a case it is unspecified which thread will be used to return the information.
p If processor sets are used together with the thread affinity, see .Xr affinity 3 , then affinity mask takes precedence over the assignment to processor set. However, it is not recomended to combine these interfaces together. .Sh RETURN VALUES Upon successful completion these functions return 0. Otherwise, -1 is returned and .Va errno is set to indicate the error. .Sh EXAMPLES An example of code fragment, which assigns the CPU whose ID is 0, for current process: d -literal psetid_t psid; cpuid_t ci = 0; if (pset_create(\*[Am]psid) \*[Lt] 0) err(EXIT_FAILURE, "pset_create"); /* Assign CPU 0 to the processor-set */ if (pset_assign(psid, ci, NULL) \*[Lt] 0) err(EXIT_FAILURE, "pset_assign"); /* Bind the current process to the processor-set */ if (pset_bind(psid, P_PID, P_MYID, NULL) \*[Lt] 0) err(EXIT_FAILURE, "pset_bind"); /* * At this point, CPU 0 runs only the current process. */ perform_work(); if (pset_destroy(psid) \*[Lt] 0) err(EXIT_FAILURE, "pset_destroy"); .Ed .Sh ERRORS The .Fn pset_create function fails if: l -tag -width Er t Bq Er ENOMEM No memory is available for creation of the processor set, or limit of the allowed count of the processor sets was reached. t Bq Er EPERM The calling process is not the super-user. .El
p The .Fn pset_assign function fails if: l -tag -width Er t Bq Er EBUSY Another operation is performing on the processor set. t Bq Er EINVAL .Fa psid or .Fa cpuid are invalid. t Bq Er EPERM The calling process is not the super-user, and .Fa psid is not .Dv PS_QUERY . .El
p The .Fn pset_bind function fails if: l -tag -width Er t Bq Er EBUSY Another operation is performing on the processor set. t Bq Er EINVAL .Fa psid or .Fa type are invalid. t Bq Er EPERM The calling process is not the super-user, and .Fa psid is not .Dv PS_QUERY . t Bq Er ESRCH The specified target was not found. .El
p The .Fn pset_destroy function fails if: l -tag -width Er t Bq Er EBUSY Another operation is performing on the processor set. t Bq Er EPERM The calling process is not the super-user. .El .Sh SEE ALSO .Xr affinity 3 , .Xr cpuset 3 , .Xr sched 3 , .Xr schedctl 8 .Sh STANDARDS This API is expected to be compatible with the APIs found in Solaris and HP-UX operating systems. .Sh HISTORY The processor sets appeared in .Nx 5.0 .