lkml.org 
[lkml]   [2020]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH RFC] sched/headers: Fix sched_setattr userspace compilation issues
On Thu, May 21, 2020 at 11:55:21AM -0400, Joel Fernandes wrote:
> On Thu, May 21, 2020 at 11:53 AM Joel Fernandes (Google)
> <joel@joelfernandes.org> wrote:
> >
> > On a modern Linux distro, compiling the following program fails:
> > #include<stdlib.h>
> > #include<stdint.h>
> > #include<pthread.h>
> > #include<linux/sched/types.h>
> >
> > void main() {
> > struct sched_attr sa;
> >
> > return;
> > }
> >
> > with:
> > /usr/include/linux/sched/types.h:8:8: \
> > error: redefinition of ‘struct sched_param’
> > 8 | struct sched_param {
> > | ^~~~~~~~~~~
> > In file included from /usr/include/x86_64-linux-gnu/bits/sched.h:74,
> > from /usr/include/sched.h:43,
> > from /usr/include/pthread.h:23,
> > from /tmp/s.c:4:
> > /usr/include/x86_64-linux-gnu/bits/types/struct_sched_param.h:23:8:
> > note: originally defined here
> > 23 | struct sched_param
> > | ^~~~~~~~~~~
> >
> > This is also causing a problem on using sched_attr Chrome. The issue is
> > sched_param is already provided by glibc.
> >
> > Guard the kernel's UAPI definition of sched_param with __KERNEL__ so
> > that userspace can compile.
> >
> > Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
>
> If it is more preferable, another option is to move sched_param to
> include/linux/sched/types.h

Might it be worth Ccing libc-alpha here? Seems like one of those classic
header conflicts.

Christian

\
 
 \ /
  Last update: 2020-05-22 15:15    [W:0.315 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site