TMP_AFFINITY(2)

NAME
tmp_affinity - bind a process to a processor

SYNOPSIS
#include <sys/tmp_ctl.h>

prev = tmp_affinity(processor);
int prev, processor;

DESCRIPTION
Tmp_affinity allows a process to be bound to a specified logical processor. Processor numbers start at zero and are numbered contiguously. Deconfigured processors are not included. The previous affinity is returned.

If the processor argument is AFF_NONE, the process is released from any previous affinity (that is, allowed to migrate). If the processor argument is AFF_QUERY, the current affinity, or AFF_NONE is returned, without changing the current affinity.

Only the superuser is allowed to change affinity.

Affinity is inherited across the fork(2) and exec(2) system calls.

RETURN VALUE
The call returns -1 on error (as well as setting errno). If it succeeds it returns the previous affinity processor number (or AFF_NONE, which is currently defined as -2).

ERRORS
The tmp_affinity will fail if:

[EPERM]
    Process does not have superuser capability.

[ENXIO]
    processor is out of range.

[ENODEV]
    processor is either offline or bad.

SEE ALSO
tmp_ctl(2), online(8).