DESCRIPTION
sched_setaffinity sets the CPU affinity mask of the process denoted by pid. If pid is zero, then the current process is used. The affinity mask is represented by the bitmask stored in mask. The least significant bit corresponds to the first logical processor number on the system, while the most significant bit corresponds to the last logical processor number on the system. A set bit corresponds to a legally schedulable CPU while an unset bit corresponds to an illegally schedulable CPU. In other words, a process is bound to and will only run on processors whose corresponding bit is set. Usually, all bits in the mask are set.
The argument len is the length of the data pointed to by mask. Normally this is the size of a word on the system. For compatibility with future versions of the Linux kernel, since this size can change, the bitmask supplied must be at least as large as the affinity mask stored in the kernel.
The function sched_getaffinity writes into the pointer supplied by mask that is size len the affinity mask of process pid. If pid is zero, then the mask of the current process is returned.
"RETURN VALUE"
On success, sched_setaffinity and sched_getaffinity both return 0. On error, -1 is returned, and errno is set appropriately.
ERRORS