From patchwork Tue Mar 21 13:40:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 95631 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp1445758qgd; Tue, 21 Mar 2017 06:42:11 -0700 (PDT) X-Received: by 10.84.224.136 with SMTP id s8mr1645911plj.21.1490103731529; Tue, 21 Mar 2017 06:42:11 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id w5si21337504pgo.121.2017.03.21.06.42.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Mar 2017 06:42:11 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-78103-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org; spf=pass (google.com: domain of libc-alpha-return-78103-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-78103-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=Oggh+9msQqDccHiIMQH7jeKHSMP5xwm IIXTuhQFrcWdM4dSEhbWVcf3gBeY/gReOW6G1nwT5WstOGGKqKGcvb7Q+akUPWpA 6ukT1v8ZlfY1eCGt/6WiS98tlEnfAKl63N9V2Pn2oxF3tXBAduyAdZiHn9k/aEKd OLCf/yPEpD/0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=xfjTY20PxV6bst1GoOZnZITTTxU=; b=Y4iwX YHMqytjsRuM8LGUbGTGyIgkmCt8fA48y0s/lQUHMSUmp+cx3WYdeNf9wW0pJFAfb KnQVWNsVvvOGM4MXSo7VmMDDmT8yRiL7w/aBFR/nz9EaK453oGAQcCGTJ1J6QCiw nBM9NxVWJLdXDd7IAwOebuaGPTIwT0pdafBiEM= Received: (qmail 87456 invoked by alias); 21 Mar 2017 13:40:42 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 87177 invoked by uid 89); 21 Mar 2017 13:40:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=1930, 606, expose, 1710 X-HELO: mail-qk0-f170.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=2j01ZFNEnDlZjTs5gwPJRzvLBVlK63CHMrA3WeR0riY=; b=W+GQ4LMQFwehEoBsdpByBtySYYQjDNM5TJa97ixDiQ5h1Tcq1xljw/xrNTLVU7Jxr3 g1odkNovxYzELmXP27tTFjdKx6WPPV/+Hx6QPDNIVBwJOtcldOQP+1g8V04nxCcZ0TGK xxIBbaLN0WRdkmq1ZyMX65cAkshWQTttAttUZUfm94RzWIJDPYVhz2eVTNZdOAFK4JSP xzpWFAo7qbeZjT2LJcwgExlDSB+FrhvIip3hlkFUSR+PGROkcGYgK0r98Gn9GiArdtB4 VAaeLilijv1GXSM3tc0WcR0cYdkna8TGMNQD4WCU7IaGoE3VNLPfnhUki3T37wtf2HaD 0Xsg== X-Gm-Message-State: AFeK/H3aUMINOxfULt+NG3kBNXyymwB6wqgpzlg1Wp5kQ/RcTg45Uq8ALGsvdYNAVyw79Xss X-Received: by 10.55.185.131 with SMTP id j125mr28046019qkf.206.1490103623140; Tue, 21 Mar 2017 06:40:23 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 2/6] Move mutex and condition variable definition to common header Date: Tue, 21 Mar 2017 10:40:08 -0300 Message-Id: <1490103612-9401-3-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1490103612-9401-1-git-send-email-adhemerval.zanella@linaro.org> References: <1490103612-9401-1-git-send-email-adhemerval.zanella@linaro.org> This patch sorts out pthread_mutex_t and pthread_cond_t in new files, so new C11 types could be based on pthread types without corrupting namespaces and exposing pthread symbols. Common pthread types like pthread_mutex_t and pthread_cond_t are now defined in arch specific bits/pthreadtypes-common.h headers, while the internal implementation is moved to bits/thread-shared-types.h. File pthreadtypes.h is cleaned up of those definitions and some related macros and structures. Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabi, hppa-linux-gnu, i386-linux-gnu, ia64-linux-gnu, m68k-linux-gnu, microblaze-linux-gnu [1], mips{64}-linux-gnu, nios2-linux-gnu, powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu, tile{pro,gx}-linux-gnu, and x86_64-linux-gnu). Adhemerval Zanella Juan Manuel Torres Palma * posix/Makefile (headers): Add files bits/pthreadtypes-common.h and bits/thread-shared-types.h to this variable. * bits/pthreadtypes-common.h: New file. * bits/thread-shared-types.: Likewise. * sysdeps/aarch64/nptl/bits/thread-shared-types.h: Likewise. * sysdeps/alpha/nptl/bits/thread-shared-types.h: Likewise. * sysdeps/arm/nptl/bits/thread-shared-types.h: Likewise. * sysdeps/hppa/nptl/bits/thread-shared-types.h: Likewise. * sysdeps/ia64/nptl/bits/thread-shared-types.h: Likewise. * sysdeps/m68k/nptl/bits/thread-shared-types.h: Likewise. * sysdeps/microblaze/nptl/bits/thread-shared-types.h: Likewise. * sysdeps/mips/nptl/bits/thread-shared-types.h: Likewise. * sysdeps/nios2/nptl/bits/thread-shared-types.h: Likewise. * sysdeps/powerpc/nptl/bits/thread-shared-types.h: Likewise. * sysdeps/s390/nptl/bits/thread-shared-types.h: Likewise. * sysdeps/sh/nptl/bits/thread-shared-types.h: Likewise. * sysdeps/sparc/nptl/bits/thread-shared-types.h: Likewise. * sysdeps/tile/nptl/bits/thread-shared-types.h: Likewise. * sysdeps/x86/nptl/bits/thread-shared-types.h: Likewise. * sysdeps/aarch64/nptl/bits/pthreadtypes.h: Move mutex and condition variable definition to platform specific thread-shared-types header. * sysdeps/alpha/nptl/bits/pthreadtypes.h: Likewise. * sysdeps/arm/nptl/bits/pthreadtypes.h: Likewise. * sysdeps/hppa/nptl/bits/pthreadtypes.h: Likewise. * sysdeps/ia64/nptl/bits/pthreadtypes.h: Likewise. * sysdeps/m68k/nptl/bits/pthreadtypes.h: Likewise. * sysdeps/microblaze/nptl/bits/pthreadtypes.h: Likewise. * sysdeps/mips/nptl/bits/pthreadtypes.h: Likewise. * sysdeps/nios2/nptl/bits/pthreadtypes.h: Likewise. * sysdeps/powerpc/nptl/bits/pthreadtypes.h: Likewise. * sysdeps/s390/nptl/bits/pthreadtypes.h: Likewise. * sysdeps/sh/nptl/bits/pthreadtypes.h: Likewise. * sysdeps/sparc/nptl/bits/pthreadtypes.h: Likewise. * sysdeps/tile/nptl/bits/pthreadtypes.h: Likewise. * sysdeps/x86/nptl/bits/pthreadtypes.h: Likewise. --- ChangeLog | 39 ++++++ bits/thread-shared-types.h | 36 ++++++ posix/Makefile | 3 +- sysdeps/aarch64/nptl/bits/pthreadtypes.h | 67 +--------- sysdeps/aarch64/nptl/bits/thread-shared-types.h | 94 ++++++++++++++ sysdeps/alpha/nptl/bits/pthreadtypes.h | 63 +--------- sysdeps/alpha/nptl/bits/thread-shared-types.h | 90 ++++++++++++++ sysdeps/arm/nptl/bits/pthreadtypes.h | 67 +--------- sysdeps/arm/nptl/bits/thread-shared-types.h | 92 ++++++++++++++ sysdeps/hppa/nptl/bits/pthreadtypes.h | 83 +------------ sysdeps/hppa/nptl/bits/thread-shared-types.h | 102 +++++++++++++++ sysdeps/ia64/nptl/bits/pthreadtypes.h | 67 +--------- sysdeps/ia64/nptl/bits/thread-shared-types.h | 92 ++++++++++++++ sysdeps/m68k/nptl/bits/pthreadtypes.h | 68 +--------- sysdeps/m68k/nptl/bits/thread-shared-types.h | 97 +++++++++++++++ sysdeps/microblaze/nptl/bits/pthreadtypes.h | 61 +-------- sysdeps/microblaze/nptl/bits/thread-shared-types.h | 93 ++++++++++++++ sysdeps/mips/nptl/bits/pthreadtypes.h | 83 +------------ sysdeps/mips/nptl/bits/thread-shared-types.h | 114 +++++++++++++++++ sysdeps/nios2/nptl/bits/pthreadtypes.h | 67 +--------- sysdeps/nios2/nptl/bits/thread-shared-types.h | 90 ++++++++++++++ sysdeps/nptl/bits/pthreadtypes-common.h | 44 +++++++ sysdeps/powerpc/nptl/bits/pthreadtypes.h | 100 +-------------- sysdeps/powerpc/nptl/bits/thread-shared-types.h | 118 ++++++++++++++++++ sysdeps/s390/nptl/bits/pthreadtypes.h | 103 +--------------- sysdeps/s390/nptl/bits/thread-shared-types.h | 137 +++++++++++++++++++++ sysdeps/sh/nptl/bits/pthreadtypes.h | 63 +--------- sysdeps/sh/nptl/bits/thread-shared-types.h | 94 ++++++++++++++ sysdeps/sparc/nptl/bits/pthreadtypes.h | 82 +----------- sysdeps/sparc/nptl/bits/thread-shared-types.h | 115 +++++++++++++++++ sysdeps/tile/nptl/bits/pthreadtypes.h | 95 +------------- sysdeps/tile/nptl/bits/thread-shared-types.h | 114 +++++++++++++++++ sysdeps/x86/nptl/bits/pthreadtypes.h | 104 +--------------- sysdeps/x86/nptl/bits/thread-shared-types.h | 117 ++++++++++++++++++ 34 files changed, 1710 insertions(+), 1144 deletions(-) create mode 100644 bits/thread-shared-types.h create mode 100644 sysdeps/aarch64/nptl/bits/thread-shared-types.h create mode 100644 sysdeps/alpha/nptl/bits/thread-shared-types.h create mode 100644 sysdeps/arm/nptl/bits/thread-shared-types.h create mode 100644 sysdeps/hppa/nptl/bits/thread-shared-types.h create mode 100644 sysdeps/ia64/nptl/bits/thread-shared-types.h create mode 100644 sysdeps/m68k/nptl/bits/thread-shared-types.h create mode 100644 sysdeps/microblaze/nptl/bits/thread-shared-types.h create mode 100644 sysdeps/mips/nptl/bits/thread-shared-types.h create mode 100644 sysdeps/nios2/nptl/bits/thread-shared-types.h create mode 100644 sysdeps/nptl/bits/pthreadtypes-common.h create mode 100644 sysdeps/powerpc/nptl/bits/thread-shared-types.h create mode 100644 sysdeps/s390/nptl/bits/thread-shared-types.h create mode 100644 sysdeps/sh/nptl/bits/thread-shared-types.h create mode 100644 sysdeps/sparc/nptl/bits/thread-shared-types.h create mode 100644 sysdeps/tile/nptl/bits/thread-shared-types.h create mode 100644 sysdeps/x86/nptl/bits/thread-shared-types.h -- 2.7.4 diff --git a/bits/thread-shared-types.h b/bits/thread-shared-types.h new file mode 100644 index 0000000..98f2084 --- /dev/null +++ b/bits/thread-shared-types.h @@ -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 + . */ + +/* This file is required to have a shared types definition + between POSIX threads and C11 threads. It allows to + header files like pthread.h and thread.h to define their types + with the same size and fields without corrupting namespaces. + + The interface is as follows: + + - bits/thread-shared-types.h. Defines structures for mutex and condvar, + shared by threads.h and pthread.h. The macros defined are + __PTHREAD_MUTEX_T_CONTENT and __PTHREAD_COND_T_CONTENT + + - bits/pthreadtypes-common.h. Works as a generic file that defines + common pthread types like pthread_mutex_t and pthread_cond_t + based on the macros included from thread-shared-types.h. + + - bits/pthreadtypes.h. Include pthreadtypes-common.h to have access + to pthread types and expose them for the other types and functions + that require it. */ diff --git a/posix/Makefile b/posix/Makefile index ae17646..2dcc3ae 100644 --- a/posix/Makefile +++ b/posix/Makefile @@ -29,7 +29,8 @@ headers := sys/utsname.h sys/times.h sys/wait.h sys/types.h unistd.h \ bits/local_lim.h tar.h bits/utsname.h bits/confname.h \ bits/waitflags.h bits/waitstatus.h sys/unistd.h sched.h \ bits/sched.h re_comp.h wait.h bits/environments.h cpio.h \ - spawn.h bits/unistd.h + spawn.h bits/unistd.h \ + bits/thread-shared-types.h bits/pthreadtypes-common.h routines := \ uname \ diff --git a/sysdeps/aarch64/nptl/bits/pthreadtypes.h b/sysdeps/aarch64/nptl/bits/pthreadtypes.h index 97d9407..3384e42 100644 --- a/sysdeps/aarch64/nptl/bits/pthreadtypes.h +++ b/sysdeps/aarch64/nptl/bits/pthreadtypes.h @@ -20,12 +20,11 @@ #define _BITS_PTHREADTYPES_H 1 #include +#include #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]; diff --git a/sysdeps/aarch64/nptl/bits/thread-shared-types.h b/sysdeps/aarch64/nptl/bits/thread-shared-types.h new file mode 100644 index 0000000..bb361d7 --- /dev/null +++ b/sysdeps/aarch64/nptl/bits/thread-shared-types.h @@ -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 + . */ + +/* 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 diff --git a/sysdeps/alpha/nptl/bits/pthreadtypes.h b/sysdeps/alpha/nptl/bits/pthreadtypes.h index 1beaf10..9b2c7be 100644 --- a/sysdeps/alpha/nptl/bits/pthreadtypes.h +++ b/sysdeps/alpha/nptl/bits/pthreadtypes.h @@ -19,10 +19,10 @@ #ifndef _BITS_PTHREADTYPES_H #define _BITS_PTHREADTYPES_H 1 +#include + #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; diff --git a/sysdeps/alpha/nptl/bits/thread-shared-types.h b/sysdeps/alpha/nptl/bits/thread-shared-types.h new file mode 100644 index 0000000..b3c8505 --- /dev/null +++ b/sysdeps/alpha/nptl/bits/thread-shared-types.h @@ -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 + . */ + +/* 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 diff --git a/sysdeps/arm/nptl/bits/pthreadtypes.h b/sysdeps/arm/nptl/bits/pthreadtypes.h index dae7bc4..ece5d13 100644 --- a/sysdeps/arm/nptl/bits/pthreadtypes.h +++ b/sysdeps/arm/nptl/bits/pthreadtypes.h @@ -19,11 +19,10 @@ #define _BITS_PTHREADTYPES_H 1 #include +#include #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]; diff --git a/sysdeps/arm/nptl/bits/thread-shared-types.h b/sysdeps/arm/nptl/bits/thread-shared-types.h new file mode 100644 index 0000000..2475792 --- /dev/null +++ b/sysdeps/arm/nptl/bits/thread-shared-types.h @@ -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 + . */ + +/* 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 diff --git a/sysdeps/hppa/nptl/bits/pthreadtypes.h b/sysdeps/hppa/nptl/bits/pthreadtypes.h index e37111a..dd89e12 100644 --- a/sysdeps/hppa/nptl/bits/pthreadtypes.h +++ b/sysdeps/hppa/nptl/bits/pthreadtypes.h @@ -18,6 +18,8 @@ #ifndef _BITS_PTHREADTYPES_H #define _BITS_PTHREADTYPES_H 1 +#include + /* 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]; diff --git a/sysdeps/hppa/nptl/bits/thread-shared-types.h b/sysdeps/hppa/nptl/bits/thread-shared-types.h new file mode 100644 index 0000000..2a6d7d9 --- /dev/null +++ b/sysdeps/hppa/nptl/bits/thread-shared-types.h @@ -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 + . */ + +/* 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 diff --git a/sysdeps/ia64/nptl/bits/pthreadtypes.h b/sysdeps/ia64/nptl/bits/pthreadtypes.h index c67ee86..a34c9d6 100644 --- a/sysdeps/ia64/nptl/bits/pthreadtypes.h +++ b/sysdeps/ia64/nptl/bits/pthreadtypes.h @@ -19,10 +19,10 @@ #ifndef _BITS_PTHREADTYPES_H #define _BITS_PTHREADTYPES_H 1 +#include + #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]; diff --git a/sysdeps/ia64/nptl/bits/thread-shared-types.h b/sysdeps/ia64/nptl/bits/thread-shared-types.h new file mode 100644 index 0000000..f318236 --- /dev/null +++ b/sysdeps/ia64/nptl/bits/thread-shared-types.h @@ -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 + . */ + +/* 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 diff --git a/sysdeps/m68k/nptl/bits/pthreadtypes.h b/sysdeps/m68k/nptl/bits/pthreadtypes.h index 9a16bbf..a7fa6e7 100644 --- a/sysdeps/m68k/nptl/bits/pthreadtypes.h +++ b/sysdeps/m68k/nptl/bits/pthreadtypes.h @@ -20,11 +20,10 @@ #define _BITS_PTHREADTYPES_H 1 #include +#include #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]; diff --git a/sysdeps/m68k/nptl/bits/thread-shared-types.h b/sysdeps/m68k/nptl/bits/thread-shared-types.h new file mode 100644 index 0000000..ab6f05f --- /dev/null +++ b/sysdeps/m68k/nptl/bits/thread-shared-types.h @@ -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 + . */ + +/* 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 diff --git a/sysdeps/microblaze/nptl/bits/pthreadtypes.h b/sysdeps/microblaze/nptl/bits/pthreadtypes.h index 7c5db6b..efa70c8 100644 --- a/sysdeps/microblaze/nptl/bits/pthreadtypes.h +++ b/sysdeps/microblaze/nptl/bits/pthreadtypes.h @@ -20,11 +20,10 @@ # define _BITS_PTHREADTYPES_H 1 # include +# include # 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 { diff --git a/sysdeps/microblaze/nptl/bits/thread-shared-types.h b/sysdeps/microblaze/nptl/bits/thread-shared-types.h new file mode 100644 index 0000000..91d14b6 --- /dev/null +++ b/sysdeps/microblaze/nptl/bits/thread-shared-types.h @@ -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 + . */ + +/* 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 diff --git a/sysdeps/mips/nptl/bits/pthreadtypes.h b/sysdeps/mips/nptl/bits/pthreadtypes.h index b1ebf4e..51f04fe 100644 --- a/sysdeps/mips/nptl/bits/pthreadtypes.h +++ b/sysdeps/mips/nptl/bits/pthreadtypes.h @@ -20,12 +20,11 @@ #define _BITS_PTHREADTYPES_H 1 #include +#include #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]; diff --git a/sysdeps/mips/nptl/bits/thread-shared-types.h b/sysdeps/mips/nptl/bits/thread-shared-types.h new file mode 100644 index 0000000..a34b816 --- /dev/null +++ b/sysdeps/mips/nptl/bits/thread-shared-types.h @@ -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 + . */ + +/* 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 diff --git a/sysdeps/nios2/nptl/bits/pthreadtypes.h b/sysdeps/nios2/nptl/bits/pthreadtypes.h index 8247013..4d0f413 100644 --- a/sysdeps/nios2/nptl/bits/pthreadtypes.h +++ b/sysdeps/nios2/nptl/bits/pthreadtypes.h @@ -20,11 +20,10 @@ #define _BITS_PTHREADTYPES_H 1 #include +#include #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 { diff --git a/sysdeps/nios2/nptl/bits/thread-shared-types.h b/sysdeps/nios2/nptl/bits/thread-shared-types.h new file mode 100644 index 0000000..8904239 --- /dev/null +++ b/sysdeps/nios2/nptl/bits/thread-shared-types.h @@ -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 + . */ + +/* 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 diff --git a/sysdeps/nptl/bits/pthreadtypes-common.h b/sysdeps/nptl/bits/pthreadtypes-common.h new file mode 100644 index 0000000..7905000 --- /dev/null +++ b/sysdeps/nptl/bits/pthreadtypes-common.h @@ -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 + . */ + + +/* 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 + +/* 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 diff --git a/sysdeps/powerpc/nptl/bits/pthreadtypes.h b/sysdeps/powerpc/nptl/bits/pthreadtypes.h index e5cda79..342bec9 100644 --- a/sysdeps/powerpc/nptl/bits/pthreadtypes.h +++ b/sysdeps/powerpc/nptl/bits/pthreadtypes.h @@ -20,28 +20,21 @@ #define _BITS_PTHREADTYPES_H 1 #include +#include #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; diff --git a/sysdeps/powerpc/nptl/bits/thread-shared-types.h b/sysdeps/powerpc/nptl/bits/thread-shared-types.h new file mode 100644 index 0000000..3653f83 --- /dev/null +++ b/sysdeps/powerpc/nptl/bits/thread-shared-types.h @@ -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 + . */ + +/* 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 diff --git a/sysdeps/s390/nptl/bits/pthreadtypes.h b/sysdeps/s390/nptl/bits/pthreadtypes.h index 48ffdb4..8cd8602 100644 --- a/sysdeps/s390/nptl/bits/pthreadtypes.h +++ b/sysdeps/s390/nptl/bits/pthreadtypes.h @@ -19,12 +19,11 @@ #define _BITS_PTHREADTYPES_H 1 #include +#include #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; diff --git a/sysdeps/s390/nptl/bits/thread-shared-types.h b/sysdeps/s390/nptl/bits/thread-shared-types.h new file mode 100644 index 0000000..893e626 --- /dev/null +++ b/sysdeps/s390/nptl/bits/thread-shared-types.h @@ -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 + . */ + +/* 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 + +#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 diff --git a/sysdeps/sh/nptl/bits/pthreadtypes.h b/sysdeps/sh/nptl/bits/pthreadtypes.h index eec5811..c0b4297 100644 --- a/sysdeps/sh/nptl/bits/pthreadtypes.h +++ b/sysdeps/sh/nptl/bits/pthreadtypes.h @@ -19,11 +19,10 @@ #define _BITS_PTHREADTYPES_H 1 #include +#include #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; diff --git a/sysdeps/sh/nptl/bits/thread-shared-types.h b/sysdeps/sh/nptl/bits/thread-shared-types.h new file mode 100644 index 0000000..7a28e58 --- /dev/null +++ b/sysdeps/sh/nptl/bits/thread-shared-types.h @@ -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 + . */ + +/* 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 + +#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 */ diff --git a/sysdeps/sparc/nptl/bits/pthreadtypes.h b/sysdeps/sparc/nptl/bits/pthreadtypes.h index 525988c..9788df6 100644 --- a/sysdeps/sparc/nptl/bits/pthreadtypes.h +++ b/sysdeps/sparc/nptl/bits/pthreadtypes.h @@ -20,12 +20,11 @@ #define _BITS_PTHREADTYPES_H 1 #include +#include #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; diff --git a/sysdeps/sparc/nptl/bits/thread-shared-types.h b/sysdeps/sparc/nptl/bits/thread-shared-types.h new file mode 100644 index 0000000..d12916a --- /dev/null +++ b/sysdeps/sparc/nptl/bits/thread-shared-types.h @@ -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 + . */ + +/* 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 + +#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 + diff --git a/sysdeps/tile/nptl/bits/pthreadtypes.h b/sysdeps/tile/nptl/bits/pthreadtypes.h index 1632d82..1751082 100644 --- a/sysdeps/tile/nptl/bits/pthreadtypes.h +++ b/sysdeps/tile/nptl/bits/pthreadtypes.h @@ -21,28 +21,21 @@ #define _BITS_PTHREADTYPES_H 1 #include +#include #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; diff --git a/sysdeps/tile/nptl/bits/thread-shared-types.h b/sysdeps/tile/nptl/bits/thread-shared-types.h new file mode 100644 index 0000000..0a4587e --- /dev/null +++ b/sysdeps/tile/nptl/bits/thread-shared-types.h @@ -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 + . */ + +/* 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 + +#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 diff --git a/sysdeps/x86/nptl/bits/pthreadtypes.h b/sysdeps/x86/nptl/bits/pthreadtypes.h index c3055ca..a08aace 100644 --- a/sysdeps/x86/nptl/bits/pthreadtypes.h +++ b/sysdeps/x86/nptl/bits/pthreadtypes.h @@ -19,40 +19,30 @@ #define _BITS_PTHREADTYPES_H 1 #include +#include #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; diff --git a/sysdeps/x86/nptl/bits/thread-shared-types.h b/sysdeps/x86/nptl/bits/thread-shared-types.h new file mode 100644 index 0000000..ffed07d --- /dev/null +++ b/sysdeps/x86/nptl/bits/thread-shared-types.h @@ -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 + . */ + +#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