new file mode 100644
@@ -0,0 +1,36 @@
+/* Common thread definition for pthread and c11 threads. Generic 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/>. */
+
+/* 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. */
@@ -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 \
- spawn.h bits/unistd.h
+ spawn.h bits/unistd.h \
+ bits/thread-shared-types.h bits/pthreadtypes-common.h
routines := \
uname \
@@ -20,12 +20,11 @@
#define _BITS_PTHREADTYPES_H 1
#include <endian.h>
+#include <bits/pthreadtypes-common.h>
#ifdef __ILP32__
# 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_COND_COMPAT_T 48
# define __SIZEOF_PTHREAD_CONDATTR_T 4
# define __SIZEOF_PTHREAD_RWLOCK_T 48
@@ -34,9 +33,7 @@
# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
#else
# 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
@@ -62,36 +59,6 @@ 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;
- /* 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
- } __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
{
@@ -100,38 +67,6 @@ typedef union
} pthread_mutexattr_t;
-/* Data structure for conditional variable handling. The structure of
- the attribute type is not exposed on purpose. */
-typedef union
-{
- struct
- {
- __extension__ union
- {
- __extension__ unsigned long long int __wseq;
- struct {
- unsigned int __low;
- unsigned int __high;
- } __wseq32;
- };
- __extension__ union
- {
- __extension__ unsigned long long int __g1_start;
- struct {
- unsigned int __low;
- unsigned int __high;
- } __g1_start32;
- };
- unsigned int __g_refs[2];
- unsigned int __g_size[2];
- unsigned int __g1_orig_size;
- unsigned int __wrefs;
- unsigned int __g_signals[2];
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-} pthread_cond_t;
-
typedef union
{
char __size[__SIZEOF_PTHREAD_CONDATTR_T];
new file mode 100644
@@ -0,0 +1,94 @@
+/* Common thread definition for pthread and c11 threads. Linux/AArch64
+ 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/>. */
+
+/* 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
+
+#ifdef __ILP32__
+# define __SIZEOF_PTHREAD_MUTEX_T 32
+#else
+# define __SIZEOF_PTHREAD_MUTEX_T 48
+#endif
+#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 \
+ { \
+ __extension__ union \
+ { \
+ __extension__ unsigned long long int __wseq; \
+ struct { \
+ unsigned int __low; \
+ unsigned int __high; \
+ } __wseq32; \
+ }; \
+ __extension__ union \
+ { \
+ __extension__ unsigned long long int __g1_start; \
+ struct { \
+ unsigned int __low; \
+ unsigned int __high; \
+ } __g1_start32; \
+ }; \
+ unsigned int __g_refs[2]; \
+ unsigned int __g_size[2]; \
+ unsigned int __g1_orig_size; \
+ unsigned int __wrefs; \
+ unsigned int __g_signals[2]; \
+ } __data; \
+ char __size[__SIZEOF_PTHREAD_COND_T]; \
+ __extension__ long long int __align;
+
+#endif
@@ -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,39 +45,10 @@ 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 with static initializers. */
- 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
-{
char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
int __align;
} pthread_mutexattr_t;
@@ -87,36 +58,6 @@ typedef union
the attribute type is not exposed on purpose. */
typedef union
{
- struct
- {
- __extension__ union
- {
- __extension__ unsigned long long int __wseq;
- struct {
- unsigned int __low;
- unsigned int __high;
- } __wseq32;
- };
- __extension__ union
- {
- __extension__ unsigned long long int __g1_start;
- struct {
- unsigned int __low;
- unsigned int __high;
- } __g1_start32;
- };
- unsigned int __g_refs[2];
- unsigned int __g_size[2];
- unsigned int __g1_orig_size;
- unsigned int __wrefs;
- unsigned int __g_signals[2];
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
char __size[__SIZEOF_PTHREAD_CONDATTR_T];
int __align;
} pthread_condattr_t;
new file mode 100644
@@ -0,0 +1,90 @@
+/* Common thread definition for pthread and c11 threads. Linux/alpha
+ 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/>. */
+
+/* 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 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;
+
+
+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
+};
+
+/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER. */
+#define __PTHREAD_SPINS 0
+
+#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 \
+ { \
+ __extension__ union \
+ { \
+ __extension__ unsigned long long int __wseq; \
+ struct { \
+ unsigned int __low; \
+ unsigned int __high; \
+ } __wseq32; \
+ }; \
+ __extension__ union \
+ { \
+ __extension__ unsigned long long int __g1_start; \
+ struct { \
+ unsigned int __low; \
+ unsigned int __high; \
+ } __g1_start32; \
+ }; \
+ unsigned int __g_refs[2]; \
+ unsigned int __g_size[2]; \
+ unsigned int __g1_orig_size; \
+ unsigned int __wrefs; \
+ unsigned int __g_signals[2]; \
+ } __data; \
+ char __size[__SIZEOF_PTHREAD_COND_T]; \
+ __extension__ long long int __align;
+
+#endif
@@ -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,38 +47,6 @@ 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 with static initializers. */
- 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
{
char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
@@ -87,38 +54,6 @@ typedef union
} pthread_mutexattr_t;
-/* Data structure for conditional variable handling. The structure of
- the attribute type is not exposed on purpose. */
-typedef union
-{
- struct
- {
- __extension__ union
- {
- __extension__ unsigned long long int __wseq;
- struct {
- unsigned int __low;
- unsigned int __high;
- } __wseq32;
- };
- __extension__ union
- {
- __extension__ unsigned long long int __g1_start;
- struct {
- unsigned int __low;
- unsigned int __high;
- } __g1_start32;
- };
- unsigned int __g_refs[2];
- unsigned int __g_size[2];
- unsigned int __g1_orig_size;
- unsigned int __wrefs;
- unsigned int __g_signals[2];
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-} pthread_cond_t;
-
typedef union
{
char __size[__SIZEOF_PTHREAD_CONDATTR_T];
new file mode 100644
@@ -0,0 +1,92 @@
+/* Common thread definition for pthread and c11 threads. Linux/arm
+ 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/>. */
+
+/* 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 \
+ { \
+ __extension__ union \
+ { \
+ __extension__ unsigned long long int __wseq; \
+ struct { \
+ unsigned int __low; \
+ unsigned int __high; \
+ } __wseq32; \
+ }; \
+ __extension__ union \
+ { \
+ __extension__ unsigned long long int __g1_start; \
+ struct { \
+ unsigned int __low; \
+ unsigned int __high; \
+ } __g1_start32; \
+ }; \
+ unsigned int __g_refs[2]; \
+ unsigned int __g_size[2]; \
+ unsigned int __g1_orig_size; \
+ unsigned int __wrefs; \
+ unsigned int __g_signals[2]; \
+ } __data; \
+ char __size[__SIZEOF_PTHREAD_COND_T]; \
+ __extension__ long long int __align;
+
+#endif
@@ -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
@@ -55,48 +55,6 @@ 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 __attribute__ ((__aligned__(16)));
- 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 __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];
@@ -104,43 +62,6 @@ typedef union
} pthread_mutexattr_t;
-/* Data structure for conditional variable handling. The structure of
- the attribute type is not exposed on purpose. However, this structure
- is exposed via PTHREAD_COND_INITIALIZER, and because of this, the
- Linuxthreads version sets the first four ints to one. In the NPTL
- 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
{
char __size[__SIZEOF_PTHREAD_CONDATTR_T];
new file mode 100644
@@ -0,0 +1,102 @@
+/* Common thread definition for pthread and c11 threads. Linux/HPPA
+ 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/>. */
+
+/* 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
@@ -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,37 +46,6 @@ 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 with static initializers. */
- 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
{
char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
@@ -84,38 +53,6 @@ typedef union
} pthread_mutexattr_t;
-/* Data structure for conditional variable handling. The structure of
- the attribute type is not exposed on purpose. */
-typedef union
-{
- struct
- {
- __extension__ union
- {
- __extension__ unsigned long long int __wseq;
- struct {
- unsigned int __low;
- unsigned int __high;
- } __wseq32;
- };
- __extension__ union
- {
- __extension__ unsigned long long int __g1_start;
- struct {
- unsigned int __low;
- unsigned int __high;
- } __g1_start32;
- };
- unsigned int __g_refs[2];
- unsigned int __g_size[2];
- unsigned int __g1_orig_size;
- unsigned int __wrefs;
- unsigned int __g_signals[2];
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-} pthread_cond_t;
-
typedef union
{
char __size[__SIZEOF_PTHREAD_CONDATTR_T];
new file mode 100644
@@ -0,0 +1,92 @@
+/* Common thread definition for pthread and c11 threads. Linux/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/>. */
+
+/* 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 \
+ { \
+ __extension__ union \
+ { \
+ __extension__ unsigned long long int __wseq; \
+ struct { \
+ unsigned int __low; \
+ unsigned int __high; \
+ } __wseq32; \
+ }; \
+ __extension__ union \
+ { \
+ __extension__ unsigned long long int __g1_start; \
+ struct { \
+ unsigned int __low; \
+ unsigned int __high; \
+ } __g1_start32; \
+ }; \
+ unsigned int __g_refs[2]; \
+ unsigned int __g_size[2]; \
+ unsigned int __g1_orig_size; \
+ unsigned int __wrefs; \
+ unsigned int __g_signals[2]; \
+ } __data; \
+ char __size[__SIZEOF_PTHREAD_COND_T]; \
+ __extension__ long long int __align;
+
+
+#endif
@@ -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,38 +47,6 @@ 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 with static initializers. */
- 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
{
char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
@@ -87,39 +54,6 @@ typedef union
} pthread_mutexattr_t;
-/* Data structure for conditional variable handling. The structure of
- the attribute type is not exposed on purpose. */
-typedef union
-{
- struct
- {
- __extension__ union
- {
- __extension__ unsigned long long int __wseq;
- struct {
- unsigned int __low;
- unsigned int __high;
- } __wseq32;
- };
- __extension__ union
- {
- __extension__ unsigned long long int __g1_start;
- struct {
- unsigned int __low;
- unsigned int __high;
- } __g1_start32;
- };
- /* Enforce proper alignment of fields used as futex words. */
- unsigned int __g_refs[2] __attribute__ ((__aligned__ (4)));
- unsigned int __g_size[2];
- unsigned int __g1_orig_size;
- unsigned int __wrefs;
- unsigned int __g_signals[2];
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-} pthread_cond_t;
-
typedef union
{
char __size[__SIZEOF_PTHREAD_CONDATTR_T];
new file mode 100644
@@ -0,0 +1,97 @@
+/* Common thread definition for pthread and c11 threads. Linux/m68k
+ 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/>. */
+
+/* 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 */
+
+/* Enforce proper alignment of field (starting from __g_refs) used as futex
+ words. */
+#define __PTHREAD_COND_T_CONTENT \
+ struct \
+ { \
+ __extension__ union \
+ { \
+ __extension__ unsigned long long int __wseq; \
+ struct { \
+ unsigned int __low; \
+ unsigned int __high; \
+ } __wseq32; \
+ }; \
+ __extension__ union \
+ { \
+ __extension__ unsigned long long int __g1_start; \
+ struct { \
+ unsigned int __low; \
+ unsigned int __high; \
+ } __g1_start32; \
+ }; \
+ unsigned int __g_refs[2] __attribute__ ((__aligned__ (4))); \
+ unsigned int __g_size[2]; \
+ unsigned int __g1_orig_size; \
+ unsigned int __wrefs; \
+ unsigned int __g_signals[2]; \
+ } __data; \
+ char __size[__SIZEOF_PTHREAD_COND_T]; \
+ __extension__ long long int __align;
+
+
+#endif
@@ -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,33 +47,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;
- 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;
- };
- } __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
@@ -85,37 +57,6 @@ typedef union
int __align;
} pthread_mutexattr_t;
-/* Data structure for conditional variable handling. The structure of
- the attribute type is not exposed on purpose. */
-typedef union
-{
- struct
- {
- __extension__ union
- {
- __extension__ unsigned long long int __wseq;
- struct {
- unsigned int __low;
- unsigned int __high;
- } __wseq32;
- };
- __extension__ union
- {
- __extension__ unsigned long long int __g1_start;
- struct {
- unsigned int __low;
- unsigned int __high;
- } __g1_start32;
- };
- unsigned int __g_refs[2];
- unsigned int __g_size[2];
- unsigned int __g1_orig_size;
- unsigned int __wrefs;
- unsigned int __g_signals[2];
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-} pthread_cond_t;
typedef union
{
new file mode 100644
@@ -0,0 +1,93 @@
+/* Common thread definition for pthread and c11 threads. Linux/microblaze
+ 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/>. */
+
+/* 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 \
+ { \
+ __extension__ union \
+ { \
+ __extension__ unsigned long long int __wseq; \
+ struct { \
+ unsigned int __low; \
+ unsigned int __high; \
+ } __wseq32; \
+ }; \
+ __extension__ union \
+ { \
+ __extension__ unsigned long long int __g1_start; \
+ struct { \
+ unsigned int __low; \
+ unsigned int __high; \
+ } __g1_start32; \
+ }; \
+ unsigned int __g_refs[2]; \
+ unsigned int __g_size[2]; \
+ unsigned int __g1_orig_size; \
+ unsigned int __wrefs; \
+ unsigned int __g_signals[2]; \
+ } __data; \
+ char __size[__SIZEOF_PTHREAD_COND_T]; \
+ __extension__ long long int __align;
+
+#endif
@@ -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,52 +57,6 @@ 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 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;
- };
-#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
@@ -116,38 +67,6 @@ typedef union
} pthread_mutexattr_t;
-/* Data structure for conditional variable handling. The structure of
- the attribute type is not exposed on purpose. */
-typedef union
-{
- struct
- {
- __extension__ union
- {
- __extension__ unsigned long long int __wseq;
- struct {
- unsigned int __low;
- unsigned int __high;
- } __wseq32;
- };
- __extension__ union
- {
- __extension__ unsigned long long int __g1_start;
- struct {
- unsigned int __low;
- unsigned int __high;
- } __g1_start32;
- };
- unsigned int __g_refs[2];
- unsigned int __g_size[2];
- unsigned int __g1_orig_size;
- unsigned int __wrefs;
- unsigned int __g_signals[2];
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-} pthread_cond_t;
-
typedef union
{
char __size[__SIZEOF_PTHREAD_CONDATTR_T];
new file mode 100644
@@ -0,0 +1,114 @@
+/* Common thread definition for pthread and c11 threads. Linux/mips
+ 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/>. */
+
+/* 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
+
+/* Data structures for mutex handling. The structure of the attribute
+ type is deliberately not exposed. */
+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;
+ };
+#endif
+};
+
+/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER. */
+#define __PTHREAD_SPINS 0
+
+#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. The structure of
+ the attribute type is deliberately not exposed. */
+#define __PTHREAD_COND_T_CONTENT \
+ struct \
+ { \
+ __extension__ union \
+ { \
+ __extension__ unsigned long long int __wseq; \
+ struct { \
+ unsigned int __low; \
+ unsigned int __high; \
+ } __wseq32; \
+ }; \
+ __extension__ union \
+ { \
+ __extension__ unsigned long long int __g1_start; \
+ struct { \
+ unsigned int __low; \
+ unsigned int __high; \
+ } __g1_start32; \
+ }; \
+ unsigned int __g_refs[2]; \
+ unsigned int __g_size[2]; \
+ unsigned int __g1_orig_size; \
+ unsigned int __wrefs; \
+ unsigned int __g_signals[2]; \
+ } __data; \
+ char __size[__SIZEOF_PTHREAD_COND_T]; \
+ __extension__ long long int __align;
+
+#endif
@@ -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,76 +47,12 @@ 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 with static initializers. */
- 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
{
char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
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 not exposed on purpose. */
-typedef union
-{
- struct
- {
- __extension__ union
- {
- __extension__ unsigned long long int __wseq;
- struct {
- unsigned int __low;
- unsigned int __high;
- } __wseq32;
- };
- __extension__ union
- {
- __extension__ unsigned long long int __g1_start;
- struct {
- unsigned int __low;
- unsigned int __high;
- } __g1_start32;
- };
- unsigned int __g_refs[2];
- unsigned int __g_size[2];
- unsigned int __g1_orig_size;
- unsigned int __wrefs;
- unsigned int __g_signals[2];
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-} pthread_cond_t;
typedef union
{
new file mode 100644
@@ -0,0 +1,90 @@
+/* Common thread definition for pthread and c11 threads. Linux/nios2
+ 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/>. */
+
+/* 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;
+
+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;
+ };
+} __data;
+
+/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER. */
+#define __PTHREAD_SPINS 0
+
+#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 \
+ { \
+ __extension__ union \
+ { \
+ __extension__ unsigned long long int __wseq; \
+ struct { \
+ unsigned int __low; \
+ unsigned int __high; \
+ } __wseq32; \
+ }; \
+ __extension__ union \
+ { \
+ __extension__ unsigned long long int __g1_start; \
+ struct { \
+ unsigned int __low; \
+ unsigned int __high; \
+ } __g1_start32; \
+ }; \
+ unsigned int __g_refs[2]; \
+ unsigned int __g_size[2]; \
+ unsigned int __g1_orig_size; \
+ unsigned int __wrefs; \
+ unsigned int __g_signals[2]; \
+ } __data; \
+ char __size[__SIZEOF_PTHREAD_COND_T]; \
+ __extension__ long long int __align;
+
+#endif
new file mode 100644
@@ -0,0 +1,44 @@
+/* Default pthread common types 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/>. */
+
+
+/* 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
@@ -20,28 +20,21 @@
#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
# define __SIZEOF_PTHREAD_BARRIER_T 32
-# 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
# define __SIZEOF_PTHREAD_BARRIER_T 20
-# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
#endif
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_CONDATTR_T 4
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
/* Thread identifiers. The structure of the attribute type is
@@ -60,63 +53,10 @@ 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 with static initializers. */
- 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
-{
char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
int __align;
} pthread_mutexattr_t;
@@ -126,36 +66,6 @@ typedef union
the attribute type is not exposed on purpose. */
typedef union
{
- struct
- {
- __extension__ union
- {
- __extension__ unsigned long long int __wseq;
- struct {
- unsigned int __low;
- unsigned int __high;
- } __wseq32;
- };
- __extension__ union
- {
- __extension__ unsigned long long int __g1_start;
- struct {
- unsigned int __low;
- unsigned int __high;
- } __g1_start32;
- };
- unsigned int __g_refs[2];
- unsigned int __g_size[2];
- unsigned int __g1_orig_size;
- unsigned int __wrefs;
- unsigned int __g_signals[2];
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
char __size[__SIZEOF_PTHREAD_CONDATTR_T];
int __align;
} pthread_condattr_t;
new file mode 100644
@@ -0,0 +1,118 @@
+/* Common thread definition for pthread and c11 threads. Linux/powerpc
+ 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/>. */
+
+/* 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
+
+#if __WORDSIZE == 64
+# define __SIZEOF_PTHREAD_MUTEX_T 40
+#else
+# define __SIZEOF_PTHREAD_MUTEX_T 24
+#endif
+#define __SIZEOF_PTHREAD_COND_T 48
+
+
+#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
+
+
+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
+# 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 \
+ { \
+ __extension__ union \
+ { \
+ __extension__ unsigned long long int __wseq; \
+ struct { \
+ unsigned int __low; \
+ unsigned int __high; \
+ } __wseq32; \
+ }; \
+ __extension__ union \
+ { \
+ __extension__ unsigned long long int __g1_start; \
+ struct { \
+ unsigned int __low; \
+ unsigned int __high; \
+ } __g1_start32; \
+ }; \
+ unsigned int __g_refs[2]; \
+ unsigned int __g_size[2]; \
+ unsigned int __g1_orig_size; \
+ unsigned int __wrefs; \
+ unsigned int __g_signals[2]; \
+ } __data; \
+ char __size[__SIZEOF_PTHREAD_COND_T]; \
+ __extension__ long long int __align;
+
+#endif
@@ -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,78 +56,10 @@ 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 with static initializers. */
- 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
-{
char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
int __align;
} pthread_mutexattr_t;
@@ -140,36 +69,6 @@ typedef union
the attribute type is not exposed on purpose. */
typedef union
{
- struct
- {
- __extension__ union
- {
- __extension__ unsigned long long int __wseq;
- struct {
- unsigned int __low;
- unsigned int __high;
- } __wseq32;
- };
- __extension__ union
- {
- __extension__ unsigned long long int __g1_start;
- struct {
- unsigned int __low;
- unsigned int __high;
- } __g1_start32;
- };
- unsigned int __g_refs[2];
- unsigned int __g_size[2];
- unsigned int __g1_orig_size;
- unsigned int __wrefs;
- unsigned int __g_signals[2];
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
char __size[__SIZEOF_PTHREAD_CONDATTR_T];
int __align;
} pthread_condattr_t;
new file mode 100644
@@ -0,0 +1,137 @@
+/* Common thread definition for pthread and c11 threads. Linux/s390
+ 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/>. */
+
+/* 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 \
+ { \
+ __extension__ union \
+ { \
+ __extension__ unsigned long long int __wseq; \
+ struct { \
+ unsigned int __low; \
+ unsigned int __high; \
+ } __wseq32; \
+ }; \
+ __extension__ union \
+ { \
+ __extension__ unsigned long long int __g1_start; \
+ struct { \
+ unsigned int __low; \
+ unsigned int __high; \
+ } __g1_start32; \
+ }; \
+ unsigned int __g_refs[2]; \
+ unsigned int __g_size[2]; \
+ unsigned int __g1_orig_size; \
+ unsigned int __wrefs; \
+ unsigned int __g_signals[2]; \
+ } __data; \
+ char __size[__SIZEOF_PTHREAD_COND_T]; \
+ __extension__ long long int __align;
+
+#endif
@@ -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,40 +47,10 @@ 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 with static initializers. */
- 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
-{
char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
long int __align;
} pthread_mutexattr_t;
@@ -91,36 +60,6 @@ typedef union
the attribute type is not exposed on purpose. */
typedef union
{
- struct
- {
- __extension__ union
- {
- __extension__ unsigned long long int __wseq;
- struct {
- unsigned int __low;
- unsigned int __high;
- } __wseq32;
- };
- __extension__ union
- {
- __extension__ unsigned long long int __g1_start;
- struct {
- unsigned int __low;
- unsigned int __high;
- } __g1_start32;
- };
- unsigned int __g_refs[2];
- unsigned int __g_size[2];
- unsigned int __g1_orig_size;
- unsigned int __wrefs;
- unsigned int __g_signals[2];
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
char __size[__SIZEOF_PTHREAD_CONDATTR_T];
long int __align;
} pthread_condattr_t;
new file mode 100644
@@ -0,0 +1,94 @@
+/* Common thread definition for pthread and c11 threads. Linux/sh
+ 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/>. */
+
+/* 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 \
+ { \
+ __extension__ union \
+ { \
+ __extension__ unsigned long long int __wseq; \
+ struct { \
+ unsigned int __low; \
+ unsigned int __high; \
+ } __wseq32; \
+ }; \
+ __extension__ union \
+ { \
+ __extension__ unsigned long long int __g1_start; \
+ struct { \
+ unsigned int __low; \
+ unsigned int __high; \
+ } __g1_start32; \
+ }; \
+ unsigned int __g_refs[2]; \
+ unsigned int __g_size[2]; \
+ unsigned int __g1_orig_size; \
+ unsigned int __wrefs; \
+ unsigned int __g_signals[2]; \
+ } __data; \
+ char __size[__SIZEOF_PTHREAD_COND_T]; \
+ __extension__ long long int __align;
+
+#endif /* bits/thread-shared-types.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,57 +57,10 @@ 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 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;
- };
-#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
-{
char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
int __align;
} pthread_mutexattr_t;
@@ -120,36 +70,6 @@ typedef union
the attribute type is deliberately not exposed. */
typedef union
{
- struct
- {
- __extension__ union
- {
- __extension__ unsigned long long int __wseq;
- struct {
- unsigned int __low;
- unsigned int __high;
- } __wseq32;
- };
- __extension__ union
- {
- __extension__ unsigned long long int __g1_start;
- struct {
- unsigned int __low;
- unsigned int __high;
- } __g1_start32;
- };
- unsigned int __g_refs[2];
- unsigned int __g_size[2];
- unsigned int __g1_orig_size;
- unsigned int __wrefs;
- unsigned int __g_signals[2];
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
char __size[__SIZEOF_PTHREAD_CONDATTR_T];
int __align;
} pthread_condattr_t;
new file mode 100644
@@ -0,0 +1,115 @@
+/* Common thread definition for pthread and c11 threads. Linux/sparc
+ 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/>. */
+
+/* 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 structures 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 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;
+ };
+#endif
+};
+
+/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER. */
+#define __PTHREAD_SPINS 0
+
+#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 \
+ { \
+ __extension__ union \
+ { \
+ __extension__ unsigned long long int __wseq; \
+ struct { \
+ unsigned int __low; \
+ unsigned int __high; \
+ } __wseq32; \
+ }; \
+ __extension__ union \
+ { \
+ __extension__ unsigned long long int __g1_start; \
+ struct { \
+ unsigned int __low; \
+ unsigned int __high; \
+ } __g1_start32; \
+ }; \
+ unsigned int __g_refs[2]; \
+ unsigned int __g_size[2]; \
+ unsigned int __g1_orig_size; \
+ unsigned int __wrefs; \
+ unsigned int __g_signals[2]; \
+ } __data; \
+ char __size[__SIZEOF_PTHREAD_COND_T]; \
+ __extension__ long long int __align;
+
+#endif
+
@@ -21,28 +21,21 @@
#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
# define __SIZEOF_PTHREAD_BARRIER_T 32
-# 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
# define __SIZEOF_PTHREAD_BARRIER_T 20
-# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
#endif
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_CONDATTR_T 4
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
/* Thread identifiers. The structure of the attribute type is not
@@ -60,51 +53,6 @@ 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 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;
- };
-#endif
- } __data;
- char __size[__SIZEOF_PTHREAD_MUTEX_T];
- long int __align;
-} pthread_mutex_t;
typedef union
{
@@ -112,44 +60,11 @@ 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
- {
- __extension__ union
- {
- __extension__ unsigned long long int __wseq;
- struct {
- unsigned int __low;
- unsigned int __high;
- } __wseq32;
- };
- __extension__ union
- {
- __extension__ unsigned long long int __g1_start;
- struct {
- unsigned int __low;
- unsigned int __high;
- } __g1_start32;
- };
- unsigned int __g_refs[2];
- unsigned int __g_size[2];
- unsigned int __g1_orig_size;
- unsigned int __wrefs;
- unsigned int __g_signals[2];
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
char __size[__SIZEOF_PTHREAD_CONDATTR_T];
int __align;
} pthread_condattr_t;
new file mode 100644
@@ -0,0 +1,114 @@
+/* Common thread definition for pthread and c11 threads. Linux/sparc
+ 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/>. */
+
+/* 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
+#else
+# define __SIZEOF_PTHREAD_MUTEX_T 24
+#endif
+#define __SIZEOF_PTHREAD_COND_T 48
+
+
+#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. */
+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;
+ };
+#endif
+};
+
+/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER. */
+#define __PTHREAD_SPINS 0
+
+#define __PTHREAD_MUTEX_T_CONTENT \
+ struct __pthread_mutex_s __data; \
+ char __size[__SIZEOF_PTHREAD_MUTEX_T]; \
+ long int __align;
+
+
+#define __PTHREAD_COND_T_CONTENT \
+ struct \
+ { \
+ __extension__ union \
+ { \
+ __extension__ unsigned long long int __wseq; \
+ struct { \
+ unsigned int __low; \
+ unsigned int __high; \
+ } __wseq32; \
+ }; \
+ __extension__ union \
+ { \
+ __extension__ unsigned long long int __g1_start; \
+ struct { \
+ unsigned int __low; \
+ unsigned int __high; \
+ } __g1_start32; \
+ }; \
+ unsigned int __g_refs[2]; \
+ unsigned int __g_size[2]; \
+ unsigned int __g1_orig_size; \
+ unsigned int __wrefs; \
+ unsigned int __g_signals[2]; \
+ } __data; \
+ char __size[__SIZEOF_PTHREAD_COND_T]; \
+ __extension__ long long int __align;
+
+#endif
@@ -19,40 +19,30 @@
#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
# define __SIZEOF_PTHREAD_BARRIER_T 32
-# 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
# define __SIZEOF_PTHREAD_BARRIER_T 20
-# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
# 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
# define __SIZEOF_PTHREAD_BARRIER_T 20
-# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
#endif
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_CONDATTR_T 4
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
/* Thread identifiers. The structure of the attribute type is not
@@ -71,64 +61,10 @@ 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 with static initializers. */
- 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
-{
char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
int __align;
} pthread_mutexattr_t;
@@ -138,36 +74,6 @@ typedef union
the attribute type is not exposed on purpose. */
typedef union
{
- struct
- {
- __extension__ union
- {
- __extension__ unsigned long long int __wseq;
- struct {
- unsigned int __low;
- unsigned int __high;
- } __wseq32;
- };
- __extension__ union
- {
- __extension__ unsigned long long int __g1_start;
- struct {
- unsigned int __low;
- unsigned int __high;
- } __g1_start32;
- };
- unsigned int __g_refs[2];
- unsigned int __g_size[2];
- unsigned int __g1_orig_size;
- unsigned int __wrefs;
- unsigned int __g_signals[2];
- } __data;
- char __size[__SIZEOF_PTHREAD_COND_T];
- __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
char __size[__SIZEOF_PTHREAD_CONDATTR_T];
int __align;
} pthread_condattr_t;
new file mode 100644
@@ -0,0 +1,117 @@
+/* Common thread definition for pthread and c11 threads. Linux/x86
+ 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 _BITS_PTHREAD_SHARED_TYPES_H
+#define _BITS_PTHREAD_SHARED_TYPES_H 1
+
+#ifdef __x86_64__
+# if __WORDSIZE == 64
+# define __SIZEOF_PTHREAD_MUTEX_T 40
+# else
+# define __SIZEOF_PTHREAD_MUTEX_T 32
+# endif
+#else
+# define __SIZEOF_PTHREAD_MUTEX_T 24
+#endif
+#define __SIZEOF_PTHREAD_COND_T 48
+
+#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
+
+
+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
+/* 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; \
+
+#define __PTHREAD_COND_T_CONTENT \
+ struct \
+ { \
+ __extension__ union \
+ { \
+ __extension__ unsigned long long int __wseq; \
+ struct { \
+ unsigned int __low; \
+ unsigned int __high; \
+ } __wseq32; \
+ }; \
+ __extension__ union \
+ { \
+ __extension__ unsigned long long int __g1_start; \
+ struct { \
+ unsigned int __low; \
+ unsigned int __high; \
+ } __g1_start32; \
+ }; \
+ unsigned int __g_refs[2]; \
+ unsigned int __g_size[2]; \
+ unsigned int __g1_orig_size; \
+ unsigned int __wrefs; \
+ unsigned int __g_signals[2]; \
+ } __data; \
+ char __size[__SIZEOF_PTHREAD_COND_T]; \
+ __extension__ long long int __align;
+
+
+#endif