GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  PTHREAD_GETAFFINITY_NP (3)

NAME

pthread_getaffinity_np, pthread_setaffinity_np - manage CPU affinity

CONTENTS

Library
Synopsis
Description
Return Values
Errors
See Also
Standards
History
Authors

LIBRARY


.Lb libpthread

SYNOPSIS


.In pthread_np.h int pthread_getaffinity_np pthread_t td size_t cpusetsize cpuset_t *cpusetp int pthread_setaffinity_np pthread_t td size_t cpusetsize const cpuset_t *cpusetp

DESCRIPTION

pthread_getaffinity_np and pthread_setaffinity_np allow the manipulation of sets of CPUs available to the specified thread.

Masks of type cpuset_t are composed using the CPU_SET 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 pthread_getaffinity_np even if the result set would fit within the user supplied set. Calls to pthread_setaffinity_np tolerate small sets with no restrictions.

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

pthread_getaffinity_np retrieves the mask from the thread specified by td, and stores it in the space provided by cpusetp.

pthread_setaffinity_np attempts to set the mask for the thread specified by td to the value in cpusetp.

RETURN VALUES

If successful, the pthread_getaffinity_np and pthread_setaffinity_np functions will return zero. Otherwise an error number will be returned to indicate the error.

ERRORS

The pthread_getaffinity_np and pthread_setaffinity_np functions may fail if:
[EDEADLK]
  The pthread_setaffinity_np call would leave a thread without a valid CPU to run on because the set does not overlap with the thread’s anonymous mask.
[EFAULT]
  The cpusetp pointer passed was invalid.
[ESRCH]
  The thread specified by the td argument could not be found.
[ERANGE]
  The cpusetsize was either preposterously large or smaller than the kernel set size.
[EPERM]
  The calling thread did not have the credentials required to complete the operation.

SEE ALSO

cpuset(1), cpuset(2), cpuset_getid(2), cpuset_setid(2), pthread(3), pthread_attr_getaffinity_np(3), pthread_attr_setaffinity_np(3)

STANDARDS

The pthread_getaffinity_np and pthread_setaffinity_np functions are non-standard
.Fx extensions and may be not available on other operating systems.

HISTORY

The pthread_getaffinity_np and pthread_setaffinity_np function first appeared in
.Fx 7.2 .

AUTHORS


.An -nosplit The pthread_getaffinity_np and pthread_setaffinity_np functions were written by
.An David Xu <davidxu@FreeBSD.org>, and this manpage was written by
.An Xin LI <delphij@FreeBSD.org>.
Search for    or go to Top of page |  Section 3 |  Main Index


Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.