This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: [RFC] [PATCH] sched_getaffinity() fails with -EINVAL
- From: "Carlos O'Donell" <carlos at systemhalted dot org>
- To: Sharyathi Nagesh <sharyath at in dot ibm dot com>
- Cc: libc-help at sourceware dot org, bert dot wesarg at googlemail dot com, suzuki <suzuki at in dot ibm dot com>, "Rishikesh K. Rajak" <risrajak at in dot ibm dot com>
- Date: Wed, 17 Feb 2010 09:12:42 -0500
- Subject: Re: [RFC] [PATCH] sched_getaffinity() fails with -EINVAL
- References: <4AD5AFAA.40107@in.ibm.com> <4AD85932.3000308@in.ibm.com> <4AE93B14.8080804@in.ibm.com> <119aab440910290642x26688e4fqe7b18d5038f7adc0@mail.gmail.com> <4AEA6DE5.50501@in.ibm.com>
On Thu, Oct 29, 2009 at 11:39 PM, Sharyathi Nagesh <sharyath@in.ibm.com> wrote:
> ========================================================================
> Explanation:
> ? ? ? ?We are observing that ltp test case getcpu01.c is failing in some of
> the machines. In the test case: system call to sched_getaffinity() fails.
> Linux kernel is giving EINVAL on call to sched_getaffinity().
Sharyathi,
You should note the following things:
(a) The GLIBC implementation is correct, but difficult to use because
the static size of a cpu_set_t doesn't match the kernel value. The
call to sched_getaffinity is documented as returning EINVAL if
cpusetsize is smaller than the size of the affinity mask used by the
kernel. In this case you could use CPU_ALLOC to increase the size of
the data pointed to by a cpu_set_t and call sched_getaffinity again.
(b) It is more convenient if the default size of a cpu_set_t matches the kernel.
(c) If the user cpu_set_t is larger than the kernel cpumask_var_t, the
kernel ignores the additional user bits.
> 2009-10-30 ?Sharyathi Nagesh ?<sharyathi@in.ibm.com>
>
> ? ? ? ?* bits/sched.c (__CPU_SETSIZE): Size of the cpu_set_t data structure
> is changed to ? ? ? ?4096 bits from earlier 1024 bits to reflect changes in
> the Linux kernel.
It's "bits/sched.h" not "bit/sched.c."
Your ChangeLog lines *must* wrap at 80 characters or less.
With the above changes I think this email and patch is OK to go to libc-alpha.
Cheers,
Carlos.