#include <sys/types.h> #include <sys/processor.h> #include <sys/procset.h>int processor_bind(idtype_t idtype, id_t id, processorid_t processorid, processorid_t *obind);
The LWP or set of LWP s specified by idtype and id are bound to the processor specified by processorid. Additionally, if obind is not NULL , the processorid_t variable pointed to by obind will be set to the previous binding of one of the specified LWP s, or to PBIND_NONE if the selected LWP was not bound.
If idtype is P_PID , the binding effects all LWP s of the process with process ID (PID ) id.
If idtype is P_LWPID , the binding effects the LWP of the current process with LWP ID id.
If id is P_MYID , the specified LWP or process is the current one.
If processorid is PBIND_NONE , the processor bindings of the specified LWP s are cleared.
If processorid is PBIND_QUERY , the processor bindings are not changed.
The effective user of the calling process must be super-user, or its real or effective user ID must match the real or effective user ID of the LWP s being bound. If the calling process does not have permission to change all of the specified LWP s, the bindings of the LWP s for which it does have permission will be changed even though an error is returned.
processor_bind returns 0 if successful; otherwise, -1 is returned and errno is set to reflect the error.