processor_bind(2) — SYSTEM CALLS
NAME
processor_bind − bind a process to a processor
SYNOPSIS
#include <sys/types.h>
#include <sys/procset.h>
#include <sys/processor.h> int processor_bind(idtype_t idtype, id_t pid,
processorid_t processorid, processorid_t ∗obind);
DESCRIPTION
processor_bind binds a process to a specific processor. idtype must be set to P_PID and pid is a process ID specifying the process to be bound. When the process identified by pid has been bound, it will execute only on the processor specified by processorid (even if other processors are available), except briefly, if the process requires a resource which only another processor can provide. The processor may continue to run other processes in addition to the one specified by pid. The processor_bind call will fail if the process specified by pid is bound exclusively to another processor or if there are already processes exclusively bound to the processor specified by processorid.
The processor_bind call is not guaranteed to be synchronous with the binding operation. If the binding operation cannot be completed immediately the call may return before the operation completes. Any delay between the return of the function and the completion of the operation will, typically, be of very short duration.
If processorid is PBIND_NONE, the specified process is unbound; that is, it is made free to run on any processor.
If the process specified by pid is already bound to a different processor, the binding for that process will be changed to the processor specified by processorid. If obind is not NULL and the process is currently bound to a processor, that processorid is returned by obind.
The bind state of a process is inherited by any children created by a fork(2) call, and does not change across a call to exec(2).
In order to bind or unbind a process, the real or effective user ID of the caller must match the real or saved [from exec(2)] user ID of the process being bound or unbound, or the caller must have superuser privileges.
DIAGNOSTICS
Returns a value of zero on success, or a negative value on failure. Failure may result from:
EPERM The calling process does not have appropriate privileges.
EINVAL An invalid idtype or processorid was specified, or the specified processor is currently offline.
ESRCH No process can be found with a process ID corresponding to pid.
EBUSY The process specified by pid is bound exclusively to another processor or there are already processes exclusively bound to the processor specified by processorid.
EFAULTobind is non-NULL and points to an invalid address.
EIOThe specified processor is not operational.
SEE ALSO
— Multiprocessing