1 /* MIPS internal rwlock struct definitions.
2    Copyright (C) 2019-2021 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4 
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9 
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14 
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, see
17    <http://www.gnu.org/licenses/>.  */
18 
19 #ifndef _RWLOCK_INTERNAL_H
20 #define _RWLOCK_INTERNAL_H
21 
22 struct __pthread_rwlock_arch_t
23 {
24   unsigned int __readers;
25   unsigned int __writers;
26   unsigned int __wrphase_futex;
27   unsigned int __writers_futex;
28   unsigned int __pad3;
29   unsigned int __pad4;
30 #if _MIPS_SIM == _ABI64
31   int __cur_writer;
32   int __shared;
33   unsigned long int __pad1;
34   unsigned long int __pad2;
35   /* FLAGS must stay at this position in the structure to maintain
36      binary compatibility.  */
37   unsigned int __flags;
38 # else
39 # if __BYTE_ORDER == __BIG_ENDIAN
40   unsigned char __pad1;
41   unsigned char __pad2;
42   unsigned char __shared;
43   /* FLAGS must stay at this position in the structure to maintain
44      binary compatibility.  */
45   unsigned char __flags;
46 # else
47   /* FLAGS must stay at this position in the structure to maintain
48      binary compatibility.  */
49   unsigned char __flags;
50   unsigned char __shared;
51   unsigned char __pad1;
52   unsigned char __pad2;
53 # endif
54   int __cur_writer;
55 #endif
56 };
57 
58 #if _MIPS_SIM == _ABI64
59 # define __PTHREAD_RWLOCK_INITIALIZER(__flags) \
60   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags
61 #else
62 # if __BYTE_ORDER == __BIG_ENDIAN
63 #  define __PTHREAD_RWLOCK_INITIALIZER(__flags) \
64   0, 0, 0, 0, 0, 0, 0, 0, 0, __flags, 0
65 # else
66 #  define __PTHREAD_RWLOCK_INITIALIZER(__flags) \
67   0, 0, 0, 0, 0, 0, __flags, 0, 0, 0, 0
68 # endif
69 #endif
70 
71 #endif