1 | /* Copyright (C) 2002-2019 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 | #ifdef __x86_64__ |
55 | # define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0 |
56 | # define __PTHREAD_MUTEX_USE_UNION 0 |
57 | #else |
58 | # define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1 |
59 | # define __PTHREAD_MUTEX_USE_UNION 1 |
60 | #endif |
61 | |
62 | #define __LOCK_ALIGNMENT |
63 | #define __ONCE_ALIGNMENT |
64 | |
65 | struct __pthread_rwlock_arch_t |
66 | { |
67 | unsigned int __readers; |
68 | unsigned int __writers; |
69 | unsigned int __wrphase_futex; |
70 | unsigned int __writers_futex; |
71 | unsigned int __pad3; |
72 | unsigned int __pad4; |
73 | #ifdef __x86_64__ |
74 | int __cur_writer; |
75 | int __shared; |
76 | signed char __rwelision; |
77 | # ifdef __ILP32__ |
78 | unsigned char __pad1[3]; |
79 | # define __PTHREAD_RWLOCK_ELISION_EXTRA 0, { 0, 0, 0 } |
80 | # else |
81 | unsigned char __pad1[7]; |
82 | # define 0, { 0, 0, 0, 0, 0, 0, 0 } |
83 | # endif |
84 | unsigned long int __pad2; |
85 | /* FLAGS must stay at this position in the structure to maintain |
86 | binary compatibility. */ |
87 | unsigned int __flags; |
88 | # define __PTHREAD_RWLOCK_INT_FLAGS_SHARED 1 |
89 | #else |
90 | /* FLAGS must stay at this position in the structure to maintain |
91 | binary compatibility. */ |
92 | unsigned char __flags; |
93 | unsigned char __shared; |
94 | signed char __rwelision; |
95 | # define __PTHREAD_RWLOCK_ELISION_EXTRA 0 |
96 | unsigned char __pad2; |
97 | int __cur_writer; |
98 | #endif |
99 | }; |
100 | |
101 | #ifndef __x86_64__ |
102 | /* Extra attributes for the cleanup functions. */ |
103 | # define __cleanup_fct_attribute __attribute__ ((__regparm__ (1))) |
104 | #endif |
105 | |
106 | #endif /* bits/pthreadtypes.h */ |
107 | |