cpuset_setaffinity.2freebsd

Langue: en

Autres versions - même langue

Version: 315784 (ubuntu - 07/07/09)

Section: 2 (Appels système)


BSD mandoc

NAME

cpuset_getaffinity cpuset_setaffinity - manage CPU affinity

LIBRARY

Lb libc

SYNOPSIS

In sys/param.h In sys/cpuset.h Ft int Fn cpuset_getaffinity cpulevel_t level cpuwhich_t which id_t id size_t setsize cpuset_t *mask Ft int Fn cpuset_setaffinity cpulevel_t level cpuwhich_t which id_t id size_t setsize const cpuset_t *mask

DESCRIPTION

Fn cpuset_getaffinity and Fn cpuset_setaffinity allow the manipulation of sets of CPUs available to processes, threads, interrupts and other resources. These functions may manipulate sets of CPUs that contain many processes or per-object anonymous masks that effect only a single object.

The valid values for the Fa level and Fa which arguments are documented in cpuset(2). These arguments specify which object and which set of the object we are referring to. Not all possible combinations are valid. For example, only processes may belong to a numbered set accessed by a Fa level argument of CPU_LEVEL_CPUSET All resources, however, have a mask which may be manipulated with CPU_LEVEL_WHICH

Masks of type Ft cpuset_t are composed using the CPU_SET2 macros. The kernel tolerates large sets as long as all CPUs specified in the set exist. Sets smaller than the kernel uses generate an error on calls to Fn cpuset_getaffinity even if the result set would fit within the user supplied set. Calls to Fn cpuset_setaffinity tolerate small sets with no restrictions.

The supplied mask should have a size of Fa setsize bytes. This size is usually provided by calling sizeof(mask) which is ultimately determined by the value of CPU_SETSIZE as defined in In sys/cpuset.h .

Fn cpuset_getaffinity retrieves the mask from the object specified by Fa level , Fa which and Fa id and stores it in the space provided by Fa mask .

Fn cpuset_setaffinity attempts to set the mask for the object specified by Fa level , Fa which and Fa id to the value in Fa mask .

RETURN VALUES

Rv -std

ERRORS

The following error codes may be set in errno
Bq Er EINVAL
The Fa level or Fa which argument was not a valid value.
Bq Er EDEADLK
The Fn cpuset_setaffinity call would leave a thread without a valid CPU to run on because the set does not overlap with the thread's anonymous mask.
Bq Er EFAULT
The mask pointer passed was invalid.
Bq Er ESRCH
The object specified by the Fa id and Fa which arguments could not be found.
Bq Er ERANGE
The Fa cpusetsize was either preposterously large or smaller than the kernel set size.
Bq Er EPERM
The calling process did not have the credentials required to complete the operation.

SEE ALSO

cpuset(1), cpuset(2), cpuset_getid2, cpuset_setid2, CPU_SET3

HISTORY

The family of system calls first appeared in Fx 8.0 .

AUTHOR

An Jeffrey Roberson Aq jeff@FreeBSD.org