diff options
| author | Michael Kerrisk <mtk.manpages@gmail.com> | 2008-11-14 10:01:23 -0500 |
|---|---|---|
| committer | Michael Kerrisk <mtk.manpages@gmail.com> | 2008-11-25 20:54:00 -0500 |
| commit | f5bf1e9b13b7ddd727b11a7b29b48cae48733c0a (patch) | |
| tree | e10b786ea8318634e97967a58e48604937579ac5 | |
| parent | 23bb5732b2dd167af0aa9d6bc4dbe4f61aa777d5 (diff) | |
| download | man-pages-f5bf1e9b13b7ddd727b11a7b29b48cae48733c0a.tar.gz | |
pthread_setaffinity_np.3: Various improvements after review by Lo�c Domaigne
Various fix-ups after Lo�c's review.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Reviewed-by: Lo�c Domaigne <tech@domaigne.com>
| -rw-r--r-- | man3/pthread_setaffinity_np.3 | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/man3/pthread_setaffinity_np.3 b/man3/pthread_setaffinity_np.3 index a04b24d96e..539bf9eb5d 100644 --- a/man3/pthread_setaffinity_np.3 +++ b/man3/pthread_setaffinity_np.3 @@ -21,7 +21,7 @@ .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" -.TH PTHREAD_SETAFFINITY_NP 3 2008-11-11 "Linux" "Linux Programmer's Manual" +.TH PTHREAD_SETAFFINITY_NP 3 2008-11-14 "Linux" "Linux Programmer's Manual" .SH NAME pthread_setaffinity_np, pthread_getaffinity_np \- set/get CPU affinity of a thread @@ -55,18 +55,21 @@ function returns the CPU affinity mask of the thread in the buffer pointed to by .IR cpuset . +For more details on CPU affinity masks, see +.BR sched_setaffinity (2). +For a description of a set of macros +that can be used to manipulate and inspect CPU sets, see +.BR CPU_SET (3). + The argument .I cpusetsize is the length (in bytes) of the buffer pointed to by .IR cpuset . Typically, this argument would be specified as .IR sizeof(cpu_set_t) . - -For more details on CPU affinity masks, see -.BR sched_setaffinity (2). -For a description of a set of macros -that can be used to manipulate and inspect CPU sets, see -.BR CPU_SET (3). +(It may be some other value, if using the macros described in +.BR CPU_SET (3) +for dynamically allocating a CPU set.) .SH RETURN VALUE On success, these functions return 0; on error, they return a non-zero error number. @@ -79,19 +82,19 @@ A supplied memory address was invalid. .RB ( pthread_setaffinity_np ()) The affinity bit mask .I mask -contains no processors that are physically on the system. +contains no processors that are currently physically on the system. .TP .BR EINVAL .RB ( pthread_setaffinity_np ()) .I cpuset -specified a CPU that was outside the range -permitted by the kernel data type +specified a CPU that was outside the set supported by the kernel. +(The kernel configuration option +.BR CONFIG_NR_CPUS +defines the range of the set supported by the kernel data type .\" cpumask_t -used to represent CPU sets. +used to represent CPU sets.) .\" The raw sched_getaffinity() system call returns the size (in bytes) .\" of the cpumask_t type. -This range is determined by the kernel configuration option -.BR CONFIG_NR_CPUS . .TP .B EINVAL .RB ( pthread_getaffinity_np ()) @@ -108,6 +111,19 @@ These functions are provided by glibc since version 2.3.4. These functions are non-standard GNU extensions; hence the suffix "_np" (non-portable) in the names. .SH NOTES +After a call to +.BR pthread_setaffinity_np (3), +the set of CPUs on which the thread will actually run is +the intersection of the set specified in the +.I cpuset +argument and the set of CPUs actually present on the system. +The system may further restrict the set of CPUs on which the thread +runs if the "cpuset" mechanism described in +.BR cpuset (7) +is being used. +These restrictions on the actual set of CPUs on which the thread +will run are silently imposed by the kernel. + These functions are implemented on top of the .BR sched_setaffinity (2) and |
