libthr: Fix pthread_[g|s]etaffinity_np manual.
Since f35093f8
semantics of a thread affinity functions is changed to be a
compatible with Linux:
In case of getaffinity(), the minimum cpuset_t size that the kernel permits is
the maximum CPU id, present in the system, / NBBY bytes, the maximum size is not
limited.
In case of setaffinity(), the kernel does not limit the size of the user-provided
cpuset_t, internally using only the meaningful part of the set, where the upper
bound is the maximum CPU id, present in the system, no larger than the size of
the kernel cpuset_t.
Reviewed by: jhb, kib
Differential Revision: https://reviews.freebsd.org/D38111
MFC after: 1 week
This commit is contained in:
parent
01f74ccd5a
commit
62801712df
@ -24,7 +24,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd October 12, 2021
|
.Dd January 29, 2023
|
||||||
.Dt PTHREAD_AFFINITY_NP 3
|
.Dt PTHREAD_AFFINITY_NP 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -50,14 +50,19 @@ Masks of type
|
|||||||
are composed using the
|
are composed using the
|
||||||
.Dv CPU_SET
|
.Dv CPU_SET
|
||||||
macros.
|
macros.
|
||||||
The kernel tolerates large sets as long as all CPUs specified
|
If the user-supplied mask is not large enough to fit all of the matching CPUs,
|
||||||
in the set exist.
|
|
||||||
Sets smaller than the kernel uses generate an error on calls to
|
|
||||||
.Fn pthread_getaffinity_np
|
.Fn pthread_getaffinity_np
|
||||||
even if the result set would fit within the user supplied set.
|
fails with
|
||||||
|
.Er ERANGE .
|
||||||
Calls to
|
Calls to
|
||||||
.Fn pthread_setaffinity_np
|
.Fn pthread_setaffinity_np
|
||||||
tolerate small sets with no restrictions.
|
tolerate masks of any size with no restrictions.
|
||||||
|
The kernel uses the meaningful part of the mask, where the upper bound is
|
||||||
|
the maximum CPU id present in the system.
|
||||||
|
If bits for non-existing CPUs are set, calls to
|
||||||
|
.Fn pthread_setaffinity_np
|
||||||
|
fails with
|
||||||
|
.Er EINVAL .
|
||||||
.Pp
|
.Pp
|
||||||
The supplied mask should have a size of
|
The supplied mask should have a size of
|
||||||
.Fa cpusetsize
|
.Fa cpusetsize
|
||||||
@ -96,6 +101,12 @@ and
|
|||||||
.Fn pthread_setaffinity_np
|
.Fn pthread_setaffinity_np
|
||||||
functions may fail if:
|
functions may fail if:
|
||||||
.Bl -tag -width Er
|
.Bl -tag -width Er
|
||||||
|
.It Bq Er EINVAL
|
||||||
|
The
|
||||||
|
.Fa cpusetp
|
||||||
|
argument specified when calling
|
||||||
|
.Fn pthread_setaffinity_np
|
||||||
|
was not a valid value.
|
||||||
.It Bq Er EDEADLK
|
.It Bq Er EDEADLK
|
||||||
The
|
The
|
||||||
.Fn pthread_setaffinity_np
|
.Fn pthread_setaffinity_np
|
||||||
@ -112,7 +123,7 @@ argument could not be found.
|
|||||||
.It Bq Er ERANGE
|
.It Bq Er ERANGE
|
||||||
The
|
The
|
||||||
.Fa cpusetsize
|
.Fa cpusetsize
|
||||||
was either preposterously large or smaller than the kernel set size.
|
was smaller than needed to fit all of the matching CPUs.
|
||||||
.It Bq Er EPERM
|
.It Bq Er EPERM
|
||||||
The calling thread did not have the credentials required to complete the
|
The calling thread did not have the credentials required to complete the
|
||||||
operation.
|
operation.
|
||||||
|
Loading…
Reference in New Issue
Block a user