This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2 1/5] Clean pthread types namespace for all archs.


PIng.

2015-08-26 0:07 GMT+09:00 Juan Manuel Torres Palma <j.m.torrespalma@gmail.com>:
> This patch sorts out pthread_mutex_t and pthread_cond_t in
> new files, so new C11 types could be based on pthread types
> without corrupting namespaces and exposing pthread symbols.
>
> Common pthread types like pthread_mutex_t and pthread_cond_t are now
> defined in bits/pthreadtypes-common.h, while the internal
> implementation is moved to bits/thread-shared-types.h. File
> pthreadtypes.h has just been cleaned up of those definitions and
> some related macros and structures.
>
> 2015-08-25  Juan Manuel Torres Palma  <jmtorrespalma@gmail.com>
>
>         * posix/Makefile (headers): Add files bits/pthreadtypes-common.h
>         and bits/thread-shared-types.h to this variable.
>         * bits/pthreadtypes-common.h: New file.
>         (pthread_mutex_t): Move struct definition.
>         (pthread_cond_t): Likewise.
>         * bits/thread-shared-types.h: New file.
>         * sysdeps/x86/bits/thread-shared-types.h: New file.
>         (__SIZEOF_PTHREAD_MUTEX_T): Definition.
>         (__SIZEOF_PTHREAD_COND_T): Likewise.
>         (__pthread_list_t) [__x86_64__]: Likewise.
>         (__pthread_slist_t) [!__x86_64__]: Likewise.
>         (__pthread_mutex_s): Likewise.
>         (__PTHREAD_MUTEX_T_CONTENT): Likewise.
>         (__PTHREAD_COND_T_CONTENT): Likewise.
>         (__PTHREAD_MUTEX_HAVE_PREV)[__x86_64__]: Likewise
>         (__elision)[!__x86_64__]: Likewise
>         (__spins)[!__x86_64__]: Likewise
>         (__PTHREAD_SPINS): Likewise
>         * sysdeps/aarch64/nptl/bits/thread-shared-types.h: Likewise.
>         * sysdeps/arm/nptl/bits/thread-shared-types.h: Likewise.
>         * sysdeps/hppa/nptl/bits/thread-shared-types.h: Likewise.
>         * sysdeps/ia64/nptl/bits/thread-shared-types.h: Likewise.
>         * sysdeps/m68k/nptl/bits/thread-shared-types.h: Likewise.
>         * sysdeps/microblaze/nptl/bits/thread-shared-types.h: Likewise.
>         * sysdeps/mips/nptl/bits/thread-shared-types.h: Likewise.
>         * sysdeps/nios2/nptl/bits/thread-shared-types.h: Likewise.
>         * sysdeps/s390/nptl/bits/thread-shared-types.h: Likewise.
>         * sysdeps/sh/nptl/bits/thread-shared-types.h: Likewise.
>         * sysdeps/sparc/nptl/bits/thread-shared-types.h: Likewise.
>         * sysdeps/tile/nptl/bits/thread-shared-types.h: Likewise.
>         * sysdeps/unix/sysv/linux/alpha/bits/thread-shared-types.h: Likewise.
>         * sysdeps/unix/sysv/linux/powerpc/bits/thread-shared-types.h: Likewise.
>         * sysdeps/x86/bits/pthreadtypes.h: Include
>         <bits/pthreadtypes-common.h>.
>         (__SIZEOF_PTHREAD_MUTEX_T): Remove.
>         (__SIZEOF_PTHREAD_COND_T): Likewise.
>         (__pthread_list_t): Likewise.
>         (__pthread_slist_t): Likewise.
>         (__pthread_mutex_s): Likewise.
>         (__PTHREAD_MUTEX_T_CONTENT): Likewise.
>         (__PTHREAD_COND_T_CONTENT): Likewise.
>         (__PTHREAD_MUTEX_HAVE_PREV): Likewise
>         (__elision): Likewise
>         (__spins): Likewise
>         (__PTHREAD_SPINS): Likewise
>         * sysdeps/aarch64/nptl/bits/pthreadtypes.h: Likewise.
>         * sysdeps/arm/nptl/bits/pthreadtypes.h: Likewise.
>         * sysdeps/hppa/nptl/bits/pthreadtypes.h: Likewise.
>         * sysdeps/ia64/nptl/bits/pthreadtypes.h: Likewise.
>         * sysdeps/m68k/nptl/bits/pthreadtypes.h: Likewise.
>         * sysdeps/microblaze/nptl/bits/pthreadtypes.h: Likewise.
>         * sysdeps/mips/nptl/bits/pthreadtypes.h: Likewise.
>         * sysdeps/nios2/nptl/bits/pthreadtypes.h: Likewise.
>         * sysdeps/s390/nptl/bits/pthreadtypes.h: Likewise.
>         * sysdeps/sh/nptl/bits/pthreadtypes.h: Likewise.
>         * sysdeps/sparc/nptl/bits/pthreadtypes.h: Likewise.
>         * sysdeps/tile/nptl/bits/pthreadtypes.h: Likewise.
>         * sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h: Likewise.
>         * sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h: Likewise.
>
> diff --git a/bits/pthreadtypes-common.h b/bits/pthreadtypes-common.h
> new file mode 100644
> index 0000000..7276f84
> --- /dev/null
> +++ b/bits/pthreadtypes-common.h
> @@ -0,0 +1,43 @@
> +/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +
> +/* Declaration of common pthread types for all architectures.
> +   Macros *_CONTENT are architecture dependent and defined in
> +   bits/thread-shared-types.h */
> +
> +#ifndef _BITS_PTHREADTYPES_COMMON_H
> +# define _BITS_PTHREADTYPES_COMMON_H   1
> +
> +# include <bits/thread-shared-types.h>
> +
> +/* Common definition of pthread_mutex_t. */
> +
> +typedef union
> +{
> +  __PTHREAD_MUTEX_T_CONTENT
> +} pthread_mutex_t;
> +
> +
> +/* Common definition of pthread_cond_t. */
> +
> +typedef union
> +{
> +  __PTHREAD_COND_T_CONTENT
> +} pthread_cond_t;
> +
> +#endif /* bits/pthreadtypes-common.h */
> diff --git a/bits/thread-shared-types.h b/bits/thread-shared-types.h
> new file mode 100644
> index 0000000..4e1895d
> --- /dev/null
> +++ b/bits/thread-shared-types.h
> @@ -0,0 +1,19 @@
> +/* No thread support.  */
> +/* This file is required to have a shared types definition
> +   between POSIX threads and C11 threads. It allows to
> +   header files like pthread.h and thread.h to define their types
> +   with the same size and fields without corrupting namespaces.
> +
> +   The interface is as follows:
> +
> +   - bits/thread-shared-types.h. Defines structures for mutex and condvar,
> +     shared by threads.h and pthread.h. The macros defined are
> +     __PTHREAD_MUTEX_T_CONTENT and __PTHREAD_COND_T_CONTENT
> +
> +   - bits/pthreadtypes-common.h. Works as a generic file that defines
> +     common pthread types like pthread_mutex_t and pthread_cond_t
> +     based on the macros included from thread-shared-types.h.
> +
> +   - bits/pthreadtypes.h. Include pthreadtypes-common.h to have access
> +     to pthread types and expose them for the other types and functions
> +     that require it. */
> diff --git a/posix/Makefile b/posix/Makefile
> index 15e8818..d7cfd99 100644
> --- a/posix/Makefile
> +++ b/posix/Makefile
> @@ -29,7 +29,8 @@ headers       := sys/utsname.h sys/times.h sys/wait.h sys/types.h unistd.h          \
>            bits/local_lim.h tar.h bits/utsname.h bits/confname.h              \
>            bits/waitflags.h bits/waitstatus.h sys/unistd.h sched.h            \
>            bits/sched.h re_comp.h wait.h bits/environments.h cpio.h           \
> -          sys/sysmacros.h spawn.h bits/unistd.h
> +          sys/sysmacros.h spawn.h bits/unistd.h                              \
> +          bits/thread-shared-types.h bits/pthreadtypes-common.h
>
>  routines :=                                                                  \
>         uname                                                                 \
> diff --git a/sysdeps/aarch64/nptl/bits/pthreadtypes.h b/sysdeps/aarch64/nptl/bits/pthreadtypes.h
> index 0e4795e..b047e81 100644
> --- a/sysdeps/aarch64/nptl/bits/pthreadtypes.h
> +++ b/sysdeps/aarch64/nptl/bits/pthreadtypes.h
> @@ -20,11 +20,10 @@
>  #define _BITS_PTHREADTYPES_H   1
>
>  #include <endian.h>
> +#include <pthreadtypes-common.h>
>
>  #define __SIZEOF_PTHREAD_ATTR_T        64
> -#define __SIZEOF_PTHREAD_MUTEX_T       48
>  #define __SIZEOF_PTHREAD_MUTEXATTR_T    8
> -#define __SIZEOF_PTHREAD_COND_T        48
>  #define __SIZEOF_PTHREAD_COND_COMPAT_T 48
>  #define __SIZEOF_PTHREAD_CONDATTR_T     8
>  #define __SIZEOF_PTHREAD_RWLOCK_T      56
> @@ -48,34 +47,9 @@ typedef union pthread_attr_t pthread_attr_t;
>  # define __have_pthread_attr_t1
>  #endif
>
> -typedef struct __pthread_internal_list
> -{
> -  struct __pthread_internal_list *__prev;
> -  struct __pthread_internal_list *__next;
> -} __pthread_list_t;
> -
>
>  /* Data structures for mutex handling.  The structure of the attribute
>     type is not exposed on purpose.  */
> -typedef union
> -{
> -  struct __pthread_mutex_s
> -  {
> -    int __lock;
> -    unsigned int __count;
> -    int __owner;
> -    unsigned int __nusers;
> -    int __kind;
> -    int __spins;
> -    __pthread_list_t __list;
> -#define __PTHREAD_MUTEX_HAVE_PREV      1
> -  } __data;
> -  char __size[__SIZEOF_PTHREAD_MUTEX_T];
> -  long int __align;
> -} pthread_mutex_t;
> -
> -/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> -#define __PTHREAD_SPINS 0
>
>  typedef union
>  {
> @@ -86,22 +60,6 @@ typedef union
>
>  /* Data structure for conditional variable handling.  The structure of
>     the attribute type is not exposed on purpose.  */
> -typedef union
> -{
> -  struct
> -  {
> -    int __lock;
> -    unsigned int __futex;
> -    __extension__ unsigned long long int __total_seq;
> -    __extension__ unsigned long long int __wakeup_seq;
> -    __extension__ unsigned long long int __woken_seq;
> -    void *__mutex;
> -    unsigned int __nwaiters;
> -    unsigned int __broadcast_seq;
> -  } __data;
> -  char __size[__SIZEOF_PTHREAD_COND_T];
> -  long int __align;
> -} pthread_cond_t;
>
>  typedef union
>  {
> diff --git a/sysdeps/aarch64/nptl/bits/thread-shared-types.h b/sysdeps/aarch64/nptl/bits/thread-shared-types.h
> new file mode 100644
> index 0000000..6fb6847
> --- /dev/null
> +++ b/sysdeps/aarch64/nptl/bits/thread-shared-types.h
> @@ -0,0 +1,78 @@
> +/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +/* This header contains macros definition required for
> +   the declaration of pthread_mutex_t and pthread_cond_t,
> +   both needed by C11 types mtx_t and cnd_t. */
> +
> +#ifndef _BITS_PTHREAD_SHARED_TYPES_H
> +#define _BITS_PTHREAD_SHARED_TYPES_H   1
> +
> +#define __SIZEOF_PTHREAD_MUTEX_T       48
> +#define __SIZEOF_PTHREAD_COND_T        48
> +
> +typedef struct __pthread_internal_list
> +{
> +  struct __pthread_internal_list *__prev;
> +  struct __pthread_internal_list *__next;
> +} __pthread_list_t;
> +
> +#define __PTHREAD_MUTEX_HAVE_PREV      1
> +/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> +#define __PTHREAD_SPINS 0
> +
> +/* Data structure for mutex handling. */
> +
> +struct __pthread_mutex_s
> +{
> +  int __lock;
> +  unsigned int __count;
> +  int __owner;
> +  unsigned int __nusers;
> +  /* KIND must stay at this position in the structure to maintain
> +     binary compatibility.  */
> +  int __kind;
> +  short __spins;
> +  __pthread_list_t __list;
> +};
> +
> +
> +#define __PTHREAD_MUTEX_T_CONTENT            \
> +  struct __pthread_mutex_s __data;           \
> +  char __size[__SIZEOF_PTHREAD_MUTEX_T];      \
> +  long int __align;
> +
> +
> +/* Data structure for conditional variable handling */
> +
> +#define __PTHREAD_COND_T_CONTENT                          \
> +  struct                                                  \
> +  {                                                       \
> +    int __lock;                                           \
> +    unsigned int __futex;                                 \
> +    __extension__ unsigned long long int __total_seq;     \
> +    __extension__ unsigned long long int __wakeup_seq;    \
> +    __extension__ unsigned long long int __woken_seq;     \
> +    void *__mutex;                                        \
> +    unsigned int __nwaiters;                              \
> +    unsigned int __broadcast_seq;                         \
> +  } __data;                                               \
> +  char __size[__SIZEOF_PTHREAD_COND_T];                   \
> +  __extension__ long long int __align;
> +
> +
> +#endif /* bits/pthread-shared-types.h */
> diff --git a/sysdeps/arm/nptl/bits/pthreadtypes.h b/sysdeps/arm/nptl/bits/pthreadtypes.h
> index 9f2efc2..d844e5a 100644
> --- a/sysdeps/arm/nptl/bits/pthreadtypes.h
> +++ b/sysdeps/arm/nptl/bits/pthreadtypes.h
> @@ -19,11 +19,10 @@
>  #define _BITS_PTHREADTYPES_H   1
>
>  #include <endian.h>
> +#include <bits/pthreadtypes-common.h>
>
>  #define __SIZEOF_PTHREAD_ATTR_T 36
> -#define __SIZEOF_PTHREAD_MUTEX_T 24
>  #define __SIZEOF_PTHREAD_MUTEXATTR_T 4
> -#define __SIZEOF_PTHREAD_COND_T 48
>  #define __SIZEOF_PTHREAD_COND_COMPAT_T 12
>  #define __SIZEOF_PTHREAD_CONDATTR_T 4
>  #define __SIZEOF_PTHREAD_RWLOCK_T 32
> @@ -48,37 +47,8 @@ typedef union pthread_attr_t pthread_attr_t;
>  #endif
>
>
> -typedef struct __pthread_internal_slist
> -{
> -  struct __pthread_internal_slist *__next;
> -} __pthread_slist_t;
> -
> -
>  /* Data structures for mutex handling.  The structure of the attribute
>     type is not exposed on purpose.  */
> -typedef union
> -{
> -  struct __pthread_mutex_s
> -  {
> -    int __lock;
> -    unsigned int __count;
> -    int __owner;
> -    /* KIND must stay at this position in the structure to maintain
> -       binary compatibility.  */
> -    int __kind;
> -    unsigned int __nusers;
> -    __extension__ union
> -    {
> -      int __spins;
> -      __pthread_slist_t __list;
> -    };
> -  } __data;
> -  char __size[__SIZEOF_PTHREAD_MUTEX_T];
> -  long int __align;
> -} pthread_mutex_t;
> -
> -/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> -#define __PTHREAD_SPINS 0
>
>  typedef union
>  {
> @@ -89,22 +59,6 @@ typedef union
>
>  /* Data structure for conditional variable handling.  The structure of
>     the attribute type is not exposed on purpose.  */
> -typedef union
> -{
> -  struct
> -  {
> -    int __lock;
> -    unsigned int __futex;
> -    __extension__ unsigned long long int __total_seq;
> -    __extension__ unsigned long long int __wakeup_seq;
> -    __extension__ unsigned long long int __woken_seq;
> -    void *__mutex;
> -    unsigned int __nwaiters;
> -    unsigned int __broadcast_seq;
> -  } __data;
> -  char __size[__SIZEOF_PTHREAD_COND_T];
> -  __extension__ long long int __align;
> -} pthread_cond_t;
>
>  typedef union
>  {
> diff --git a/sysdeps/arm/nptl/bits/thread-shared-types.h b/sysdeps/arm/nptl/bits/thread-shared-types.h
> new file mode 100644
> index 0000000..e3e6b09
> --- /dev/null
> +++ b/sysdeps/arm/nptl/bits/thread-shared-types.h
> @@ -0,0 +1,80 @@
> +/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +/* This header contains macros definition required for
> +   the declaration of pthread_mutex_t and pthread_cond_t,
> +   both needed by C11 types mtx_t and cnd_t. */
> +
> +#ifndef _BITS_THREAD_SHARED_TYPES_H
> +#define _BITS_THREAD_SHARED_TYPES_H    1
> +
> +#define __SIZEOF_PTHREAD_MUTEX_T 24
> +#define __SIZEOF_PTHREAD_COND_T 48
> +
> +typedef struct __pthread_internal_slist
> +{
> +  struct __pthread_internal_slist *__next;
> +} __pthread_slist_t;
> +
> +/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> +#define __PTHREAD_SPINS 0
> +
> +/* Data structure for mutex handling. */
> +
> +struct __pthread_mutex_s
> +{
> +  int __lock;
> +  unsigned int __count;
> +  int __owner;
> +  /* KIND must stay at this position in the structure to maintain
> +     binary compatibility.  */
> +  int __kind;
> +  unsigned int __nusers;
> +  __extension__ union
> +  {
> +    int __spins;
> +    __pthread_slist_t __list;
> +  };
> +};
> +
> +
> +#define __PTHREAD_MUTEX_T_CONTENT         \
> +  struct __pthread_mutex_s __data;        \
> +  char __size[__SIZEOF_PTHREAD_MUTEX_T];  \
> +  long int __align;
> +
> +
> +
> +/* Data structure for conditional variable handling */
> +
> +#define __PTHREAD_COND_T_CONTENT                          \
> +  struct                                                  \
> +  {                                                       \
> +    int __lock;                                           \
> +    unsigned int __futex;                                 \
> +    __extension__ unsigned long long int __total_seq;     \
> +    __extension__ unsigned long long int __wakeup_seq;    \
> +    __extension__ unsigned long long int __woken_seq;     \
> +    void *__mutex;                                        \
> +    unsigned int __nwaiters;                              \
> +    unsigned int __broadcast_seq;                         \
> +  } __data;                                               \
> +  char __size[__SIZEOF_PTHREAD_COND_T];                   \
> +  __extension__ long long int __align;
> +
> +
> +#endif /* bits/thread-shared-types.h */
> diff --git a/sysdeps/hppa/nptl/bits/pthreadtypes.h b/sysdeps/hppa/nptl/bits/pthreadtypes.h
> index a361ecf..c749071 100644
> --- a/sysdeps/hppa/nptl/bits/pthreadtypes.h
> +++ b/sysdeps/hppa/nptl/bits/pthreadtypes.h
> @@ -18,6 +18,8 @@
>  #ifndef _BITS_PTHREADTYPES_H
>  #define _BITS_PTHREADTYPES_H   1
>
> +#include <bits/pthreadtypes-common.h>
> +
>  /* Linuxthread type sizes (bytes):
>     sizeof(pthread_attr_t) = 0x24 (36)
>     sizeof(pthread_barrier_t) = 0x30 (48)
> @@ -33,9 +35,7 @@
>  #define __SIZEOF_PTHREAD_ATTR_T 36
>  #define __SIZEOF_PTHREAD_BARRIER_T 48
>  #define __SIZEOF_PTHREAD_BARRIERATTR_T 4
> -#define __SIZEOF_PTHREAD_COND_T 48
>  #define __SIZEOF_PTHREAD_CONDATTR_T 4
> -#define __SIZEOF_PTHREAD_MUTEX_T 48
>  #define __SIZEOF_PTHREAD_MUTEXATTR_T 4
>  #define __SIZEOF_PTHREAD_RWLOCK_T 64
>  #define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
> @@ -54,49 +54,6 @@ typedef union pthread_attr_t pthread_attr_t;
>  # define __have_pthread_attr_t 1
>  #endif
>
> -
> -typedef struct __pthread_internal_slist
> -{
> -  struct __pthread_internal_slist *__next;
> -} __pthread_slist_t;
> -
> -
> -/* Data structures for mutex handling.  The structure of the attribute
> -   type is not exposed on purpose.  */
> -typedef union
> -{
> -  struct __pthread_mutex_s
> -  {
> -    int __lock __attribute__ ((__aligned__(16)));
> -    unsigned int __count;
> -    int __owner;
> -    /* KIND must stay at this position in the structure to maintain
> -       binary compatibility.  */
> -    int __kind;
> -    /* The old 4-word 16-byte aligned lock. This is initalized
> -       to all ones by the Linuxthreads PTHREAD_MUTEX_INITIALIZER.
> -       Unused in NPTL.  */
> -    int __compat_padding[4];
> -    /* In the old structure there are 4 words left due to alignment.
> -       In NPTL two words are used.  */
> -    unsigned int __nusers;
> -    __extension__ union
> -    {
> -      int __spins;
> -      __pthread_slist_t __list;
> -    };
> -    /* Two more words are left before the NPTL
> -       pthread_mutex_t is larger than Linuxthreads.  */
> -    int __reserved1;
> -    int __reserved2;
> -  } __data;
> -  char __size[__SIZEOF_PTHREAD_MUTEX_T];
> -  long int __align;
> -} pthread_mutex_t;
> -
> -/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> -#define __PTHREAD_SPINS 0
> -
>  typedef union
>  {
>    char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
> @@ -111,35 +68,6 @@ typedef union
>     version we must check, in every function using pthread_cond_t,
>     for the static Linuxthreads initializer and clear the appropriate
>     words. */
> -typedef union
> -{
> -  struct
> -  {
> -    /* In the old Linuxthreads pthread_cond_t, this is the
> -       start of the 4-word lock structure, the next four words
> -       are set all to 1 by the Linuxthreads
> -       PTHREAD_COND_INITIALIZER.  */
> -    int __lock __attribute__ ((__aligned__(16)));
> -    /* Tracks the initialization of this structure:
> -       0  initialized with NPTL PTHREAD_COND_INITIALIZER.
> -       1  initialized with Linuxthreads PTHREAD_COND_INITIALIZER.
> -       2  initialization in progress.  */
> -    int __initializer;
> -    unsigned int __futex;
> -    void *__mutex;
> -    /* In the old Linuxthreads this would have been the start
> -       of the pthread_fastlock status word.  */
> -    __extension__ unsigned long long int __total_seq;
> -    __extension__ unsigned long long int __wakeup_seq;
> -    __extension__ unsigned long long int __woken_seq;
> -    unsigned int __nwaiters;
> -    unsigned int __broadcast_seq;
> -    /* The NPTL pthread_cond_t is exactly the same size as
> -       the Linuxthreads version, there are no words to spare.  */
> -  } __data;
> -  char __size[__SIZEOF_PTHREAD_COND_T];
> -  __extension__ long long int __align;
> -} pthread_cond_t;
>
>  typedef union
>  {
> diff --git a/sysdeps/hppa/nptl/bits/thread-shared-types.h b/sysdeps/hppa/nptl/bits/thread-shared-types.h
> new file mode 100644
> index 0000000..7df26ae
> --- /dev/null
> +++ b/sysdeps/hppa/nptl/bits/thread-shared-types.h
> @@ -0,0 +1,100 @@
> +/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +/* This header contains macros definition required for
> +   the declaration of pthread_mutex_t and pthread_cond_t,
> +   both needed by C11 types mtx_t and cnd_t. */
> +
> +#ifndef _BITS_THREAD_SHARED_TYPES_H
> +#define _BITS_THREAD_SHARED_TYPES_H    1
> +
> +#define __SIZEOF_PTHREAD_MUTEX_T 48
> +#define __SIZEOF_PTHREAD_COND_T 48
> +
> +typedef struct __pthread_internal_slist
> +{
> +  struct __pthread_internal_slist *__next;
> +} __pthread_slist_t;
> +
> +/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> +#define __PTHREAD_SPINS 0
> +
> +/* Data structure for mutex handling. */
> +
> +struct __pthread_mutex_s
> +{
> +  int __lock __attribute__ ((__aligned__(16)));
> +  unsigned int __count;
> +  int __owner;
> +  /* KIND must stay at this position in the structure to maintain
> +     binary compatibility.  */
> +  int __kind;
> +  /* The old 4-word 16-byte aligned lock. This is initalized
> +     to all ones by the Linuxthreads PTHREAD_MUTEX_INITIALIZER.
> +     Unused in NPTL.  */
> +  int __compat_padding[4];
> +  /* In the old structure there are 4 words left due to alignment.
> +     In NPTL two words are used.  */
> +  unsigned int __nusers;
> +  __extension__ union
> +  {
> +    int __spins;
> +    __pthread_slist_t __list;
> +  };
> +  /* Two more words are left before the NPTL
> +     pthread_mutex_t is larger than Linuxthreads.  */
> +  int __reserved1;
> +  int __reserved2;
> +};
> +
> +#define __PTHREAD_MUTEX_T_CONTENT         \
> +  struct __pthread_mutex_s __data;        \
> +  char __size[__SIZEOF_PTHREAD_MUTEX_T];  \
> +  long int __align;
> +
> +
> +/* Data structure for conditional variable handling */
> +
> +#define __PTHREAD_COND_T_CONTENT          \
> +  struct                                  \
> +  {                                       \
> +    /* In the old Linuxthreads pthread_cond_t, this is the
> +       start of the 4-word lock structure, the next four words
> +       are set all to 1 by the Linuxthreads
> +       PTHREAD_COND_INITIALIZER.  */      \
> +    int __lock __attribute__ ((__aligned__(16)));  \
> +    /* Tracks the initialization of this structure:
> +       0  initialized with NPTL PTHREAD_COND_INITIALIZER.
> +       1  initialized with Linuxthreads PTHREAD_COND_INITIALIZER.
> +       2  initialization in progress.  */ \
> +    int __initializer;                    \
> +    unsigned int __futex;                 \
> +    void *__mutex;                        \
> +    /* In the old Linuxthreads this would have been the start
> +       of the pthread_fastlock status word.  */ \
> +    __extension__ unsigned long long int __total_seq; \
> +    __extension__ unsigned long long int __wakeup_seq; \
> +    __extension__ unsigned long long int __woken_seq; \
> +    unsigned int __nwaiters;              \
> +    unsigned int __broadcast_seq;         \
> +    /* The NPTL pthread_cond_t is exactly the same size as
> +       the Linuxthreads version, there are no words to spare.  */ \
> +  } __data;                               \
> +  char __size[__SIZEOF_PTHREAD_COND_T];   \
> +  __extension__ long long int __align;
> +
> +#endif /* bits/thread-shared-types.h */
> diff --git a/sysdeps/ia64/nptl/bits/pthreadtypes.h b/sysdeps/ia64/nptl/bits/pthreadtypes.h
> index e9762f5..de30d08 100644
> --- a/sysdeps/ia64/nptl/bits/pthreadtypes.h
> +++ b/sysdeps/ia64/nptl/bits/pthreadtypes.h
> @@ -19,10 +19,10 @@
>  #ifndef _BITS_PTHREADTYPES_H
>  #define _BITS_PTHREADTYPES_H   1
>
> +#include <bits/pthreadtypes-common.h>
> +
>  #define __SIZEOF_PTHREAD_ATTR_T 56
> -#define __SIZEOF_PTHREAD_MUTEX_T 40
>  #define __SIZEOF_PTHREAD_MUTEXATTR_T 4
> -#define __SIZEOF_PTHREAD_COND_T 48
>  #define __SIZEOF_PTHREAD_CONDATTR_T 4
>  #define __SIZEOF_PTHREAD_RWLOCK_T 56
>  #define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
> @@ -46,36 +46,8 @@ typedef union pthread_attr_t pthread_attr_t;
>  #endif
>
>
> -typedef struct __pthread_internal_list
> -{
> -  struct __pthread_internal_list *__prev;
> -  struct __pthread_internal_list *__next;
> -} __pthread_list_t;
> -
> -
>  /* Data structures for mutex handling.  The structure of the attribute
>     type is not exposed on purpose.  */
> -typedef union
> -{
> -  struct __pthread_mutex_s
> -  {
> -    int __lock;
> -    unsigned int __count;
> -    int __owner;
> -    unsigned int __nusers;
> -    /* KIND must stay at this position in the structure to maintain
> -       binary compatibility.  */
> -    int __kind;
> -    int __spins;
> -    __pthread_list_t __list;
> -#define __PTHREAD_MUTEX_HAVE_PREV      1
> -  } __data;
> -  char __size[__SIZEOF_PTHREAD_MUTEX_T];
> -  long int __align;
> -} pthread_mutex_t;
> -
> -/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> -#define __PTHREAD_SPINS 0
>
>  typedef union
>  {
> @@ -86,22 +58,6 @@ typedef union
>
>  /* Data structure for conditional variable handling.  The structure of
>     the attribute type is not exposed on purpose.  */
> -typedef union
> -{
> -  struct
> -  {
> -    int __lock;
> -    unsigned int __futex;
> -    __extension__ unsigned long long int __total_seq;
> -    __extension__ unsigned long long int __wakeup_seq;
> -    __extension__ unsigned long long int __woken_seq;
> -    void *__mutex;
> -    unsigned int __nwaiters;
> -    unsigned int __broadcast_seq;
> -  } __data;
> -  char __size[__SIZEOF_PTHREAD_COND_T];
> -  long int __align;
> -} pthread_cond_t;
>
>  typedef union
>  {
> diff --git a/sysdeps/ia64/nptl/bits/thread-shared-types.h b/sysdeps/ia64/nptl/bits/thread-shared-types.h
> new file mode 100644
> index 0000000..db235ed
> --- /dev/null
> +++ b/sysdeps/ia64/nptl/bits/thread-shared-types.h
> @@ -0,0 +1,75 @@
> +/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +/* This header contains macros definition required for
> +   the declaration of pthread_mutex_t and pthread_cond_t,
> +   both needed by C11 types mtx_t and cnd_t. */
> +
> +#ifndef _BITS_THREAD_SHARED_TYPES_H
> +#define _BITS_THREAD_SHARED_TYPES_H    1
> +
> +#define __SIZEOF_PTHREAD_MUTEX_T 40
> +#define __SIZEOF_PTHREAD_COND_T 48
> +
> +typedef struct __pthread_internal_list
> +{
> +  struct __pthread_internal_list *__prev;
> +  struct __pthread_internal_list *__next;
> +} __pthread_list_t;
> +
> +/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> +#define __PTHREAD_SPINS 0
> +
> +/* Data structure for mutex handling. */
> +
> +struct __pthread_mutex_s
> +{
> +  int __lock;
> +  unsigned int __count;
> +  int __owner;
> +  unsigned int __nusers;
> +  /* KIND must stay at this position in the structure to maintain
> +     binary compatibility.  */
> +  int __kind;
> +  int __spins;
> +  __pthread_list_t __list;
> +#define __PTHREAD_MUTEX_HAVE_PREV      1
> +};
> +
> +#define __PTHREAD_MUTEX_T_CONTENT             \
> +  struct __pthread_mutex_s __data;            \
> +  char __size[__SIZEOF_PTHREAD_MUTEX_T];      \
> +  long int __align;
> +
> +
> +/* Data structure for conditional variable handling */
> +
> +#define __PTHREAD_COND_T_CONTENT                          \
> +  struct                                                  \
> +  {                                                       \
> +    int __lock;                                           \
> +    unsigned int __futex;                                 \
> +    __extension__ unsigned long long int __total_seq;     \
> +    __extension__ unsigned long long int __wakeup_seq;    \
> +    __extension__ unsigned long long int __woken_seq;     \
> +    void *__mutex;                                        \
> +    unsigned int __nwaiters;                              \
> +    unsigned int __broadcast_seq;                         \
> +  } __data;                                               \
> +
> +
> +#endif /* bits/thread-shared-types.h */
> diff --git a/sysdeps/m68k/nptl/bits/pthreadtypes.h b/sysdeps/m68k/nptl/bits/pthreadtypes.h
> index 0e2bcdd..1f9689d 100644
> --- a/sysdeps/m68k/nptl/bits/pthreadtypes.h
> +++ b/sysdeps/m68k/nptl/bits/pthreadtypes.h
> @@ -20,11 +20,10 @@
>  #define _BITS_PTHREADTYPES_H   1
>
>  #include <endian.h>
> +#include <bits/pthreadtypes-common.h>
>
>  #define __SIZEOF_PTHREAD_ATTR_T 36
> -#define __SIZEOF_PTHREAD_MUTEX_T 24
>  #define __SIZEOF_PTHREAD_MUTEXATTR_T 4
> -#define __SIZEOF_PTHREAD_COND_T 48
>  #define __SIZEOF_PTHREAD_CONDATTR_T 4
>  #define __SIZEOF_PTHREAD_RWLOCK_T 32
>  #define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
> @@ -48,37 +47,8 @@ typedef union pthread_attr_t pthread_attr_t;
>  #endif
>
>
> -typedef struct __pthread_internal_slist
> -{
> -  struct __pthread_internal_slist *__next;
> -} __pthread_slist_t;
> -
> -
>  /* Data structures for mutex handling.  The structure of the attribute
>     type is deliberately not exposed.  */
> -typedef union
> -{
> -  struct __pthread_mutex_s
> -  {
> -    int __lock __attribute__ ((__aligned__ (4)));
> -    unsigned int __count;
> -    int __owner;
> -    /* KIND must stay at this position in the structure to maintain
> -       binary compatibility.  */
> -    int __kind;
> -    unsigned int __nusers;
> -    __extension__ union
> -    {
> -      int __spins;
> -      __pthread_slist_t __list;
> -    };
> -  } __data;
> -  char __size[__SIZEOF_PTHREAD_MUTEX_T];
> -  long int __align;
> -} pthread_mutex_t;
> -
> -/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> -#define __PTHREAD_SPINS 0
>
>  typedef union
>  {
> @@ -89,22 +59,6 @@ typedef union
>
>  /* Data structure for conditional variable handling.  The structure of
>     the attribute type is deliberately not exposed.  */
> -typedef union
> -{
> -  struct
> -  {
> -    int __lock __attribute__ ((__aligned__ (4)));
> -    unsigned int __futex;
> -    __extension__ unsigned long long int __total_seq;
> -    __extension__ unsigned long long int __wakeup_seq;
> -    __extension__ unsigned long long int __woken_seq;
> -    void *__mutex;
> -    unsigned int __nwaiters;
> -    unsigned int __broadcast_seq;
> -  } __data;
> -  char __size[__SIZEOF_PTHREAD_COND_T];
> -  __extension__ long long int __align;
> -} pthread_cond_t;
>
>  typedef union
>  {
> diff --git a/sysdeps/m68k/nptl/bits/thread-shared-types.h b/sysdeps/m68k/nptl/bits/thread-shared-types.h
> new file mode 100644
> index 0000000..7c90a76
> --- /dev/null
> +++ b/sysdeps/m68k/nptl/bits/thread-shared-types.h
> @@ -0,0 +1,82 @@
> +/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +/* This header contains macros definition required for
> +   the declaration of pthread_mutex_t and pthread_cond_t,
> +   both needed by C11 types mtx_t and cnd_t. */
> +
> +#ifndef _BITS_THREAD_SHARED_TYPES_H
> +#define _BITS_THREAD_SHARED_TYPES_H    1
> +
> +#define __SIZEOF_PTHREAD_MUTEX_T 24
> +#define __SIZEOF_PTHREAD_COND_T 48
> +
> +
> +typedef struct __pthread_internal_slist
> +{
> +  struct __pthread_internal_slist *__next;
> +} __pthread_slist_t;
> +
> +/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> +#define __PTHREAD_SPINS 0
> +
> +/* Data structure for mutex handling. */
> +
> +struct __pthread_mutex_s
> +{
> +  int __lock __attribute__ ((__aligned__ (4)));
> +  unsigned int __count;
> +  int __owner;
> +  /* KIND must stay at this position in the structure to maintain
> +     binary compatibility.  */
> +  int __kind;
> +  unsigned int __nusers;
> +  __extension__ union
> +  {
> +    int __spins;
> +    __pthread_slist_t __list;
> +  };
> +};
> +
> +
> +#define __PTHREAD_MUTEX_T_CONTENT         \
> +  struct __pthread_mutex_s __data;        \
> +  char __size[__SIZEOF_PTHREAD_MUTEX_T];  \
> +  long int __align;
> +
> +
> +
> +/* Data structure for conditional variable handling */
> +
> +#define __PTHREAD_COND_T_CONTENT                          \
> +  struct                                                  \
> +  {                                                       \
> +    int __lock __attribute__ ((__aligned__ (4)));         \
> +    unsigned int __futex;                                 \
> +    __extension__ unsigned long long int __total_seq;     \
> +    __extension__ unsigned long long int __wakeup_seq;    \
> +    __extension__ unsigned long long int __woken_seq;     \
> +    void *__mutex;                                        \
> +    unsigned int __nwaiters;                              \
> +    unsigned int __broadcast_seq;                         \
> +  } __data;                                               \
> +  char __size[__SIZEOF_PTHREAD_COND_T];                   \
> +  __extension__ long long int __align;                    \
> +
> +
> +
> +#endif /* bits/thread-shared-types.h */
> diff --git a/sysdeps/microblaze/nptl/bits/pthreadtypes.h b/sysdeps/microblaze/nptl/bits/pthreadtypes.h
> index b8bd828..f419a83 100644
> --- a/sysdeps/microblaze/nptl/bits/pthreadtypes.h
> +++ b/sysdeps/microblaze/nptl/bits/pthreadtypes.h
> @@ -20,11 +20,10 @@
>  # define _BITS_PTHREADTYPES_H  1
>
>  # include <endian.h>
> +#include <bits/pthreadtypes-common.h>
>
>  # define __SIZEOF_PTHREAD_ATTR_T         36
> -# define __SIZEOF_PTHREAD_MUTEX_T        24
>  # define __SIZEOF_PTHREAD_MUTEXATTR_T     4
> -# define __SIZEOF_PTHREAD_COND_T         48
>  # define __SIZEOF_PTHREAD_COND_COMPAT_T  12
>  # define __SIZEOF_PTHREAD_CONDATTR_T      4
>  # define __SIZEOF_PTHREAD_RWLOCK_T       32
> @@ -48,36 +47,9 @@ typedef union pthread_attr_t pthread_attr_t;
>  #  define __have_pthread_attr_t        1
>  # endif
>
> -typedef struct __pthread_internal_slist
> -{
> -  struct __pthread_internal_slist *__next;
> -} __pthread_slist_t;
>
>  /* Data structures for mutex handling.  The structure of the attribute
>     type is not exposed on purpose.  */
> -typedef union
> -{
> -  struct __pthread_mutex_s
> -  {
> -    int __lock;
> -    unsigned int __count;
> -    int __owner;
> -    /* KIND must stay at this position in the structure to maintain
> -       binary compatibility.  */
> -    int __kind;
> -    unsigned int __nusers;
> -    __extension__ union
> -    {
> -      int __spins;
> -      __pthread_slist_t __list;
> -    };
> -  } __data;
> -  char __size[__SIZEOF_PTHREAD_MUTEX_T];
> -  long int __align;
> -} pthread_mutex_t;
> -
> -/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> -#define __PTHREAD_SPINS 0
>
>  typedef union
>  {
> @@ -87,22 +59,6 @@ typedef union
>
>  /* Data structure for conditional variable handling.  The structure of
>     the attribute type is not exposed on purpose.  */
> -typedef union
> -{
> -  struct
> -  {
> -    int __lock;
> -    unsigned int __futex;
> -    __extension__ unsigned long long int __total_seq;
> -    __extension__ unsigned long long int __wakeup_seq;
> -    __extension__ unsigned long long int __woken_seq;
> -    void *__mutex;
> -    unsigned int __nwaiters;
> -    unsigned int __broadcast_seq;
> -  } __data;
> -  char __size[__SIZEOF_PTHREAD_COND_T];
> -  __extension__ long long int __align;
> -} pthread_cond_t;
>
>  typedef union
>  {
> diff --git a/sysdeps/microblaze/nptl/bits/thread-shared-types.h b/sysdeps/microblaze/nptl/bits/thread-shared-types.h
> new file mode 100644
> index 0000000..bf96c04
> --- /dev/null
> +++ b/sysdeps/microblaze/nptl/bits/thread-shared-types.h
> @@ -0,0 +1,79 @@
> +/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +/* This header contains macros definition required for
> +   the declaration of pthread_mutex_t and pthread_cond_t,
> +   both needed by C11 types mtx_t and cnd_t. */
> +
> +#ifndef _BITS_THREAD_SHARED_TYPES_H
> +#define _BITS_THREAD_SHARED_TYPES_H    1
> +
> +#define __SIZEOF_PTHREAD_MUTEX_T        24
> +#define __SIZEOF_PTHREAD_COND_T         48
> +
> +typedef struct __pthread_internal_slist
> +{
> +  struct __pthread_internal_slist *__next;
> +} __pthread_slist_t;
> +
> +/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> +#define __PTHREAD_SPINS 0
> +
> +/* Data structure for mutex handling. */
> +
> +struct __pthread_mutex_s
> +{
> +  int __lock;
> +  unsigned int __count;
> +  int __owner;
> +  /* KIND must stay at this position in the structure to maintain
> +     binary compatibility.  */
> +  int __kind;
> +  unsigned int __nusers;
> +  __extension__ union
> +  {
> +    int __spins;
> +    __pthread_slist_t __list;
> +  };
> +};
> +
> +
> +#define __PTHREAD_MUTEX_T_CONTENT         \
> +  struct __pthread_mutex_s __data;        \
> +  char __size[__SIZEOF_PTHREAD_MUTEX_T];  \
> +  long int __align;
> +
> +
> +/* Data structure for conditional variable handling */
> +
> +#define __PTHREAD_COND_T_CONTENT                          \
> +  struct                                                  \
> +  {                                                       \
> +    int __lock;                                           \
> +    unsigned int __futex;                                 \
> +    __extension__ unsigned long long int __total_seq;     \
> +    __extension__ unsigned long long int __wakeup_seq;    \
> +    __extension__ unsigned long long int __woken_seq;     \
> +    void *__mutex;                                        \
> +    unsigned int __nwaiters;                              \
> +    unsigned int __broadcast_seq;                         \
> +  } __data;                                               \
> +  char __size[__SIZEOF_PTHREAD_COND_T];                   \
> +  __extension__ long long int __align;
> +
> +
> +#endif /* bits/thread-shared-types.h */
> diff --git a/sysdeps/mips/nptl/bits/pthreadtypes.h b/sysdeps/mips/nptl/bits/pthreadtypes.h
> index 8cf4547..ed6b2b6 100644
> --- a/sysdeps/mips/nptl/bits/pthreadtypes.h
> +++ b/sysdeps/mips/nptl/bits/pthreadtypes.h
> @@ -20,12 +20,11 @@
>  #define _BITS_PTHREADTYPES_H   1
>
>  #include <endian.h>
> +#include <bits/pthreadtypes-common.h>
>
>  #if _MIPS_SIM == _ABI64
>  # define __SIZEOF_PTHREAD_ATTR_T 56
> -# define __SIZEOF_PTHREAD_MUTEX_T 40
>  # define __SIZEOF_PTHREAD_MUTEXATTR_T 4
> -# define __SIZEOF_PTHREAD_COND_T 48
>  # define __SIZEOF_PTHREAD_CONDATTR_T 4
>  # define __SIZEOF_PTHREAD_RWLOCK_T 56
>  # define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
> @@ -33,9 +32,7 @@
>  # define __SIZEOF_PTHREAD_BARRIERATTR_T 4
>  #else
>  # define __SIZEOF_PTHREAD_ATTR_T 36
> -# define __SIZEOF_PTHREAD_MUTEX_T 24
>  # define __SIZEOF_PTHREAD_MUTEXATTR_T 4
> -# define __SIZEOF_PTHREAD_COND_T 48
>  # define __SIZEOF_PTHREAD_CONDATTR_T 4
>  # define __SIZEOF_PTHREAD_RWLOCK_T 32
>  # define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
> @@ -60,54 +57,8 @@ typedef union pthread_attr_t pthread_attr_t;
>  #endif
>
>
> -#if _MIPS_SIM == _ABI64
> -typedef struct __pthread_internal_list
> -{
> -  struct __pthread_internal_list *__prev;
> -  struct __pthread_internal_list *__next;
> -} __pthread_list_t;
> -#else
> -typedef struct __pthread_internal_slist
> -{
> -  struct __pthread_internal_slist *__next;
> -} __pthread_slist_t;
> -#endif
> -
> -
>  /* Data structures for mutex handling.  The structure of the attribute
>     type is deliberately not exposed.  */
> -typedef union
> -{
> -  struct __pthread_mutex_s
> -  {
> -    int __lock;
> -    unsigned int __count;
> -    int __owner;
> -#if _MIPS_SIM == _ABI64
> -    unsigned int __nusers;
> -#endif
> -    /* KIND must stay at this position in the structure to maintain
> -       binary compatibility.  */
> -    int __kind;
> -#if _MIPS_SIM == _ABI64
> -    int __spins;
> -    __pthread_list_t __list;
> -# define __PTHREAD_MUTEX_HAVE_PREV     1
> -#else
> -    unsigned int __nusers;
> -    __extension__ union
> -    {
> -      int __spins;
> -      __pthread_slist_t __list;
> -    };
> -#endif
> -  } __data;
> -  char __size[__SIZEOF_PTHREAD_MUTEX_T];
> -  long int __align;
> -} pthread_mutex_t;
> -
> -/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> -#define __PTHREAD_SPINS 0
>
>  typedef union
>  {
> @@ -118,22 +69,6 @@ typedef union
>
>  /* Data structure for conditional variable handling.  The structure of
>     the attribute type is deliberately not exposed.  */
> -typedef union
> -{
> -  struct
> -  {
> -    int __lock;
> -    unsigned int __futex;
> -    __extension__ unsigned long long int __total_seq;
> -    __extension__ unsigned long long int __wakeup_seq;
> -    __extension__ unsigned long long int __woken_seq;
> -    void *__mutex;
> -    unsigned int __nwaiters;
> -    unsigned int __broadcast_seq;
> -  } __data;
> -  char __size[__SIZEOF_PTHREAD_COND_T];
> -  __extension__ long long int __align;
> -} pthread_cond_t;
>
>  typedef union
>  {
> diff --git a/sysdeps/mips/nptl/bits/thread-shared-types.h b/sysdeps/mips/nptl/bits/thread-shared-types.h
> new file mode 100644
> index 0000000..c9f8123
> --- /dev/null
> +++ b/sysdeps/mips/nptl/bits/thread-shared-types.h
> @@ -0,0 +1,101 @@
> +/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +/* This header contains macros definition required for
> +   the declaration of pthread_mutex_t and pthread_cond_t,
> +   both needed by C11 types mtx_t and cnd_t. */
> +
> +#ifndef _BITS_THREAD_SHARED_TYPES_H
> +#define _BITS_THREAD_SHARED_TYPES_H    1
> +
> +#if _MIPS_SIM == _ABI64
> +# define __SIZEOF_PTHREAD_MUTEX_T 40
> +# define __SIZEOF_PTHREAD_COND_T 48
> +#else
> +# define __SIZEOF_PTHREAD_MUTEX_T 24
> +# define __SIZEOF_PTHREAD_COND_T 48
> +#endif
> +
> +#if _MIPS_SIM == _ABI64
> +typedef struct __pthread_internal_list
> +{
> +  struct __pthread_internal_list *__prev;
> +  struct __pthread_internal_list *__next;
> +} __pthread_list_t;
> +#else
> +typedef struct __pthread_internal_slist
> +{
> +  struct __pthread_internal_slist *__next;
> +} __pthread_slist_t;
> +#endif
> +
> +/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> +#define __PTHREAD_SPINS 0
> +
> +/* Data structure for mutex handling. */
> +
> +struct __pthread_mutex_s
> +{
> +  int __lock;
> +  unsigned int __count;
> +  int __owner;
> +#if _MIPS_SIM == _ABI64
> +  unsigned int __nusers;
> +#endif
> +  /* KIND must stay at this position in the structure to maintain
> +     binary compatibility.  */
> +  int __kind;
> +#if _MIPS_SIM == _ABI64
> +  int __spins;
> +  __pthread_list_t __list;
> +# define __PTHREAD_MUTEX_HAVE_PREV     1
> +#else
> +  unsigned int __nusers;
> +  __extension__ union
> +  {
> +    int __spins;
> +    __pthread_slist_t __list;
> +  };
> +#endif
> +};
> +
> +
> +# define __PTHREAD_MUTEX_T_CONTENT         \
> +  struct pthread_mutex_s __data;           \
> +  char __size[__SIZEOF_PTHREAD_MUTEX_T];   \
> +  long int __align;
> +
> +
> +/* Data structure for conditional variable handling */
> +
> +#define __PTHREAD_COND_T_CONTENT                          \
> +  struct                                                  \
> +  {                                                       \
> +    int __lock;                                           \
> +    unsigned int __futex;                                 \
> +    __extension__ unsigned long long int __total_seq;     \
> +    __extension__ unsigned long long int __wakeup_seq;    \
> +    __extension__ unsigned long long int __woken_seq;     \
> +    void *__mutex;                                        \
> +    unsigned int __nwaiters;                              \
> +    unsigned int __broadcast_seq;                         \
> +  } __data;                                               \
> +  char __size[__SIZEOF_PTHREAD_COND_T];                   \
> +  __extension__ long long int __align;
> +
> +
> +#endif /* bits/thread-shared-types.h */
> diff --git a/sysdeps/nios2/nptl/bits/pthreadtypes.h b/sysdeps/nios2/nptl/bits/pthreadtypes.h
> index 4a20803..03fa636 100644
> --- a/sysdeps/nios2/nptl/bits/pthreadtypes.h
> +++ b/sysdeps/nios2/nptl/bits/pthreadtypes.h
> @@ -20,11 +20,10 @@
>  #define _BITS_PTHREADTYPES_H   1
>
>  #include <endian.h>
> +#include <bits/pthreadtypes-common.h>
>
>  #define __SIZEOF_PTHREAD_ATTR_T 36
> -#define __SIZEOF_PTHREAD_MUTEX_T 24
>  #define __SIZEOF_PTHREAD_MUTEXATTR_T 4
> -#define __SIZEOF_PTHREAD_COND_T 48
>  #define __SIZEOF_PTHREAD_CONDATTR_T 4
>  #define __SIZEOF_PTHREAD_RWLOCK_T 32
>  #define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
> @@ -48,34 +47,8 @@ typedef union pthread_attr_t pthread_attr_t;
>  #endif
>
>
> -typedef struct __pthread_internal_slist
> -{
> -  struct __pthread_internal_slist *__next;
> -} __pthread_slist_t;
> -
> -
>  /* Data structures for mutex handling.  The structure of the attribute
>     type is deliberately not exposed.  */
> -typedef union
> -{
> -  struct __pthread_mutex_s
> -  {
> -    int __lock;
> -    unsigned int __count;
> -    int __owner;
> -    /* KIND must stay at this position in the structure to maintain
> -       binary compatibility.  */
> -    int __kind;
> -    unsigned int __nusers;
> -    __extension__ union
> -    {
> -      int __spins;
> -      __pthread_slist_t __list;
> -    };
> -  } __data;
> -  char __size[__SIZEOF_PTHREAD_MUTEX_T];
> -  long int __align;
> -} pthread_mutex_t;
>
>  typedef union
>  {
> @@ -83,28 +56,8 @@ typedef union
>    long int __align;
>  } pthread_mutexattr_t;
>
> -/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> -#define __PTHREAD_SPINS 0
> -
> -
>  /* Data structure for conditional variable handling.  The structure of
>     the attribute type is deliberately not exposed.  */
> -typedef union
> -{
> -  struct
> -  {
> -    int __lock;
> -    unsigned int __futex;
> -    __extension__ unsigned long long int __total_seq;
> -    __extension__ unsigned long long int __wakeup_seq;
> -    __extension__ unsigned long long int __woken_seq;
> -    void *__mutex;
> -    unsigned int __nwaiters;
> -    unsigned int __broadcast_seq;
> -  } __data;
> -  char __size[__SIZEOF_PTHREAD_COND_T];
> -  __extension__ long long int __align;
> -} pthread_cond_t;
>
>  typedef union
>  {
> diff --git a/sysdeps/nios2/nptl/bits/thread-shared-types.h b/sysdeps/nios2/nptl/bits/thread-shared-types.h
> new file mode 100644
> index 0000000..80769d2
> --- /dev/null
> +++ b/sysdeps/nios2/nptl/bits/thread-shared-types.h
> @@ -0,0 +1,79 @@
> +/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +/* This header contains macros definition required for
> +   the declaration of pthread_mutex_t and pthread_cond_t,
> +   both needed by C11 types mtx_t and cnd_t. */
> +
> +#ifndef _BITS_THREAD_SHARED_TYPES_H
> +#define _BITS_THREAD_SHARED_TYPES_H    1
> +
> +#define __SIZEOF_PTHREAD_MUTEX_T 24
> +#define __SIZEOF_PTHREAD_COND_T 48
> +
> +
> +typedef struct __pthread_internal_slist
> +{
> +  struct __pthread_internal_slist *__next;
> +} __pthread_slist_t;
> +
> +/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> +#define __PTHREAD_SPINS 0
> +
> +/* Data structure for mutex handling. */
> +
> +struct __pthread_mutex_s
> +{
> +  int __lock;
> +  unsigned int __count;
> +  int __owner;
> +  /* KIND must stay at this position in the structure to maintain
> +     binary compatibility.  */
> +  int __kind;
> +  unsigned int __nusers;
> +  __extension__ union
> +  {
> +    int __spins;
> +    __pthread_slist_t __list;
> +  };
> +};
> +
> +
> +#define __PTHREAD_MUTEX_T_CONTENT         \
> +  struct __pthread_mutex_s __data;        \
> +  char __size[__SIZEOF_PTHREAD_MUTEX_T];  \
> +  long int __align;
> +
> +/* Data structure for conditional variable handling */
> +
> +#define __PTHREAD_COND_T_CONTENT                          \
> +  struct                                                  \
> +  {                                                       \
> +    int __lock;                                           \
> +    unsigned int __futex;                                 \
> +    __extension__ unsigned long long int __total_seq;     \
> +    __extension__ unsigned long long int __wakeup_seq;    \
> +    __extension__ unsigned long long int __woken_seq;     \
> +    void *__mutex;                                        \
> +    unsigned int __nwaiters;                              \
> +    unsigned int __broadcast_seq;                         \
> +  } __data;                                               \
> +  char __size[__SIZEOF_PTHREAD_COND_T];                   \
> +  __extension__ long long int __align;
> +
> +
> +#endif /* bits/thread-shared-types.h */
> diff --git a/sysdeps/s390/nptl/bits/pthreadtypes.h b/sysdeps/s390/nptl/bits/pthreadtypes.h
> index 1f3bb14..ab52671 100644
> --- a/sysdeps/s390/nptl/bits/pthreadtypes.h
> +++ b/sysdeps/s390/nptl/bits/pthreadtypes.h
> @@ -19,12 +19,11 @@
>  #define _BITS_PTHREADTYPES_H   1
>
>  #include <bits/wordsize.h>
> +#include <bits/pthreadtypes-common.h>
>
>  #if __WORDSIZE == 64
>  # define __SIZEOF_PTHREAD_ATTR_T 56
> -# define __SIZEOF_PTHREAD_MUTEX_T 40
>  # define __SIZEOF_PTHREAD_MUTEXATTR_T 4
> -# define __SIZEOF_PTHREAD_COND_T 48
>  # define __SIZEOF_PTHREAD_CONDATTR_T 4
>  # define __SIZEOF_PTHREAD_RWLOCK_T 56
>  # define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
> @@ -32,9 +31,7 @@
>  # define __SIZEOF_PTHREAD_BARRIERATTR_T 4
>  #else
>  # define __SIZEOF_PTHREAD_ATTR_T 36
> -# define __SIZEOF_PTHREAD_MUTEX_T 24
>  # define __SIZEOF_PTHREAD_MUTEXATTR_T 4
> -# define __SIZEOF_PTHREAD_COND_T 48
>  # define __SIZEOF_PTHREAD_CONDATTR_T 4
>  # define __SIZEOF_PTHREAD_RWLOCK_T 32
>  # define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
> @@ -59,75 +56,8 @@ typedef union pthread_attr_t pthread_attr_t;
>  #endif
>
>
> -#if __WORDSIZE == 64
> -typedef struct __pthread_internal_list
> -{
> -  struct __pthread_internal_list *__prev;
> -  struct __pthread_internal_list *__next;
> -} __pthread_list_t;
> -#else
> -typedef struct __pthread_internal_slist
> -{
> -  struct __pthread_internal_slist *__next;
> -} __pthread_slist_t;
> -#endif
> -
> -
>  /* Data structures for mutex handling.  The structure of the attribute
>     type is not exposed on purpose.  */
> -typedef union
> -{
> -  struct __pthread_mutex_s
> -  {
> -    int __lock;
> -    unsigned int __count;
> -    int __owner;
> -#if __WORDSIZE == 64
> -    unsigned int __nusers;
> -#endif
> -    /* KIND must stay at this position in the structure to maintain
> -       binary compatibility.  */
> -    int __kind;
> -#if __WORDSIZE == 64
> -# ifdef ENABLE_LOCK_ELISION
> -    short __spins;
> -    short __elision;
> -    /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> -#  define __PTHREAD_SPINS               0, 0
> -# else
> -    int __spins;
> -    /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> -#  define __PTHREAD_SPINS               0
> -# endif
> -    __pthread_list_t __list;
> -# define __PTHREAD_MUTEX_HAVE_PREV     1
> -#else
> -    unsigned int __nusers;
> -    __extension__ union
> -    {
> -# ifdef ENABLE_LOCK_ELISION
> -      struct
> -      {
> -       short __espins;
> -       short __elision;
> -      } _d;
> -#  define __spins _d.__espins
> -#  define __elision _d.__elision
> -    /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> -#  define __PTHREAD_SPINS               { 0, 0 }
> -# else
> -      int __spins;
> -    /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> -#  define __PTHREAD_SPINS               0
> -# endif
> -      __pthread_slist_t __list;
> -    };
> -#endif
> -  } __data;
> -  char __size[__SIZEOF_PTHREAD_MUTEX_T];
> -  long int __align;
> -} pthread_mutex_t;
> -
>
>  typedef union
>  {
> @@ -138,22 +68,6 @@ typedef union
>
>  /* Data structure for conditional variable handling.  The structure of
>     the attribute type is not exposed on purpose.  */
> -typedef union
> -{
> -  struct
> -  {
> -    int __lock;
> -    unsigned int __futex;
> -    __extension__ unsigned long long int __total_seq;
> -    __extension__ unsigned long long int __wakeup_seq;
> -    __extension__ unsigned long long int __woken_seq;
> -    void *__mutex;
> -    unsigned int __nwaiters;
> -    unsigned int __broadcast_seq;
> -  } __data;
> -  char __size[__SIZEOF_PTHREAD_COND_T];
> -  __extension__ long long int __align;
> -} pthread_cond_t;
>
>  typedef union
>  {
> @@ -244,5 +158,4 @@ typedef union
>  } pthread_barrierattr_t;
>  #endif
>
> -
>  #endif /* bits/pthreadtypes.h */
> diff --git a/sysdeps/s390/nptl/bits/thread-shared-types.h b/sysdeps/s390/nptl/bits/thread-shared-types.h
> new file mode 100644
> index 0000000..6057737
> --- /dev/null
> +++ b/sysdeps/s390/nptl/bits/thread-shared-types.h
> @@ -0,0 +1,123 @@
> +/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +/* This header contains macros definition required for
> +   the declaration of pthread_mutex_t and pthread_cond_t,
> +   both needed by C11 types mtx_t and cnd_t. */
> +
> +#ifndef _BITS_THREAD_SHARED_TYPES_H
> +#define _BITS_THREAD_SHARED_TYPES_H    1
> +
> +#include <bits/wordsize.h>
> +
> +#if __WORDSIZE == 64
> +# define __SIZEOF_PTHREAD_MUTEX_T 40
> +# define __SIZEOF_PTHREAD_COND_T 48
> +#else
> +# define __SIZEOF_PTHREAD_MUTEX_T 24
> +# define __SIZEOF_PTHREAD_COND_T 48
> +#endif
> +
> +#if __WORDSIZE == 64
> +typedef struct __pthread_internal_list
> +{
> +  struct __pthread_internal_list *__prev;
> +  struct __pthread_internal_list *__next;
> +} __pthread_list_t;
> +#else
> +typedef struct __pthread_internal_slist
> +{
> +  struct __pthread_internal_slist *__next;
> +} __pthread_slist_t;
> +#endif
> +
> +
> +/* Data structure for mutex handling. */
> +
> +struct __pthread_mutex_s
> +{
> +  int __lock;
> +  unsigned int __count;
> +  int __owner;
> +#if __WORDSIZE == 64
> +  unsigned int __nusers;
> +#endif
> +  /* KIND must stay at this position in the structure to maintain
> +     binary compatibility.  */
> +  int __kind;
> +#if __WORDSIZE == 64
> +# ifdef ENABLE_LOCK_ELISION
> +  short __spins;
> +  short __elision;
> +  /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> +#  define __PTHREAD_SPINS               0, 0
> +# else
> +  int __spins;
> +  /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> +#  define __PTHREAD_SPINS               0
> +# endif
> +  __pthread_list_t __list;
> +# define __PTHREAD_MUTEX_HAVE_PREV     1
> +#else
> +  unsigned int __nusers;
> +  __extension__ union
> +  {
> +# ifdef ENABLE_LOCK_ELISION
> +    struct
> +    {
> +      short __espins;
> +      short __elision;
> +    } _d;
> +#  define __spins _d.__espins
> +#  define __elision _d.__elision
> +  /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> +#  define __PTHREAD_SPINS               { 0, 0 }
> +# else
> +    int __spins;
> +  /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> +#  define __PTHREAD_SPINS               0
> +# endif
> +    __pthread_slist_t __list;
> +  };
> +#endif
> +};
> +
> +#define __PTHREAD_MUTEX_T_CONTENT         \
> +  struct __pthread_mutex_s __data;        \
> +  char __size[__SIZEOF_PTHREAD_MUTEX_T];  \
> +  long int __align;
> +
> +
> +/* Data structure for conditional variable handling */
> +
> +#define __PTHREAD_COND_T_CONTENT                          \
> +  struct                                                  \
> +  {                                                       \
> +    int __lock;                                           \
> +    unsigned int __futex;                                 \
> +    __extension__ unsigned long long int __total_seq;     \
> +    __extension__ unsigned long long int __wakeup_seq;    \
> +    __extension__ unsigned long long int __woken_seq;     \
> +    void *__mutex;                                        \
> +    unsigned int __nwaiters;                              \
> +    unsigned int __broadcast_seq;                         \
> +  } __data;                                               \
> +  char __size[__SIZEOF_PTHREAD_COND_T];                   \
> +  __extension__ long long int __align;
> +
> +
> +#endif /* bits/thread-shared-types.h */
> diff --git a/sysdeps/sh/nptl/bits/pthreadtypes.h b/sysdeps/sh/nptl/bits/pthreadtypes.h
> index 5940232..5478603 100644
> --- a/sysdeps/sh/nptl/bits/pthreadtypes.h
> +++ b/sysdeps/sh/nptl/bits/pthreadtypes.h
> @@ -19,11 +19,10 @@
>  #define _BITS_PTHREADTYPES_H   1
>
>  #include <endian.h>
> +#include <bits/pthreadtypes-common.h>
>
>  #define __SIZEOF_PTHREAD_ATTR_T 36
> -#define __SIZEOF_PTHREAD_MUTEX_T 24
>  #define __SIZEOF_PTHREAD_MUTEXATTR_T 4
> -#define __SIZEOF_PTHREAD_COND_T 48
>  #define __SIZEOF_PTHREAD_COND_COMPAT_T 12
>  #define __SIZEOF_PTHREAD_CONDATTR_T 4
>  #define __SIZEOF_PTHREAD_RWLOCK_T 32
> @@ -48,37 +47,8 @@ typedef union pthread_attr_t pthread_attr_t;
>  #endif
>
>
> -typedef struct __pthread_internal_slist
> -{
> -  struct __pthread_internal_slist *__next;
> -} __pthread_slist_t;
> -
> -
>  /* Data structures for mutex handling.  The structure of the attribute
>     type is not exposed on purpose.  */
> -typedef union
> -{
> -  struct __pthread_mutex_s
> -  {
> -    int __lock;
> -    unsigned int __count;
> -    int __owner;
> -    /* KIND must stay at this position in the structure to maintain
> -       binary compatibility.  */
> -    int __kind;
> -    unsigned int __nusers;
> -    __extension__ union
> -    {
> -      int __spins;
> -      __pthread_slist_t __list;
> -    };
> -  } __data;
> -  char __size[__SIZEOF_PTHREAD_MUTEX_T];
> -  long int __align;
> -} pthread_mutex_t;
> -
> -/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> -#define __PTHREAD_SPINS 0
>
>  typedef union
>  {
> @@ -89,22 +59,6 @@ typedef union
>
>  /* Data structure for conditional variable handling.  The structure of
>     the attribute type is not exposed on purpose.  */
> -typedef union
> -{
> -  struct
> -  {
> -    int __lock;
> -    unsigned int __futex;
> -    __extension__ unsigned long long int __total_seq;
> -    __extension__ unsigned long long int __wakeup_seq;
> -    __extension__ unsigned long long int __woken_seq;
> -    void *__mutex;
> -    unsigned int __nwaiters;
> -    unsigned int __broadcast_seq;
> -  } __data;
> -  char __size[__SIZEOF_PTHREAD_COND_T];
> -  __extension__ long long int __align;
> -} pthread_cond_t;
>
>  typedef union
>  {
> diff --git a/sysdeps/sh/nptl/bits/thread-shared-types.h b/sysdeps/sh/nptl/bits/thread-shared-types.h
> new file mode 100644
> index 0000000..74686e7
> --- /dev/null
> +++ b/sysdeps/sh/nptl/bits/thread-shared-types.h
> @@ -0,0 +1,80 @@
> +/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +/* This header contains macros definition required for
> +   the declaration of pthread_mutex_t and pthread_cond_t,
> +   both needed by C11 types mtx_t and cnd_t. */
> +
> +#ifndef _BITS_THREAD_SHARED_TYPES_H
> +#define _BITS_THREAD_SHARED_TYPES_H    1
> +
> +#include <bits/wordsize.h>
> +
> +#define __SIZEOF_PTHREAD_MUTEX_T 24
> +#define __SIZEOF_PTHREAD_COND_T 48
> +
> +typedef struct __pthread_internal_slist
> +{
> +  struct __pthread_internal_slist *__next;
> +} __pthread_slist_t;
> +
> +/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> +#define __PTHREAD_SPINS 0
> +
> +/* Data structure for mutex handling. */
> +
> +struct __pthread_mutex_s
> +{
> +  int __lock;
> +  unsigned int __count;
> +  int __owner;
> +  /* KIND must stay at this position in the structure to maintain
> +     binary compatibility.  */
> +  int __kind;
> +  unsigned int __nusers;
> +  __extension__ union
> +  {
> +    int __spins;
> +    __pthread_slist_t __list;
> +  };
> +};
> +
> +#define __PTHREAD_MUTEX_T_CONTENT         \
> +  struct __pthread_mutex_s __data;         \
> +  char __size[__SIZEOF_PTHREAD_MUTEX_T];   \
> +  long int __align;
> +
> +
> +/* Data structure for conditional variable handling */
> +
> +#define __PTHREAD_COND_T_CONTENT                          \
> +  struct                                                  \
> +  {                                                       \
> +    int __lock;                                           \
> +    unsigned int __futex;                                 \
> +    __extension__ unsigned long long int __total_seq;     \
> +    __extension__ unsigned long long int __wakeup_seq;    \
> +    __extension__ unsigned long long int __woken_seq;     \
> +    void *__mutex;                                        \
> +    unsigned int __nwaiters;                              \
> +    unsigned int __broadcast_seq;                         \
> +  } __data;                                               \
> +  char __size[__SIZEOF_PTHREAD_COND_T];                   \
> +  __extension__ long long int __align;
> +
> +
> +#endif /* bits/thread-shared-types.h */
> diff --git a/sysdeps/sparc/nptl/bits/pthreadtypes.h b/sysdeps/sparc/nptl/bits/pthreadtypes.h
> index 6faf8b2..d2eb712 100644
> --- a/sysdeps/sparc/nptl/bits/pthreadtypes.h
> +++ b/sysdeps/sparc/nptl/bits/pthreadtypes.h
> @@ -20,12 +20,11 @@
>  #define _BITS_PTHREADTYPES_H   1
>
>  #include <bits/wordsize.h>
> +#include <bits/pthreadtypes-common.h>
>
>  #if __WORDSIZE == 64
>  # define __SIZEOF_PTHREAD_ATTR_T 56
> -# define __SIZEOF_PTHREAD_MUTEX_T 40
>  # define __SIZEOF_PTHREAD_MUTEXATTR_T 4
> -# define __SIZEOF_PTHREAD_COND_T 48
>  # define __SIZEOF_PTHREAD_CONDATTR_T 4
>  # define __SIZEOF_PTHREAD_RWLOCK_T 56
>  # define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
> @@ -33,9 +32,7 @@
>  # define __SIZEOF_PTHREAD_BARRIERATTR_T 4
>  #else
>  # define __SIZEOF_PTHREAD_ATTR_T 36
> -# define __SIZEOF_PTHREAD_MUTEX_T 24
>  # define __SIZEOF_PTHREAD_MUTEXATTR_T 4
> -# define __SIZEOF_PTHREAD_COND_T 48
>  # define __SIZEOF_PTHREAD_CONDATTR_T 4
>  # define __SIZEOF_PTHREAD_RWLOCK_T 32
>  # define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
> @@ -60,54 +57,8 @@ typedef union pthread_attr_t pthread_attr_t;
>  #endif
>
>
> -#if __WORDSIZE == 64
> -typedef struct __pthread_internal_list
> -{
> -  struct __pthread_internal_list *__prev;
> -  struct __pthread_internal_list *__next;
> -} __pthread_list_t;
> -#else
> -typedef struct __pthread_internal_slist
> -{
> -  struct __pthread_internal_slist *__next;
> -} __pthread_slist_t;
> -#endif
> -
> -
>  /* Data structures for mutex handling.  The structure of the attribute
>     type is deliberately not exposed.  */
> -typedef union
> -{
> -  struct __pthread_mutex_s
> -  {
> -    int __lock;
> -    unsigned int __count;
> -    int __owner;
> -#if __WORDSIZE == 64
> -    unsigned int __nusers;
> -#endif
> -    /* KIND must stay at this position in the structure to maintain
> -       binary compatibility.  */
> -    int __kind;
> -#if __WORDSIZE == 64
> -    int __spins;
> -    __pthread_list_t __list;
> -# define __PTHREAD_MUTEX_HAVE_PREV     1
> -#else
> -    unsigned int __nusers;
> -    __extension__ union
> -    {
> -      int __spins;
> -      __pthread_slist_t __list;
> -    };
> -#endif
> -  } __data;
> -  char __size[__SIZEOF_PTHREAD_MUTEX_T];
> -  long int __align;
> -} pthread_mutex_t;
> -
> -/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> -#define __PTHREAD_SPINS 0
>
>  typedef union
>  {
> @@ -118,22 +69,6 @@ typedef union
>
>  /* Data structure for conditional variable handling.  The structure of
>     the attribute type is deliberately not exposed.  */
> -typedef union
> -{
> -  struct
> -  {
> -    int __lock;
> -    unsigned int __futex;
> -    __extension__ unsigned long long int __total_seq;
> -    __extension__ unsigned long long int __wakeup_seq;
> -    __extension__ unsigned long long int __woken_seq;
> -    void *__mutex;
> -    unsigned int __nwaiters;
> -    unsigned int __broadcast_seq;
> -  } __data;
> -  char __size[__SIZEOF_PTHREAD_COND_T];
> -  __extension__ long long int __align;
> -} pthread_cond_t;
>
>  typedef union
>  {
> diff --git a/sysdeps/sparc/nptl/bits/thread-shared-types.h b/sysdeps/sparc/nptl/bits/thread-shared-types.h
> new file mode 100644
> index 0000000..447f24c
> --- /dev/null
> +++ b/sysdeps/sparc/nptl/bits/thread-shared-types.h
> @@ -0,0 +1,104 @@
> +/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +/* This header contains macros definition required for
> +   the declaration of pthread_mutex_t and pthread_cond_t,
> +   both needed by C11 types mtx_t and cnd_t. */
> +
> +#ifndef _BITS_THREAD_SHARED_TYPES_H
> +#define _BITS_THREAD_SHARED_TYPES_H    1
> +
> +#include <bits/wordsize.h>
> +
> +
> +#if __WORDSIZE == 64
> +# define __SIZEOF_PTHREAD_MUTEX_T 40
> +# define __SIZEOF_PTHREAD_COND_T 48
> +#else
> +# define __SIZEOF_PTHREAD_MUTEX_T 24
> +# define __SIZEOF_PTHREAD_COND_T 48
> +#endif
> +
> +#if __WORDSIZE == 64
> +typedef struct __pthread_internal_list
> +{
> +  struct __pthread_internal_list *__prev;
> +  struct __pthread_internal_list *__next;
> +} __pthread_list_t;
> +#else
> +typedef struct __pthread_internal_slist
> +{
> +  struct __pthread_internal_slist *__next;
> +} __pthread_slist_t;
> +#endif
> +
> +/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> +#define __PTHREAD_SPINS 0
> +
> +/* Data structure for mutex handling. */
> +
> +struct __pthread_mutex_s
> +{
> +  int __lock;
> +  unsigned int __count;
> +  int __owner;
> +#if __WORDSIZE == 64
> +  unsigned int __nusers;
> +#endif
> +  /* KIND must stay at this position in the structure to maintain
> +     binary compatibility.  */
> +  int __kind;
> +#if __WORDSIZE == 64
> +  int __spins;
> +  __pthread_list_t __list;
> +# define __PTHREAD_MUTEX_HAVE_PREV     1
> +#else
> +  unsigned int __nusers;
> +  __extension__ union
> +  {
> +    int __spins;
> +    __pthread_slist_t __list;
> +  };
> +#endif
> +};
> +
> +# define __PTHREAD_MUTEX_T_CONTENT         \
> +  struct __pthread_mutex_s __data;           \
> +  char __size[__SIZEOF_PTHREAD_MUTEX_T];   \
> +  long int __align;
> +
> +
> +
> +/* Data structure for conditional variable handling */
> +
> +#define __PTHREAD_COND_T_CONTENT                          \
> +  struct                                                  \
> +  {                                                       \
> +    int __lock;                                           \
> +    unsigned int __futex;                                 \
> +    __extension__ unsigned long long int __total_seq;     \
> +    __extension__ unsigned long long int __wakeup_seq;    \
> +    __extension__ unsigned long long int __woken_seq;     \
> +    void *__mutex;                                        \
> +    unsigned int __nwaiters;                              \
> +    unsigned int __broadcast_seq;                         \
> +  } __data;                                               \
> +  char __size[__SIZEOF_PTHREAD_COND_T];                   \
> +  __extension__ long long int __align;
> +
> +
> +#endif /* bits/thread-shared-types.h */
> diff --git a/sysdeps/tile/nptl/bits/pthreadtypes.h b/sysdeps/tile/nptl/bits/pthreadtypes.h
> index 1f6553d..074825c 100644
> --- a/sysdeps/tile/nptl/bits/pthreadtypes.h
> +++ b/sysdeps/tile/nptl/bits/pthreadtypes.h
> @@ -21,12 +21,11 @@
>  #define _BITS_PTHREADTYPES_H   1
>
>  #include <bits/wordsize.h>
> +#include <bits/pthreadtypes-common.h>
>
>  #if __WORDSIZE == 64
>  # define __SIZEOF_PTHREAD_ATTR_T 56
> -# define __SIZEOF_PTHREAD_MUTEX_T 40
>  # define __SIZEOF_PTHREAD_MUTEXATTR_T 4
> -# define __SIZEOF_PTHREAD_COND_T 48
>  # define __SIZEOF_PTHREAD_CONDATTR_T 4
>  # define __SIZEOF_PTHREAD_RWLOCK_T 56
>  # define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
> @@ -34,9 +33,7 @@
>  # define __SIZEOF_PTHREAD_BARRIERATTR_T 4
>  #else
>  # define __SIZEOF_PTHREAD_ATTR_T 36
> -# define __SIZEOF_PTHREAD_MUTEX_T 24
>  # define __SIZEOF_PTHREAD_MUTEXATTR_T 4
> -# define __SIZEOF_PTHREAD_COND_T 48
>  # define __SIZEOF_PTHREAD_CONDATTR_T 4
>  # define __SIZEOF_PTHREAD_RWLOCK_T 32
>  # define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
> @@ -60,51 +57,9 @@ typedef union pthread_attr_t pthread_attr_t;
>  # define __have_pthread_attr_t 1
>  #endif
>
> -#if __WORDSIZE == 64
> -typedef struct __pthread_internal_list
> -{
> -  struct __pthread_internal_list *__prev;
> -  struct __pthread_internal_list *__next;
> -} __pthread_list_t;
> -#else
> -typedef struct __pthread_internal_slist
> -{
> -  struct __pthread_internal_slist *__next;
> -} __pthread_slist_t;
> -#endif
> -
>
>  /* Data structures for mutex handling.  The structure of the attribute
>     type is not exposed on purpose.  */
> -typedef union
> -{
> -  struct __pthread_mutex_s
> -  {
> -    int __lock;
> -    unsigned int __count;
> -    int __owner;
> -#if __WORDSIZE == 64
> -    unsigned int __nusers;
> -#endif
> -    /* KIND must stay at this position in the structure to maintain
> -       binary compatibility.  */
> -    int __kind;
> -#if __WORDSIZE == 64
> -    int __spins;
> -    __pthread_list_t __list;
> -# define __PTHREAD_MUTEX_HAVE_PREV     1
> -#else
> -    unsigned int __nusers;
> -    __extension__ union
> -    {
> -      int __spins;
> -      __pthread_slist_t __list;
> -    };
> -#endif
> -  } __data;
> -  char __size[__SIZEOF_PTHREAD_MUTEX_T];
> -  long int __align;
> -} pthread_mutex_t;
>
>  typedef union
>  {
> @@ -112,28 +67,8 @@ typedef union
>    int __align;
>  } pthread_mutexattr_t;
>
> -/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> -#define __PTHREAD_SPINS 0
> -
> -
>  /* Data structure for conditional variable handling.  The structure of
>     the attribute type is not exposed on purpose.  */
> -typedef union
> -{
> -  struct
> -  {
> -    int __lock;
> -    unsigned int __futex;
> -    __extension__ unsigned long long int __total_seq;
> -    __extension__ unsigned long long int __wakeup_seq;
> -    __extension__ unsigned long long int __woken_seq;
> -    void *__mutex;
> -    unsigned int __nwaiters;
> -    unsigned int __broadcast_seq;
> -  } __data;
> -  char __size[__SIZEOF_PTHREAD_COND_T];
> -  __extension__ long long int __align;
> -} pthread_cond_t;
>
>  typedef union
>  {
> diff --git a/sysdeps/tile/nptl/bits/thread-shared-types.h b/sysdeps/tile/nptl/bits/thread-shared-types.h
> new file mode 100644
> index 0000000..729a787
> --- /dev/null
> +++ b/sysdeps/tile/nptl/bits/thread-shared-types.h
> @@ -0,0 +1,103 @@
> +/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +/* This header contains macros definition required for
> +   the declaration of pthread_mutex_t and pthread_cond_t,
> +   both needed by C11 types mtx_t and cnd_t. */
> +
> +#ifndef _BITS_THREAD_SHARED_TYPES_H
> +#define _BITS_THREAD_SHARED_TYPES_H    1
> +
> +#include <bits/wordsize.h>
> +
> +
> +#if __WORDSIZE == 64
> +# define __SIZEOF_PTHREAD_MUTEX_T 40
> +# define __SIZEOF_PTHREAD_COND_T 48
> +#else
> +# define __SIZEOF_PTHREAD_MUTEX_T 24
> +# define __SIZEOF_PTHREAD_COND_T 48
> +#endif
> +
> +#if __WORDSIZE == 64
> +typedef struct __pthread_internal_list
> +{
> +  struct __pthread_internal_list *__prev;
> +  struct __pthread_internal_list *__next;
> +} __pthread_list_t;
> +#else
> +typedef struct __pthread_internal_slist
> +{
> +  struct __pthread_internal_slist *__next;
> +} __pthread_slist_t;
> +#endif
> +
> +/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> +#define __PTHREAD_SPINS 0
> +
> +/* Data structure for mutex handling. */
> +
> +struct __pthread_mutex_s
> +{
> +  int __lock;
> +  unsigned int __count;
> +  int __owner;
> +#if __WORDSIZE == 64
> +  unsigned int __nusers;
> +#endif
> +  /* KIND must stay at this position in the structure to maintain
> +     binary compatibility.  */
> +  int __kind;
> +#if __WORDSIZE == 64
> +  int __spins;
> +  __pthread_list_t __list;
> +# define __PTHREAD_MUTEX_HAVE_PREV     1
> +#else
> +  unsigned int __nusers;
> +  __extension__ union
> +  {
> +    int __spins;
> +    __pthread_slist_t __list;
> +  };
> +#endif
> +};
> +
> +#define __PTHREAD_MUTEX_T_CONTENT         \
> +  struct __pthread_mutex_s __data;        \
> +  char __size[__SIZEOF_PTHREAD_MUTEX_T];  \
> +  long int __align;
> +
> +
> +/* Data structure for conditional variable handling */
> +
> +#define __PTHREAD_COND_T_CONTENT                          \
> +  struct                                                  \
> +  {                                                       \
> +    int __lock;                                           \
> +    unsigned int __futex;                                 \
> +    __extension__ unsigned long long int __total_seq;     \
> +    __extension__ unsigned long long int __wakeup_seq;    \
> +    __extension__ unsigned long long int __woken_seq;     \
> +    void *__mutex;                                        \
> +    unsigned int __nwaiters;                              \
> +    unsigned int __broadcast_seq;                         \
> +  } __data;                                               \
> +  char __size[__SIZEOF_PTHREAD_COND_T];                   \
> +  __extension__ long long int __align;
> +
> +
> +#endif /* bits/thread-shared-types.h */
> diff --git a/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h b/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h
> index 7121d0b..ed3f60f 100644
> --- a/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h
> +++ b/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h
> @@ -19,10 +19,10 @@
>  #ifndef _BITS_PTHREADTYPES_H
>  #define _BITS_PTHREADTYPES_H   1
>
> +#include <bits/pthreadtypes-common.h>
> +
>  #define __SIZEOF_PTHREAD_ATTR_T                56
> -#define __SIZEOF_PTHREAD_MUTEX_T       40
>  #define __SIZEOF_PTHREAD_MUTEXATTR_T   4
> -#define __SIZEOF_PTHREAD_COND_T                48
>  #define __SIZEOF_PTHREAD_CONDATTR_T    4
>  #define __SIZEOF_PTHREAD_RWLOCK_T      56
>  #define __SIZEOF_PTHREAD_RWLOCKATTR_T  8
> @@ -45,36 +45,9 @@ typedef union pthread_attr_t pthread_attr_t;
>  # define __have_pthread_attr_t 1
>  #endif
>
> -typedef struct __pthread_internal_list
> -{
> -  struct __pthread_internal_list *__prev;
> -  struct __pthread_internal_list *__next;
> -} __pthread_list_t;
> -
>
>  /* Data structures for mutex handling.  The structure of the attribute
>     type is deliberately not exposed.  */
> -typedef union
> -{
> -  struct __pthread_mutex_s
> -  {
> -    int __lock;
> -    unsigned int __count;
> -    int __owner;
> -    unsigned int __nusers;
> -    /* KIND must stay at this position in the structure to maintain
> -       binary compatibility.  */
> -    int __kind;
> -    int __spins;
> -    __pthread_list_t __list;
> -#define __PTHREAD_MUTEX_HAVE_PREV      1
> -  } __data;
> -  char __size[__SIZEOF_PTHREAD_MUTEX_T];
> -  long int __align;
> -} pthread_mutex_t;
> -
> -/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> -#define __PTHREAD_SPINS 0
>
>  typedef union
>  {
> @@ -85,22 +58,6 @@ typedef union
>
>  /* Data structure for conditional variable handling.  The structure of
>     the attribute type is deliberately not exposed.  */
> -typedef union
> -{
> -  struct
> -  {
> -    int __lock;
> -    unsigned int __futex;
> -    __extension__ unsigned long long int __total_seq;
> -    __extension__ unsigned long long int __wakeup_seq;
> -    __extension__ unsigned long long int __woken_seq;
> -    void *__mutex;
> -    unsigned int __nwaiters;
> -    unsigned int __broadcast_seq;
> -  } __data;
> -  char __size[__SIZEOF_PTHREAD_COND_T];
> -  __extension__ long long int __align;
> -} pthread_cond_t;
>
>  typedef union
>  {
> diff --git a/sysdeps/unix/sysv/linux/alpha/bits/thread-shared-types.h b/sysdeps/unix/sysv/linux/alpha/bits/thread-shared-types.h
> new file mode 100644
> index 0000000..fcadf43
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/alpha/bits/thread-shared-types.h
> @@ -0,0 +1,79 @@
> +/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +/* This header contains macros definition required for
> +   the declaration of pthread_mutex_t and pthread_cond_t,
> +   both needed by C11 types mtx_t and cnd_t. */
> +
> +#ifndef _BITS_THREAD_SHARED_TYPES_H
> +#define _BITS_THREAD_SHARED_TYPES_H    1
> +
> +
> +#define __SIZEOF_PTHREAD_MUTEX_T 40
> +#define __SIZEOF_PTHREAD_COND_T 48
> +
> +typedef struct __pthread_internal_list
> +{
> +  struct __pthread_internal_list *__prev;
> +  struct __pthread_internal_list *__next;
> +} __pthread_list_t;
> +
> +/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> +#define __PTHREAD_SPINS 0
> +
> +/* Data structure for mutex handling. */
> +
> +struct __pthread_mutex_s
> +{
> +  int __lock;
> +  unsigned int __count;
> +  int __owner;
> +  unsigned int __nusers;
> +  /* KIND must stay at this position in the structure to maintain
> +     binary compatibility.  */
> +  int __kind;
> +  int __spins;
> +  __pthread_list_t __list;
> +#define __PTHREAD_MUTEX_HAVE_PREV      1
> +} __data;
> +
> +
> +#define __PTHREAD_MUTEX_T_CONTENT            \
> +  struct __pthread_mutex_s __data;            \
> +  char __size[__SIZEOF_PTHREAD_MUTEX_T];      \
> +  long int __align;
> +
> +
> +/* Data structure for conditional variable handling */
> +
> +#define __PTHREAD_COND_T_CONTENT                          \
> +  struct                                                  \
> +  {                                                       \
> +    int __lock;                                           \
> +    unsigned int __futex;                                 \
> +    __extension__ unsigned long long int __total_seq;     \
> +    __extension__ unsigned long long int __wakeup_seq;    \
> +    __extension__ unsigned long long int __woken_seq;     \
> +    void *__mutex;                                        \
> +    unsigned int __nwaiters;                              \
> +    unsigned int __broadcast_seq;                         \
> +  } __data;                                               \
> +  char __size[__SIZEOF_PTHREAD_COND_T];                   \
> +  __extension__ long long int __align;
> +
> +
> +#endif /* bits/thread-shared-types.h */
> diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h b/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h
> index 7cbdb2c..253e2bb 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h
> +++ b/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h
> @@ -20,12 +20,11 @@
>  #define _BITS_PTHREADTYPES_H   1
>
>  #include <bits/wordsize.h>
> +#include <bits/pthreadtypes-common.h>
>
>  #if __WORDSIZE == 64
>  # define __SIZEOF_PTHREAD_ATTR_T 56
> -# define __SIZEOF_PTHREAD_MUTEX_T 40
>  # define __SIZEOF_PTHREAD_MUTEXATTR_T 4
> -# define __SIZEOF_PTHREAD_COND_T 48
>  # define __SIZEOF_PTHREAD_CONDATTR_T 4
>  # define __SIZEOF_PTHREAD_RWLOCK_T 56
>  # define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
> @@ -33,9 +32,7 @@
>  # define __SIZEOF_PTHREAD_BARRIERATTR_T 4
>  #else
>  # define __SIZEOF_PTHREAD_ATTR_T 36
> -# define __SIZEOF_PTHREAD_MUTEX_T 24
>  # define __SIZEOF_PTHREAD_MUTEXATTR_T 4
> -# define __SIZEOF_PTHREAD_COND_T 48
>  # define __SIZEOF_PTHREAD_CONDATTR_T 4
>  # define __SIZEOF_PTHREAD_RWLOCK_T 32
>  # define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
> @@ -59,61 +56,8 @@ typedef union pthread_attr_t pthread_attr_t;
>  # define __have_pthread_attr_t 1
>  #endif
>
> -
> -#if __WORDSIZE == 64
> -typedef struct __pthread_internal_list
> -{
> -  struct __pthread_internal_list *__prev;
> -  struct __pthread_internal_list *__next;
> -} __pthread_list_t;
> -#else
> -typedef struct __pthread_internal_slist
> -{
> -  struct __pthread_internal_slist *__next;
> -} __pthread_slist_t;
> -#endif
> -
> -
>  /* Data structures for mutex handling.  The structure of the attribute
>     type is deliberately not exposed.  */
> -typedef union
> -{
> -  struct __pthread_mutex_s
> -  {
> -    int __lock;
> -    unsigned int __count;
> -    int __owner;
> -#if __WORDSIZE == 64
> -    unsigned int __nusers;
> -#endif
> -    /* KIND must stay at this position in the structure to maintain
> -       binary compatibility.  */
> -    int __kind;
> -#if __WORDSIZE == 64
> -    short __spins;
> -    short __elision;
> -    __pthread_list_t __list;
> -# define __PTHREAD_MUTEX_HAVE_PREV     1
> -# define __PTHREAD_SPINS             0, 0
> -#else
> -    unsigned int __nusers;
> -    __extension__ union
> -    {
> -      struct
> -      {
> -       short __espins;
> -       short __elision;
> -# define __spins __elision_data.__espins
> -# define __elision __elision_data.__elision
> -# define __PTHREAD_SPINS         { 0, 0 }
> -      } __elision_data;
> -      __pthread_slist_t __list;
> -    };
> -#endif
> -  } __data;
> -  char __size[__SIZEOF_PTHREAD_MUTEX_T];
> -  long int __align;
> -} pthread_mutex_t;
>
>  typedef union
>  {
> @@ -124,22 +68,6 @@ typedef union
>
>  /* Data structure for conditional variable handling.  The structure of
>     the attribute type is deliberately not exposed.  */
> -typedef union
> -{
> -  struct
> -  {
> -    int __lock;
> -    unsigned int __futex;
> -    __extension__ unsigned long long int __total_seq;
> -    __extension__ unsigned long long int __wakeup_seq;
> -    __extension__ unsigned long long int __woken_seq;
> -    void *__mutex;
> -    unsigned int __nwaiters;
> -    unsigned int __broadcast_seq;
> -  } __data;
> -  char __size[__SIZEOF_PTHREAD_COND_T];
> -  __extension__ long long int __align;
> -} pthread_cond_t;
>
>  typedef union
>  {
> diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/thread-shared-types.h b/sysdeps/unix/sysv/linux/powerpc/bits/thread-shared-types.h
> new file mode 100644
> index 0000000..e6b5d24
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/powerpc/bits/thread-shared-types.h
> @@ -0,0 +1,110 @@
> +/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +/* This header contains macros definition required for
> +   the declaration of pthread_mutex_t and pthread_cond_t,
> +   both needed by C11 types mtx_t and cnd_t. */
> +
> +#ifndef _BITS_THREAD_SHARED_TYPES_H
> +#define _BITS_THREAD_SHARED_TYPES_H    1
> +
> +#include <bits/wordsize.h>
> +
> +
> +#if __WORDSIZE == 64
> +# define __SIZEOF_PTHREAD_MUTEX_T 40
> +# define __SIZEOF_PTHREAD_COND_T 48
> +#else
> +# define __SIZEOF_PTHREAD_MUTEX_T 24
> +# define __SIZEOF_PTHREAD_COND_T 48
> +#endif
> +
> +#if __WORDSIZE == 64
> +typedef struct __pthread_internal_list
> +{
> +  struct __pthread_internal_list *__prev;
> +  struct __pthread_internal_list *__next;
> +} __pthread_list_t;
> +#else
> +typedef struct __pthread_internal_slist
> +{
> +  struct __pthread_internal_slist *__next;
> +} __pthread_slist_t;
> +#endif
> +
> +
> +/* Data structure for mutex handling. */
> +
> +struct __pthread_mutex_s
> +{
> +  int __lock;
> +  unsigned int __count;
> +  int __owner;
> +#if __WORDSIZE == 64
> +  unsigned int __nusers;
> +#endif
> +  /* KIND must stay at this position in the structure to maintain
> +     binary compatibility.  */
> +  int __kind;
> +#if __WORDSIZE == 64
> +  short __spins;
> +  short __elision;
> +  __pthread_list_t __list;
> +# define __PTHREAD_MUTEX_HAVE_PREV     1
> +# define __PTHREAD_SPINS             0, 0
> +#else
> +  unsigned int __nusers;
> +  __extension__ union
> +  {
> +    struct
> +    {
> +      short __espins;
> +      short __elision;
> +# define __spins __elision_data.__espins
> +# define __elision __elision_data.__elision
> +# define __PTHREAD_SPINS         { 0, 0 }
> +    } __elision_data;
> +    __pthread_slist_t __list;
> +  };
> +#endif
> +};
> +
> +# define __PTHREAD_MUTEX_T_CONTENT         \
> +  struct __pthread_mutex_s __data;         \
> +  char __size[__SIZEOF_PTHREAD_MUTEX_T];   \
> +  long int __align;
> +
> +
> +/* Data structure for conditional variable handling */
> +
> +#define __PTHREAD_COND_T_CONTENT                          \
> +  struct                                                  \
> +  {                                                       \
> +    int __lock;                                           \
> +    unsigned int __futex;                                 \
> +    __extension__ unsigned long long int __total_seq;     \
> +    __extension__ unsigned long long int __wakeup_seq;    \
> +    __extension__ unsigned long long int __woken_seq;     \
> +    void *__mutex;                                        \
> +    unsigned int __nwaiters;                              \
> +    unsigned int __broadcast_seq;                         \
> +  } __data;                                               \
> +  char __size[__SIZEOF_PTHREAD_COND_T];                   \
> +  __extension__ long long int __align;
> +
> +
> +#endif /* bits/thread-shared-types.h */
> diff --git a/sysdeps/x86/bits/pthreadtypes.h b/sysdeps/x86/bits/pthreadtypes.h
> index 4460615..1b7d567 100644
> --- a/sysdeps/x86/bits/pthreadtypes.h
> +++ b/sysdeps/x86/bits/pthreadtypes.h
> @@ -19,13 +19,12 @@
>  #define _BITS_PTHREADTYPES_H   1
>
>  #include <bits/wordsize.h>
> +#include <bits/pthreadtypes-common.h>
>
>  #ifdef __x86_64__
>  # if __WORDSIZE == 64
>  #  define __SIZEOF_PTHREAD_ATTR_T 56
> -#  define __SIZEOF_PTHREAD_MUTEX_T 40
>  #  define __SIZEOF_PTHREAD_MUTEXATTR_T 4
> -#  define __SIZEOF_PTHREAD_COND_T 48
>  #  define __SIZEOF_PTHREAD_CONDATTR_T 4
>  #  define __SIZEOF_PTHREAD_RWLOCK_T 56
>  #  define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
> @@ -33,9 +32,7 @@
>  #  define __SIZEOF_PTHREAD_BARRIERATTR_T 4
>  # else
>  #  define __SIZEOF_PTHREAD_ATTR_T 32
> -#  define __SIZEOF_PTHREAD_MUTEX_T 32
>  #  define __SIZEOF_PTHREAD_MUTEXATTR_T 4
> -#  define __SIZEOF_PTHREAD_COND_T 48
>  #  define __SIZEOF_PTHREAD_CONDATTR_T 4
>  #  define __SIZEOF_PTHREAD_RWLOCK_T 44
>  #  define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
> @@ -44,9 +41,7 @@
>  # endif
>  #else
>  # define __SIZEOF_PTHREAD_ATTR_T 36
> -# define __SIZEOF_PTHREAD_MUTEX_T 24
>  # define __SIZEOF_PTHREAD_MUTEXATTR_T 4
> -# define __SIZEOF_PTHREAD_COND_T 48
>  # define __SIZEOF_PTHREAD_CONDATTR_T 4
>  # define __SIZEOF_PTHREAD_RWLOCK_T 32
>  # define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
> @@ -71,61 +66,8 @@ typedef union pthread_attr_t pthread_attr_t;
>  #endif
>
>
> -#ifdef __x86_64__
> -typedef struct __pthread_internal_list
> -{
> -  struct __pthread_internal_list *__prev;
> -  struct __pthread_internal_list *__next;
> -} __pthread_list_t;
> -#else
> -typedef struct __pthread_internal_slist
> -{
> -  struct __pthread_internal_slist *__next;
> -} __pthread_slist_t;
> -#endif
> -
> -
>  /* Data structures for mutex handling.  The structure of the attribute
>     type is not exposed on purpose.  */
> -typedef union
> -{
> -  struct __pthread_mutex_s
> -  {
> -    int __lock;
> -    unsigned int __count;
> -    int __owner;
> -#ifdef __x86_64__
> -    unsigned int __nusers;
> -#endif
> -    /* KIND must stay at this position in the structure to maintain
> -       binary compatibility.  */
> -    int __kind;
> -#ifdef __x86_64__
> -    short __spins;
> -    short __elision;
> -    __pthread_list_t __list;
> -# define __PTHREAD_MUTEX_HAVE_PREV     1
> -/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> -# define __PTHREAD_SPINS             0, 0
> -#else
> -    unsigned int __nusers;
> -    __extension__ union
> -    {
> -      struct
> -      {
> -       short __espins;
> -       short __elision;
> -# define __spins __elision_data.__espins
> -# define __elision __elision_data.__elision
> -# define __PTHREAD_SPINS         { 0, 0 }
> -      } __elision_data;
> -      __pthread_slist_t __list;
> -    };
> -#endif
> -  } __data;
> -  char __size[__SIZEOF_PTHREAD_MUTEX_T];
> -  long int __align;
> -} pthread_mutex_t;
>
>  typedef union
>  {
> @@ -136,22 +78,6 @@ typedef union
>
>  /* Data structure for conditional variable handling.  The structure of
>     the attribute type is not exposed on purpose.  */
> -typedef union
> -{
> -  struct
> -  {
> -    int __lock;
> -    unsigned int __futex;
> -    __extension__ unsigned long long int __total_seq;
> -    __extension__ unsigned long long int __wakeup_seq;
> -    __extension__ unsigned long long int __woken_seq;
> -    void *__mutex;
> -    unsigned int __nwaiters;
> -    unsigned int __broadcast_seq;
> -  } __data;
> -  char __size[__SIZEOF_PTHREAD_COND_T];
> -  __extension__ long long int __align;
> -} pthread_cond_t;
>
>  typedef union
>  {
> diff --git a/sysdeps/x86/bits/thread-shared-types.h b/sysdeps/x86/bits/thread-shared-types.h
> new file mode 100644
> index 0000000..80a4933
> --- /dev/null
> +++ b/sysdeps/x86/bits/thread-shared-types.h
> @@ -0,0 +1,116 @@
> +/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +/* This header contains macros definition required for
> +   the declaration of pthread_mutex_t and pthread_cond_t,
> +   both needed by C11 types mtx_t and cnd_t. */
> +
> +#ifndef _BITS_THREAD_SHARED_TYPES_H
> +#define _BITS_THREAD_SHARED_TYPES_H      1
> +
> +#include <bits/wordsize.h>
> +
> +#ifdef __x86_64__
> +# if __WORDSIZE == 64
> +#  define __SIZEOF_PTHREAD_MUTEX_T 40
> +#  define __SIZEOF_PTHREAD_COND_T 48
> +# else
> +#  define __SIZEOF_PTHREAD_MUTEX_T 32
> +#  define __SIZEOF_PTHREAD_COND_T 48
> +# endif
> +#else
> +# define __SIZEOF_PTHREAD_MUTEX_T 24
> +# define __SIZEOF_PTHREAD_COND_T 48
> +#endif
> +
> +#ifdef __x86_64__
> +typedef struct __pthread_internal_list
> +{
> +  struct __pthread_internal_list *__prev;
> +  struct __pthread_internal_list *__next;
> +} __pthread_list_t;
> +#else
> +typedef struct __pthread_internal_slist
> +{
> +  struct __pthread_internal_slist *__next;
> +} __pthread_slist_t;
> +#endif
> +
> +
> +/* Data structure for mutex handling. */
> +
> +struct __pthread_mutex_s
> +{
> +  int __lock;
> +  unsigned int __count;
> +  int __owner;
> +#ifdef __x86_64__
> +  unsigned int __nusers;
> +#endif
> +  /* KIND must stay at this position in the structure to maintain
> +     binary compatibility.  */
> +  int __kind;
> +#ifdef __x86_64__
> +  short __spins;
> +  short __elision;
> +  __pthread_list_t __list;
> +# define __PTHREAD_MUTEX_HAVE_PREV     1
> +/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
> +# define __PTHREAD_SPINS             0, 0
> +#else
> +  unsigned int __nusers;
> +  __extension__ union
> +  {
> +    struct
> +    {
> +      short __espins;
> +      short __elision;
> +# define __spins __elision_data.__espins
> +# define __elision __elision_data.__elision
> +# define __PTHREAD_SPINS         { 0, 0 }
> +    } __elision_data;
> +    __pthread_slist_t __list;
> +  };
> +#endif
> +};
> +
> +
> +# define __PTHREAD_MUTEX_T_CONTENT            \
> +  struct __pthread_mutex_s __data;            \
> +  char __size[__SIZEOF_PTHREAD_MUTEX_T];      \
> +  long int __align;
> +
> +
> +/* Data structure for conditional variable handling */
> +
> +#define __PTHREAD_COND_T_CONTENT                          \
> +  struct                                                  \
> +  {                                                       \
> +    int __lock;                                           \
> +    unsigned int __futex;                                 \
> +    __extension__ unsigned long long int __total_seq;     \
> +    __extension__ unsigned long long int __wakeup_seq;    \
> +    __extension__ unsigned long long int __woken_seq;     \
> +    void *__mutex;                                        \
> +    unsigned int __nwaiters;                              \
> +    unsigned int __broadcast_seq;                         \
> +  } __data;                                               \
> +  char __size[__SIZEOF_PTHREAD_COND_T];                   \
> +  __extension__ long long int __align;
> +
> +
> +#endif /* bits/thread-shared-types.h */
> --
> 2.4.3



-- 
Juan Manuel Torres Palma.
Computer Science Student at Universidad de Granada.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]