This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
FYI sched_getaffinity and sched_setaffinity manual pages.
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: Michael Kerrisk <mtk dot manpages at gmail dot com>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Mon, 17 Jun 2013 11:41:26 -0400
- Subject: FYI sched_getaffinity and sched_setaffinity manual pages.
Michael,
FYI.
There is a patch floating around for the sched_getaffinity
man page which gives an example of sched_getaffinity returning
EINVAL and using that to compute the actual size of the kernel
cpu mask. It is my opinion that such a patch is the wrong approach.
The current sched_getaffinity manual page [1] has no such example,
An example that uses sysconf (_SC_PROCESSORS_ONLN) which is *way*
faster than the recommended example in the patch[2].
The glibc sched_getaffinity function never documented returning
EINVAL if the cpu set size was smaller than the kernel's, and I
would like it to stay that way. That is to say that if you boot
a kernel on a system with greater than 1024 possible cpus, that
the existing legacy code using a fixed cpu_set_t should still
function and provide access to the first 1024 cpus (instead of
returning EINVAL).
See bugzilla bug 15630[3] for more details on the problem and
the fix.
See redhat bug 974679[4] for details on a better example.
Does that make sense to you?
Cheers,
Carlos.
[1] http://man7.org/linux/man-pages/man2/sched_setaffinity.2.html
[2] http://linuxmanpages.net/manpages/fedora17/man2/sched_getaffinity.2.html
[3] http://sourceware.org/bugzilla/show_bug.cgi?id=15630
[4] https://bugzilla.redhat.com/show_bug.cgi?id=974679