summaryrefslogtreecommitdiff
path: root/nptl/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/synch.h
blob: c9776141154cd22c8f30a813dd4f94c6a531c526 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/* Copyright (C) 2008 Free Software Foundation, Inc.
   This file is part of the GNU C Library.
   Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.

   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, write to the Free
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   02111-1307 USA.  */

#include <bits/types.h>

#if (defined __need_pthread_bits  && !defined __pthread_bits_defined) || \
    (defined __need_synch_bits  && !defined __synch_bits_defined)

# ifdef __need_pthread_bits
typedef struct
# else
typedef struct _lwp_mutex
# endif
  {
	struct
	  {
		__uint16_t flag1;
		__uint8_t flag2;
		__uint8_t ceiling;
		union
		  {
			__uint16_t bcptype;
			struct
			  {
				__uint8_t count_type1;
				__uint8_t count_type2;
			  } mtype_rcount;
		  } mbcp_type_un;
		__uint16_t magic;
	  } flags;
	union
	  {
		struct
		  {
			__uint8_t pad[8];
		  } lock64;
		struct
		  {
			__uint32_t ownerpid;
			__uint32_t lockword;
		  } lock32;
		__uint64_t owner64;
	} lock;
/* XXX: This is a non-standard use of data (see NOTES.opensolaris).  */
	union
	  {
		__uint64_t data64;
		struct
		  {
			__uint32_t owner;
			__uint32_t cond_waiters;
		  } data32;
	  } data;
# ifdef __need_pthread_bits
  } pthread_mutex_t;
# else
  } lwp_mutex_t;
# endif

# ifdef __need_pthread_bits
typedef struct
# else
typedef struct _lwp_cond
# endif
{
	struct
	  {
		__uint8_t flag[4];
		__uint16_t type;
		__uint16_t magic;
	  } flags;
	__uint64_t data;
# ifdef __need_pthread_bits
  } pthread_cond_t;
# else
  } lwp_cond_t;
# endif

#endif /* defined __need_pthread_bits  && !defined ... */

#if (defined __need_pthread_bits  && (defined __USE_UNIX98 || \
    defined __USE_XOPEN2K) && !defined __pthread_bits_defined) || \
    (defined __need_synch_bits && !defined __synch_bits_defined)

# ifdef __need_pthread_bits
typedef struct
# else
typedef struct _lwp_rwlock
# endif
  {
	__int32_t readers;
	__uint16_t type;
	__uint16_t magic;
# ifdef __need_pthread_bits
	pthread_mutex_t mutex;
	pthread_cond_t readercv;
	pthread_cond_t writercv;
# else
	lwp_mutex_t mutex;
	lwp_cond_t readercv;
	lwp_cond_t writercv;
# endif
/* XXX: These are non-standard additions (see NOTES.opensolaris).  */
    __uint64_t owner;
	__uint32_t ownerpid;
	__uint32_t pad;
# ifdef __need_pthread_bits
  } pthread_rwlock_t;
# else
} lwp_rwlock_t;
# endif

#endif /* defined __need_pthread_bits && !defined ... */

#if (defined __need_semaphore_bits && !defined __semaphore_bits_defined) || \
    (defined __need_synch_bits && !defined __synch_bits_defined)

#ifdef __need_semaphore_bits
typedef struct
#else
typedef struct _lwp_sema
#endif
  {
	__uint32_t count;
	__uint16_t type;
	__uint16_t magic;
	__uint8_t flags[8];
	__uint64_t data;
#ifdef __need_semaphore_bits
  } sem_t;
#else
  } lwp_sema_t;
#endif

#endif /* defined __need_semaphore_bits && !defined ... */

#ifdef __need_pthread_bits
# undef __need_pthread_bits
# define __pthread_bits_defined
#endif
#ifdef __need_semaphore_bits
# undef __need_semaphore_bits
# define __semaphore_bits_defined
#endif
#ifdef __need_synch_bits
# undef __need_synch_bits
# define __synch_bits_defined
#endif