@@ -27,6 +27,7 @@ headers := sys/utsname.h sys/times.h sys/wait.h sys/types.h unistd.h \
getopt.h bits/getopt_core.h bits/getopt_ext.h bits/getopt_posix.h \
bits/types.h bits/typesizes.h bits/pthreadtypes.h \
bits/pthreadtypes-arch.h bits/thread-shared-types.h \
+ bits/mutex-internal.h \
bits/posix1_lim.h bits/posix2_lim.h bits/posix_opt.h \
bits/local_lim.h tar.h bits/utsname.h bits/confname.h \
bits/waitflags.h bits/waitstatus.h sys/unistd.h sched.h \
@@ -41,13 +41,6 @@
#define __SIZEOF_PTHREAD_COND_T 48
#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
-/* Definitions for internal mutex struct. */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION 0
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0
-#define __PTHREAD_MUTEX_USE_UNION 0
-
#define __LOCK_ALIGNMENT
#define __ONCE_ALIGNMENT
@@ -29,13 +29,6 @@
#define __SIZEOF_PTHREAD_BARRIER_T 32
#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-/* Definitions for internal mutex struct. */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION 0
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0
-#define __PTHREAD_MUTEX_USE_UNION 0
-
#define __LOCK_ALIGNMENT
#define __ONCE_ALIGNMENT
new file mode 100644
@@ -0,0 +1,44 @@
+/* ARM internal mutex struct definitions.
+ Copyright (C) 2017 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/>. */
+
+#ifndef _THREAD_MUTEX_INTERNAL_H
+#define _THREAD_MUTEX_INTERNAL_H 1
+
+struct __pthread_mutex_s
+{
+ int __lock;
+ unsigned int __count;
+ int __owner;
+ /* KIND must stay at this position in the structure to maintain
+ binary compatibility with static initializers. */
+ int __kind;
+ unsigned int __nusers;
+ __extension__ union
+ {
+ int __spins;
+ __pthread_slist_t __list;
+ };
+};
+
+#define __PTHREAD_MUTEX_LOCK_ELISION 0
+#define __PTHREAD_MUTEX_HAVE_PREV 0
+
+#define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+ 0, 0, 0, __kind, 0, { 0 }
+
+#endif
@@ -30,13 +30,6 @@
#define __SIZEOF_PTHREAD_BARRIER_T 20
#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-/* Data structure for mutex handling. */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION 0
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1
-#define __PTHREAD_MUTEX_USE_UNION 1
-
#define __LOCK_ALIGNMENT
#define __ONCE_ALIGNMENT
new file mode 100644
@@ -0,0 +1,54 @@
+/* HPPA internal mutex struct definitions.
+ Copyright (C) 2017 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/>. */
+
+#ifndef _THREAD_MUTEX_INTERNAL_H
+#define _THREAD_MUTEX_INTERNAL_H 1
+
+struct __pthread_mutex_s
+{
+ int __lock __LOCK_ALIGNMENT;
+ unsigned int __count;
+ int __owner;
+ /* KIND must stay at this position in the structure to maintain
+ binary compatibility with static initializers. */
+ 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 __glibc_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 __glibc_reserved1;
+ int __glibc_reserved2;
+};
+
+#define __PTHREAD_MUTEX_LOCK_ELISION 0
+#define __PTHREAD_MUTEX_HAVE_PREV 0
+
+#define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+ 0, 0, 0, __kind, { 0, 0, 0, 0 }, 0, { 0 }, 0, 0
+
+#endif
@@ -40,17 +40,6 @@
#define __SIZEOF_PTHREAD_RWLOCK_T 64
#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
-/* The old 4-word 16-byte aligned lock. This is initalized
- to all ones by the Linuxthreads PTHREAD_MUTEX_INITIALIZER.
- Unused in NPTL. */
-#define __PTHREAD_COMPAT_PADDING_MID int __compat_padding[4];
-/* Two more words are left before the NPTL
- pthread_mutex_t is larger than Linuxthreads. */
-#define __PTHREAD_COMPAT_PADDING_END int __reserved[2];
-#define __PTHREAD_MUTEX_LOCK_ELISION 0
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1
-#define __PTHREAD_MUTEX_USE_UNION 1
-
#define __LOCK_ALIGNMENT __attribute__ ((__aligned__(16)))
#define __ONCE_ALIGNMENT
new file mode 100644
@@ -0,0 +1,41 @@
+/* Default internal mutex struct definitions. ia64 version.
+ Copyright (C) 2017 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/>. */
+
+#ifndef _THREAD_MUTEX_INTERNAL_H
+#define _THREAD_MUTEX_INTERNAL_H 1
+
+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 with static initializers. */
+ int __kind;
+ int __spins;
+ __pthread_list_t __list;
+};
+
+#define __PTHREAD_MUTEX_HAVE_PREV 1
+#define __PTHREAD_MUTEX_LOCK_ELISION 0
+
+#define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+ 0, 0, 0, 0, __kind, 0, { 0, 0 }
+
+#endif
@@ -29,13 +29,6 @@
#define __SIZEOF_PTHREAD_BARRIER_T 32
#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-/* Definitions for internal mutex struct. */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION 0
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0
-#define __PTHREAD_MUTEX_USE_UNION 0
-
#define __LOCK_ALIGNMENT
#define __ONCE_ALIGNMENT
new file mode 100644
@@ -0,0 +1,44 @@
+/* m68k internal mutex struct definitions.
+ Copyright (C) 2017 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/>. */
+
+#ifndef _THREAD_MUTEX_INTERNAL_H
+#define _THREAD_MUTEX_INTERNAL_H 1
+
+struct __pthread_mutex_s
+{
+ int __lock __LOCK_ALIGNMENT;
+ unsigned int __count;
+ int __owner;
+ /* KIND must stay at this position in the structure to maintain
+ binary compatibility with static initializers. */
+ int __kind;
+ unsigned int __nusers;
+ __extension__ union
+ {
+ int __spins;
+ __pthread_slist_t __list;
+ };
+};
+
+#define __PTHREAD_MUTEX_LOCK_ELISION 0
+#define __PTHREAD_MUTEX_HAVE_PREV 0
+
+#define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+ 0, 0, 0, __kind, 0, { 0 }
+
+#endif
@@ -31,13 +31,6 @@
#define __SIZEOF_PTHREAD_BARRIER_T 20
#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-/* Data structure for mutex handling. */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION 0
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1
-#define __PTHREAD_MUTEX_USE_UNION 1
-
#define __LOCK_ALIGNMENT __attribute__ ((__aligned__ (4)))
#define __ONCE_ALIGNMENT __attribute__ ((__aligned__ (4)))
new file mode 100644
@@ -0,0 +1,43 @@
+/* Microblaze internal mutex struct definitions.
+ Copyright (C) 2017 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/>. */
+
+#ifndef _THREAD_MUTEX_INTERNAL_H
+#define _THREAD_MUTEX_INTERNAL_H 1
+
+struct __pthread_mutex_s
+{
+ int __lock;
+ unsigned int __count;
+ int __owner;
+ /* KIND must stay at this position in the structure to maintain
+ binary compatibility with static initializers. */
+ int __kind;
+ unsigned int __nusers;
+ __extension__ union
+ {
+ int __spins;
+ __pthread_slist_t __list;
+ };
+};
+#define __PTHREAD_MUTEX_HAVE_PREV 0
+#define __PTHREAD_MUTEX_LOCK_ELISION 0
+
+#define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+ 0, 0, 0, __kind, 0, { 0 }
+
+#endif
@@ -31,13 +31,6 @@
# define __SIZEOF_PTHREAD_BARRIER_T 20
# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-/* Definitions for internal mutex struct. */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION 0
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1
-#define __PTHREAD_MUTEX_USE_UNION 1
-
#define __LOCK_ALIGNMENT
#define __ONCE_ALIGNMENT
new file mode 100644
@@ -0,0 +1,58 @@
+/* MIPS internal mutex struct definitions.
+ Copyright (C) 2017 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/>. */
+
+#ifndef _THREAD_MUTEX_INTERNAL_H
+#define _THREAD_MUTEX_INTERNAL_H 1
+
+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 with static initializers. */
+ 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;
+ };
+# define __PTHREAD_MUTEX_HAVE_PREV 0
+#endif
+};
+
+#define __PTHREAD_MUTEX_LOCK_ELISION 0
+
+#if _MIPS_SIM == _ABI64
+# define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+ 0, 0, 0, 0, __kind, 0, { 0, 0 }
+#else
+# define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+ 0, 0, 0, __kind, 0, { 0 }
+#endif
+
+#endif
new file mode 100644
@@ -0,0 +1,44 @@
+/* NIOS2 internal mutex struct definitions.
+ Copyright (C) 2017 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/>. */
+
+#ifndef _THREAD_MUTEX_INTERNAL_H
+#define _THREAD_MUTEX_INTERNAL_H 1
+
+struct __pthread_mutex_s
+{
+ int __lock;
+ unsigned int __count;
+ int __owner;
+ /* KIND must stay at this position in the structure to maintain
+ binary compatibility with static initializers. */
+ int __kind;
+ unsigned int __nusers;
+ __extension__ union
+ {
+ int __spins;
+ __pthread_slist_t __list;
+ };
+};
+
+#define __PTHREAD_MUTEX_LOCK_ELISION 0
+#define __PTHREAD_MUTEX_HAVE_PREV 0
+
+#define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+ 0, 0, 0, __kind, 0, { 0 }
+
+#endif
@@ -31,13 +31,6 @@
#define __SIZEOF_PTHREAD_BARRIER_T 20
#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-/* Data structure for mutex handling. */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION 0
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1
-#define __PTHREAD_MUTEX_USE_UNION 1
-
#define __LOCK_ALIGNMENT
#define __ONCE_ALIGNMENT
new file mode 100644
@@ -0,0 +1,43 @@
+/* Default internal mutex struct definitions. Linux version.
+ Copyright (C) 2017 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/>. */
+
+#ifndef _THREAD_MUTEX_INTERNAL_H
+#define _THREAD_MUTEX_INTERNAL_H 1
+
+/* This is the default defines for the 'struct __pthread_mutex_s' layout,
+ used for POSIX pthread_mutex_t definition. New ports are expected to
+ used the default layout. The struct will have size of 32 on LP32 and
+ 40 on LP64. */
+
+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
+#define __PTHREAD_MUTEX_LOCK_ELISION 0
+#define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+ 0, 0, 0, 0, __kind, 0, { 0, 0 }
+
+#endif
@@ -32,36 +32,6 @@
__SIZEOF_PTHREAD_BARRIER_T - size of pthread_barrier_t.
__SIZEOF_PTHREAD_BARRIERATTR_T - size of pthread_barrierattr_t.
- Also, the following macros must be define for internal pthread_mutex_t
- struct definitions (struct __pthread_mutex_s):
-
- __PTHREAD_COMPAT_PADDING_MID - any additional members after 'kind'
- and before '__spin' (for 64 bits) or
- '__nusers' (for 32 bits).
- __PTHREAD_COMPAT_PADDING_END - any additional members at the end of
- the internal structure.
- __PTHREAD_MUTEX_LOCK_ELISION - 1 if the architecture supports lock
- elision or 0 otherwise.
- __PTHREAD_MUTEX_NUSERS_AFTER_KIND - control where to put __nusers. The
- preferred value for new architectures
- is 0.
- __PTHREAD_MUTEX_USE_UNION - control whether internal __spins and
- __list will be place inside a union for
- linuxthreads compatibility.
- The preferred value for new architectures
- is 0.
-
- For a new port the preferred values for the required defines are:
-
- #define __PTHREAD_COMPAT_PADDING_MID
- #define __PTHREAD_COMPAT_PADDING_END
- #define __PTHREAD_MUTEX_LOCK_ELISION 0
- #define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0
- #define __PTHREAD_MUTEX_USE_UNION 0
-
- __PTHREAD_MUTEX_LOCK_ELISION can be set to 1 if the hardware plans to
- eventually support lock elision using transactional memory.
-
The additional macro defines any constraint for the lock alignment
inside the thread structures:
@@ -72,78 +42,46 @@
__ONCE_ALIGNMENT - for pthread_once_t/once_flag definition.
And finally the internal pthread_rwlock_t (struct __pthread_rwlock_arch_t)
- must be defined.
- */
+ must be defined. */
+
#include <bits/pthreadtypes-arch.h>
+
/* Common definition of pthread_mutex_t. */
-#if !__PTHREAD_MUTEX_USE_UNION
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
-
-/* Lock elision support. */
-#if __PTHREAD_MUTEX_LOCK_ELISION
-# if !__PTHREAD_MUTEX_USE_UNION
-# define __PTHREAD_SPINS_DATA \
- short __spins; \
- short __elision
-# define __PTHREAD_SPINS 0, 0
-# else
-# define __PTHREAD_SPINS_DATA \
- struct \
- { \
- short __espins; \
- short __eelision; \
- } __elision_data
-# define __PTHREAD_SPINS { 0, 0 }
-# define __spins __elision_data.__espins
-# define __elision __elision_data.__eelision
-# endif
-#else
-# define __PTHREAD_SPINS_DATA int __spins
-/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER. */
-# define __PTHREAD_SPINS 0
-#endif
-
-struct __pthread_mutex_s
-{
- int __lock __LOCK_ALIGNMENT;
- unsigned int __count;
- int __owner;
-#if !__PTHREAD_MUTEX_NUSERS_AFTER_KIND
- unsigned int __nusers;
-#endif
- /* KIND must stay at this position in the structure to maintain
- binary compatibility with static initializers. */
- int __kind;
- __PTHREAD_COMPAT_PADDING_MID
-#if __PTHREAD_MUTEX_NUSERS_AFTER_KIND
- unsigned int __nusers;
-#endif
-#if !__PTHREAD_MUTEX_USE_UNION
- __PTHREAD_SPINS_DATA;
- __pthread_list_t __list;
-# define __PTHREAD_MUTEX_HAVE_PREV 1
-#else
- __extension__ union
- {
- __PTHREAD_SPINS_DATA;
- __pthread_slist_t __list;
- };
-# define __PTHREAD_MUTEX_HAVE_PREV 0
-#endif
- __PTHREAD_COMPAT_PADDING_END
-};
+
+/* Arch-specific mutex definitions. A generic implementation is provided
+ by sysdeps/nptl/bits/mutex-internal.h. If required, an architecture
+ can override it by defining:
+
+ 1. struct __pthread_mutex_s (used on pthread_mutex_t definition). It
+ should contain at least the internal members defined in the generic
+ version.
+
+ 2. __PTHREAD_MUTEX_HAVE_PREV to either 1 if __pthread_mutex_s defines
+ the double-linked list __pthread_internal_list, or 0 if it uses
+ the single-linked list __pthread_internal_slist. They are used on
+ robust mutex implementation and the double-linked trades memory
+ usage for a faster insertion and removal.
+
+ 3. __PTHREAD_MUTEX_LOCK_ELISION to either 1 if architecture supports
+ hardware lock elision and actually uses the __elision member or
+ 0 otherwise.
+
+ 4. __PTHREAD_MUTEX_INITIALIZER macro used for static initialization.
+ It should initialize the mutex internal type. */
+
+#include <bits/mutex-internal.h>
/* Common definition of pthread_cond_t. */
@@ -84,30 +84,15 @@ enum
#endif
-#if __PTHREAD_MUTEX_HAVE_PREV
-# define PTHREAD_MUTEX_INITIALIZER \
- { { 0, 0, 0, 0, 0, __PTHREAD_SPINS, { 0, 0 } } }
-# ifdef __USE_GNU
-# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, __PTHREAD_SPINS, { 0, 0 } } }
-# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, __PTHREAD_SPINS, { 0, 0 } } }
-# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, __PTHREAD_SPINS, { 0, 0 } } }
-
-# endif
-#else
-# define PTHREAD_MUTEX_INITIALIZER \
- { { 0, 0, 0, 0, 0, { __PTHREAD_SPINS } } }
-# ifdef __USE_GNU
-# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, 0, { __PTHREAD_SPINS } } }
-# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, 0, { __PTHREAD_SPINS } } }
-# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, 0, { __PTHREAD_SPINS } } }
-
-# endif
+#define PTHREAD_MUTEX_INITIALIZER \
+ { { __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_DEFAULT) } }
+#ifdef __USE_GNU
+# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
+ { { __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_RECURSIVE_NP) } }
+# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
+ { { __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_ERRORCHECK_NP) } }
+# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \
+ { { __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_ADAPTIVE_NP) } }
#endif
new file mode 100644
@@ -0,0 +1,64 @@
+/* PowerPC internal mutex struct definitions.
+ Copyright (C) 2017 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/>. */
+
+#ifndef _THREAD_MUTEX_INTERNAL_H
+#define _THREAD_MUTEX_INTERNAL_H 1
+
+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 with static initializers. */
+ int __kind;
+#if __WORDSIZE == 64
+ short __spins;
+ short __elision;
+ __pthread_list_t __list;
+# define __PTHREAD_MUTEX_HAVE_PREV 1
+#else
+ unsigned int __nusers;
+ __extension__ union
+ {
+ struct
+ {
+ short __espins;
+ short __elision;
+# define __spins __elision_data.__espins
+# define __elision __elision_data.__elision
+ } __elision_data;
+ __pthread_slist_t __list;
+ };
+# define __PTHREAD_MUTEX_HAVE_PREV 0
+#endif
+};
+#define __PTHREAD_MUTEX_LOCK_ELISION 1
+
+#if __WORDSIZE == 64
+# define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+ 0, 0, 0, 0, __kind, 0, 0, { 0, 0 }
+#else
+# define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+ 0, 0, 0, __kind, 0, { { 0, 0 } }
+#endif
+
+#endif
@@ -38,13 +38,6 @@
#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-/* Definitions for internal mutex struct. */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION 1
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND (__WORDSIZE != 64)
-#define __PTHREAD_MUTEX_USE_UNION (__WORDSIZE != 64)
-
#define __LOCK_ALIGNMENT
#define __ONCE_ALIGNMENT
new file mode 100644
@@ -0,0 +1,65 @@
+/* S390 internal mutex struct definitions.
+ Copyright (C) 2017 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/>. */
+
+#ifndef _THREAD_MUTEX_INTERNAL_H
+#define _THREAD_MUTEX_INTERNAL_H 1
+
+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 with static initializers. */
+ int __kind;
+#if __WORDSIZE == 64
+ short __spins;
+ short __elision;
+ __pthread_list_t __list;
+# define __PTHREAD_MUTEX_HAVE_PREV 1
+#else
+ unsigned int __nusers;
+ __extension__ union
+ {
+ struct
+ {
+ short __espins;
+ short __elision;
+ } _d;
+# define __spins _d.__espins
+# define __elision _d.__elision
+ __pthread_slist_t __list;
+ };
+# define __PTHREAD_MUTEX_HAVE_PREV 0
+#endif
+};
+
+#define __PTHREAD_MUTEX_LOCK_ELISION 1
+
+#if __WORDSIZE == 64
+# define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+ 0, 0, 0, 0, __kind, 0, 0, { 0, 0 }
+#else
+# define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+ 0, 0, 0, __kind, 0, { { 0, 0 } }
+#endif
+
+#endif
@@ -37,13 +37,6 @@
#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-/* Definitions for internal mutex struct. */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION 1
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND (__WORDSIZE != 64)
-#define __PTHREAD_MUTEX_USE_UNION (__WORDSIZE != 64)
-
#define __LOCK_ALIGNMENT
#define __ONCE_ALIGNMENT
new file mode 100644
@@ -0,0 +1,43 @@
+/* SH internal mutex struct definitions.
+ Copyright (C) 2017 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/>. */
+
+#ifndef _THREAD_MUTEX_INTERNAL_H
+#define _THREAD_MUTEX_INTERNAL_H 1
+
+struct __pthread_mutex_s
+{
+ int __lock;
+ unsigned int __count;
+ int __owner;
+ /* KIND must stay at this position in the structure to maintain
+ binary compatibility with static initializers. */
+ int __kind;
+ unsigned int __nusers;
+ __extension__ union
+ {
+ int __spins;
+ __pthread_slist_t __list;
+ };
+};
+#define __PTHREAD_MUTEX_LOCK_ELISION 0
+#define __PTHREAD_MUTEX_HAVE_PREV 0
+
+#define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+ 0, 0, 0, __kind, 0, { 0 }
+
+#endif
@@ -30,13 +30,6 @@
#define __SIZEOF_PTHREAD_BARRIER_T 20
#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-/* Definitions for internal mutex struct. */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION 0
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1
-#define __PTHREAD_MUTEX_USE_UNION 1
-
#define __LOCK_ALIGNMENT
#define __ONCE_ALIGNMENT
new file mode 100644
@@ -0,0 +1,59 @@
+/* SPARC internal mutex struct definitions.
+ Copyright (C) 2017 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/>. */
+
+#ifndef _THREAD_MUTEX_INTERNAL_H
+#define _THREAD_MUTEX_INTERNAL_H 1
+
+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 with static initializers. */
+ 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;
+ };
+# define __PTHREAD_MUTEX_HAVE_PREV 0
+#endif
+};
+
+#define __PTHREAD_MUTEX_LOCK_ELISION 0
+
+
+#if __WORDSIZE == 64
+# define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+ 0, 0, 0, 0, __kind, 0, { 0, 0 }
+#else
+# define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+ 0, 0, 0, __kind, 0, { 0 }
+#endif
+
+#endif
@@ -39,13 +39,6 @@
#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-/* Definitions for internal mutex struct. */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION 0
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND (__WORDSIZE != 64)
-#define __PTHREAD_MUTEX_USE_UNION (__WORDSIZE != 64)
-
#define __LOCK_ALIGNMENT
#define __ONCE_ALIGNMENT
new file mode 100644
@@ -0,0 +1,57 @@
+/* Microblaze internal mutex struct definitions.
+ Copyright (C) 2017 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/>. */
+
+#ifndef _THREAD_MUTEX_INTERNAL_H
+#define _THREAD_MUTEX_INTERNAL_H 1
+
+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 with static initializers. */
+ 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;
+ };
+# define __PTHREAD_MUTEX_HAVE_PREV 0
+#endif
+};
+#define __PTHREAD_MUTEX_LOCK_ELISION 0
+
+#if __WORDSIZE == 64
+# define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+ 0, 0, 0, 0, __kind, 0, { 0, 0 }
+#else
+# define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+ 0, 0, 0, __kind, 0, { 0 }
+#endif
+
+#endif
@@ -39,13 +39,6 @@
#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-/* Data structure for mutex handling. */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION 0
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND (__WORDSIZE != 64)
-#define __PTHREAD_MUTEX_USE_UNION (__WORDSIZE != 64)
-
#define __LOCK_ALIGNMENT
#define __ONCE_ALIGNMENT
@@ -85,17 +85,14 @@ enum
#define PTHREAD_MUTEX_INITIALIZER \
- { { 0, 0, 0, 0, { 0, 0, 0, 0 }, 0, { __PTHREAD_SPINS }, { 0, 0 } } }
+ { { __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_DEFAULT) } }
#ifdef __USE_GNU
# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, { 0, 0, 0, 0 }, 0, \
- { __PTHREAD_SPINS }, { 0, 0 } } }
+ { { __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_RECURSIVE_NP) } }
# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, { 0, 0, 0, 0 }, 0, \
- { __PTHREAD_SPINS }, { 0, 0 } } }
+ { { __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_ERRORCHECK_NP) } }
# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, { 0, 0, 0, 0 }, 0, \
- { __PTHREAD_SPINS }, { 0, 0 } } }
+ { { __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_ADAPTIVE_NP) } }
#endif
new file mode 100644
@@ -0,0 +1,65 @@
+/* x86 internal mutex struct definitions.
+ Copyright (C) 2017 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/>. */
+
+#ifndef _THREAD_MUTEX_INTERNAL_H
+#define _THREAD_MUTEX_INTERNAL_H 1
+
+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 with static initializers. */
+ int __kind;
+#ifdef __x86_64__
+ short __spins;
+ short __elision;
+ __pthread_list_t __list;
+# define __PTHREAD_MUTEX_HAVE_PREV 1
+#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;
+ };
+# define __PTHREAD_MUTEX_HAVE_PREV 0
+#endif
+};
+#define __PTHREAD_MUTEX_LOCK_ELISION 0
+
+#ifdef __x86_64__
+# define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+ 0, 0, 0, 0, __kind, 0, 0, { 0, 0 }
+#else
+# define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+ 0, 0, 0, __kind, 0, { { 0, 0 } }
+#endif
+
+#endif
@@ -47,18 +47,6 @@
#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-/* Definitions for internal mutex struct. */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION 1
-#ifdef __x86_64__
-# define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0
-# define __PTHREAD_MUTEX_USE_UNION 0
-#else
-# define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1
-# define __PTHREAD_MUTEX_USE_UNION 1
-#endif
-
#define __LOCK_ALIGNMENT
#define __ONCE_ALIGNMENT
The current way of adding different flags and place a common definition at sysdeps/nptl/bits/thread-shared-types.h for internal pthread_mutex_t struct is not really the simpler option for new ports: it requires some misleading flags that shouldn't be defined any way (__PTHREAD_COMPAT_PADDING_MID and __PTHREAD_COMPAT_PADDING_END), it gives an option used solely for linuxthread compat mode that removes the possibility of using adaptive robust mutexes (__PTHREAD_MUTEX_USE_UNION), and add a flag (__PTHREAD_MUTEX_NUSERS_AFTER_KIND) that only exists for compatibility reason. Instead this patch adds a new architecture define header meant for internal pthread_mutex_t type (__pthread_mutex_s) layout definition. The idea is to simplify new ports inclusion by providing a default generic interface. The definions for __pthread_mutex_s internal layout compat mode (__PTHREAD_COMPAT_PADDING_MID, __PTHREAD_COMPAT_PADDING_END, __PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION) are removed and the internal pthread type (__pthread_mutex_s) is move from pthreadtypes-arch.h to mutex-internal.h. Also the static intialization macro for pthread_mutex_t is set to use an arch defined on (__PTHREAD_MUTEX_INITIALIZER) which simplifies its implementation. The default pthread_mutex_t layout differs from current ports with: 1. The internal layout is the same for both 32 bits and 64 bits. 2. The __spins and __list is not an union for 32 bits. It allows adaptive mutexes to work with robust attribute. Current code does not support for 32 bits it due mutex struct size limitation for compatibility with linuxthreads. 3. It uses a double linked list for robust internal list. It allows faster insertion and removals at the cost of slight more memory usage. Checked with a build on affected abis (alpha-linux-gnu, armv7-linux-gnueabihf, hppa-linux-gnu, ia64-linux-gnu, i686-linux-gnu, m68k-linux-gnu, microblaze-linux-gnu, nios2-linux-gnu, powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sh4-linux-gnu, sparc{v9,64}-linux-gnu, tile{pro,gx64}-linux-gnu, x86_64-linux-gnu). * posix/Makefile (headers): Add mutex-internal.h. * sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h (__PTHREAD_COMPAT_PADDING_MID, __PTHREAD_COMPAT_PADDING_END, __PTHREAD_MUTEX_LOCK_ELISION, __PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): Move to mutex-interal.h. * sysdeps/alpha/nptl/bits/pthreadtypes-arch.h: Likewise. * sysdeps/arm/nptl/bits/pthreadtypes-arch.h: Likewise. * sysdeps/hppa/nptl/bits/pthreadtypes-arch.h: Likewise. * sysdeps/ia64/nptl/bits/pthreadtypes-arch.h: Likewise. * sysdeps/m68k/nptl/bits/pthreadtypes-arch.h: Likewise. * sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h: Likewise. * sysdeps/nios2/nptl/bits/pthreadtypes-arch.h: Likewise. * sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h: Likewise. * sysdeps/s390/nptl/bits/pthreadtypes-arch.h: Likewise. * sysdeps/sh/nptl/bits/pthreadtypes-arch.h: Likewise. * sysdeps/sparc/nptl/bits/pthreadtypes-arch.h: Likewise. * sysdeps/tile/nptl/bits/pthreadtypes-arch.h: Likewise. * sysdeps/x86/nptl/bits/pthreadtypes-arch.h: Likewise. * sysdeps/arm/nptl/bits/mutex-internal.h: New file. * sysdeps/hppa/nptl/bits/mutex-internal.h: Likewise. * sysdeps/m68k/nptl/bits/mutex-internal.h: Likewise. * sysdeps/microblaze/nptl/bits/mutex-internal.h: Likewise. * sysdeps/mips/nptl/bits/mutex-internal.h: Likewise. * sysdeps/nios2/nptl/bits/mutex-internal.h: Likewise. * sysdeps/nptl/bits/mutex-internal.h: Likewise. * sysdeps/powerpc/nptl/bits/mutex-internal.h: Likewise. * sysdeps/s390/nptl/bits/mutex-internal.h: Likewise. * sysdeps/sh/nptl/bits/mutex-internal.h: Likewise. * sysdeps/sparc/nptl/bits/mutex-internal.h: Likewise. * sysdeps/tile/nptl/bits/mutex-internal.h: Likewise. * sysdeps/x86/nptl/bits/mutex-internal.h: Likewise. * sysdeps/nptl/bits/thread-shared-types.h: Include mutex-internal.h. * sysdeps/nptl/pthread.h (PTHREAD_MUTEX_INITIALIZER, PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP, PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP, PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP): Implement based on arch specific __PTHREAD_MUTEX_INITIALIZER macro. * sysdeps/unix/sysv/linux/hppa/pthread.h: Likewise. Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> --- ChangeLog | 41 ++++++++ posix/Makefile | 1 + sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h | 7 -- sysdeps/alpha/nptl/bits/pthreadtypes-arch.h | 7 -- sysdeps/arm/nptl/bits/mutex-internal.h | 44 +++++++++ sysdeps/arm/nptl/bits/pthreadtypes-arch.h | 7 -- sysdeps/hppa/nptl/bits/mutex-internal.h | 54 +++++++++++ sysdeps/hppa/nptl/bits/pthreadtypes-arch.h | 11 --- sysdeps/ia64/nptl/bits/mutex-internal.h | 41 ++++++++ sysdeps/ia64/nptl/bits/pthreadtypes-arch.h | 7 -- sysdeps/m68k/nptl/bits/mutex-internal.h | 44 +++++++++ sysdeps/m68k/nptl/bits/pthreadtypes-arch.h | 7 -- sysdeps/microblaze/nptl/bits/mutex-internal.h | 43 +++++++++ sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h | 7 -- sysdeps/mips/nptl/bits/mutex-internal.h | 58 ++++++++++++ sysdeps/nios2/nptl/bits/mutex-internal.h | 44 +++++++++ sysdeps/nios2/nptl/bits/pthreadtypes-arch.h | 7 -- sysdeps/nptl/bits/mutex-internal.h | 43 +++++++++ sysdeps/nptl/bits/thread-shared-types.h | 116 ++++++----------------- sysdeps/nptl/pthread.h | 33 ++----- sysdeps/powerpc/nptl/bits/mutex-internal.h | 64 +++++++++++++ sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h | 7 -- sysdeps/s390/nptl/bits/mutex-internal.h | 65 +++++++++++++ sysdeps/s390/nptl/bits/pthreadtypes-arch.h | 7 -- sysdeps/sh/nptl/bits/mutex-internal.h | 43 +++++++++ sysdeps/sh/nptl/bits/pthreadtypes-arch.h | 7 -- sysdeps/sparc/nptl/bits/mutex-internal.h | 59 ++++++++++++ sysdeps/sparc/nptl/bits/pthreadtypes-arch.h | 7 -- sysdeps/tile/nptl/bits/mutex-internal.h | 57 +++++++++++ sysdeps/tile/nptl/bits/pthreadtypes-arch.h | 7 -- sysdeps/unix/sysv/linux/hppa/pthread.h | 11 +-- sysdeps/x86/nptl/bits/mutex-internal.h | 65 +++++++++++++ sysdeps/x86/nptl/bits/pthreadtypes-arch.h | 12 --- 33 files changed, 806 insertions(+), 227 deletions(-) create mode 100644 sysdeps/arm/nptl/bits/mutex-internal.h create mode 100644 sysdeps/hppa/nptl/bits/mutex-internal.h create mode 100644 sysdeps/ia64/nptl/bits/mutex-internal.h create mode 100644 sysdeps/m68k/nptl/bits/mutex-internal.h create mode 100644 sysdeps/microblaze/nptl/bits/mutex-internal.h create mode 100644 sysdeps/mips/nptl/bits/mutex-internal.h create mode 100644 sysdeps/nios2/nptl/bits/mutex-internal.h create mode 100644 sysdeps/nptl/bits/mutex-internal.h create mode 100644 sysdeps/powerpc/nptl/bits/mutex-internal.h create mode 100644 sysdeps/s390/nptl/bits/mutex-internal.h create mode 100644 sysdeps/sh/nptl/bits/mutex-internal.h create mode 100644 sysdeps/sparc/nptl/bits/mutex-internal.h create mode 100644 sysdeps/tile/nptl/bits/mutex-internal.h create mode 100644 sysdeps/x86/nptl/bits/mutex-internal.h -- 2.7.4