1/* Copyright (C) 2002-2017 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
17
18#ifndef _BITS_PTHREADTYPES_ARCH_H
19#define _BITS_PTHREADTYPES_ARCH_H 1
20
21#include <bits/wordsize.h>
22
23#ifdef __x86_64__
24# if __WORDSIZE == 64
25# define __SIZEOF_PTHREAD_MUTEX_T 40
26# define __SIZEOF_PTHREAD_ATTR_T 56
27# define __SIZEOF_PTHREAD_MUTEX_T 40
28# define __SIZEOF_PTHREAD_RWLOCK_T 56
29# define __SIZEOF_PTHREAD_BARRIER_T 32
30# else
31# define __SIZEOF_PTHREAD_MUTEX_T 32
32# define __SIZEOF_PTHREAD_ATTR_T 32
33# define __SIZEOF_PTHREAD_MUTEX_T 32
34# define __SIZEOF_PTHREAD_RWLOCK_T 44
35# define __SIZEOF_PTHREAD_BARRIER_T 20
36# endif
37#else
38# define __SIZEOF_PTHREAD_MUTEX_T 24
39# define __SIZEOF_PTHREAD_ATTR_T 36
40# define __SIZEOF_PTHREAD_MUTEX_T 24
41# define __SIZEOF_PTHREAD_RWLOCK_T 32
42# define __SIZEOF_PTHREAD_BARRIER_T 20
43#endif
44#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
45#define __SIZEOF_PTHREAD_COND_T 48
46#define __SIZEOF_PTHREAD_CONDATTR_T 4
47#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
48#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
49
50/* Definitions for internal mutex struct. */
51#define __PTHREAD_COMPAT_PADDING_MID
52#define __PTHREAD_COMPAT_PADDING_END
53#define __PTHREAD_MUTEX_LOCK_ELISION 1
54
55#define __LOCK_ALIGNMENT
56#define __ONCE_ALIGNMENT
57
58struct __pthread_rwlock_arch_t
59{
60 unsigned int __readers;
61 unsigned int __writers;
62 unsigned int __wrphase_futex;
63 unsigned int __writers_futex;
64 unsigned int __pad3;
65 unsigned int __pad4;
66#ifdef __x86_64__
67 int __cur_writer;
68 int __shared;
69 signed char __rwelision;
70# ifdef __ILP32__
71 unsigned char __pad1[3];
72# define __PTHREAD_RWLOCK_ELISION_EXTRA 0, { 0, 0, 0 }
73# else
74 unsigned char __pad1[7];
75# define __PTHREAD_RWLOCK_ELISION_EXTRA 0, { 0, 0, 0, 0, 0, 0, 0 }
76# endif
77 unsigned long int __pad2;
78 /* FLAGS must stay at this position in the structure to maintain
79 binary compatibility. */
80 unsigned int __flags;
81# define __PTHREAD_RWLOCK_INT_FLAGS_SHARED 1
82#else
83 /* FLAGS must stay at this position in the structure to maintain
84 binary compatibility. */
85 unsigned char __flags;
86 unsigned char __shared;
87 signed char __rwelision;
88# define __PTHREAD_RWLOCK_ELISION_EXTRA 0
89 unsigned char __pad2;
90 int __cur_writer;
91#endif
92};
93
94#ifndef __x86_64__
95/* Extra attributes for the cleanup functions. */
96# define __cleanup_fct_attribute __attribute__ ((__regparm__ (1)))
97#endif
98
99#endif /* bits/pthreadtypes.h */
100