On Wed, Apr 18, 2018 at 7:13 AM, Joseph Myers <jos...@codesourcery.com> wrote: > On Wed, 18 Apr 2018, Samuel Thibault wrote: > >> Joseph Myers, le mar. 17 avril 2018 23:02:45 +0000, a ecrit: >> > On Wed, 18 Apr 2018, Samuel Thibault wrote: >> > >> > > The patch below would just introduce bits/types/struct___sched_param.h. >> > > and bits/types/struct_sched_param.h for all ports since it's the same. >> > >> > A bits/types/struct_sched_param.h that does "#define sched_param >> > __sched_param" is not appropriate for Linux, because it would change the >> > C++ mangling of struct sched_param. >> >> Oh. >> >> So that could be as per below? > > That seems plausible (this is not a review of this patch).
I have a concern: the types 'struct sched_param' and 'struct __sched_param' are not compatible, even if their members are identical (6.2.7p1 explicitly requires the tags to be the same for compatibility).So if you have a 'struct __sched_param' embedded in your pthread_attr_t, all of the code that copies between that field and parameters or variables named 'struct sched_param' must do so field-by-field or with 'memcpy'. The compiler won't let you do a straight-up structure assignment, but trying to get around that with pointer tricks will produce undefined behavior. zw