xref: /illumos-gate/usr/src/head/pthread.h (revision 7c478bd9)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef _PTHREAD_H
28*7c478bd9Sstevel@tonic-gate #define	_PTHREAD_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h>
33*7c478bd9Sstevel@tonic-gate 
34*7c478bd9Sstevel@tonic-gate #ifndef	_ASM
35*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
36*7c478bd9Sstevel@tonic-gate #include <time.h>
37*7c478bd9Sstevel@tonic-gate #include <sched.h>
38*7c478bd9Sstevel@tonic-gate #endif	/* _ASM */
39*7c478bd9Sstevel@tonic-gate 
40*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
41*7c478bd9Sstevel@tonic-gate extern "C" {
42*7c478bd9Sstevel@tonic-gate #endif
43*7c478bd9Sstevel@tonic-gate 
44*7c478bd9Sstevel@tonic-gate /*
45*7c478bd9Sstevel@tonic-gate  * Thread related attribute values defined as in thread.h.
46*7c478bd9Sstevel@tonic-gate  * These are defined as bit pattern in thread.h.
47*7c478bd9Sstevel@tonic-gate  * Any change here should be reflected in thread.h.
48*7c478bd9Sstevel@tonic-gate  */
49*7c478bd9Sstevel@tonic-gate /* detach */
50*7c478bd9Sstevel@tonic-gate #define	PTHREAD_CREATE_DETACHED		0x40	/* = THR_DETACHED */
51*7c478bd9Sstevel@tonic-gate #define	PTHREAD_CREATE_JOINABLE		0
52*7c478bd9Sstevel@tonic-gate /* scope */
53*7c478bd9Sstevel@tonic-gate #define	PTHREAD_SCOPE_SYSTEM		0x01	/* = THR_BOUND */
54*7c478bd9Sstevel@tonic-gate #define	PTHREAD_SCOPE_PROCESS		0
55*7c478bd9Sstevel@tonic-gate 
56*7c478bd9Sstevel@tonic-gate /*
57*7c478bd9Sstevel@tonic-gate  * Other attributes which are not defined in thread.h
58*7c478bd9Sstevel@tonic-gate  */
59*7c478bd9Sstevel@tonic-gate /* inherit */
60*7c478bd9Sstevel@tonic-gate #define	PTHREAD_INHERIT_SCHED		1
61*7c478bd9Sstevel@tonic-gate #define	PTHREAD_EXPLICIT_SCHED		0
62*7c478bd9Sstevel@tonic-gate 
63*7c478bd9Sstevel@tonic-gate /*
64*7c478bd9Sstevel@tonic-gate  * Value of process-shared attribute
65*7c478bd9Sstevel@tonic-gate  * These are defined as values defined in sys/synch.h
66*7c478bd9Sstevel@tonic-gate  * Any change here should be reflected in sys/synch.h.
67*7c478bd9Sstevel@tonic-gate  */
68*7c478bd9Sstevel@tonic-gate #define	PTHREAD_PROCESS_SHARED		1	/* = USYNC_PROCESS */
69*7c478bd9Sstevel@tonic-gate #define	PTHREAD_PROCESS_PRIVATE		0	/* = USYNC_THREAD */
70*7c478bd9Sstevel@tonic-gate 
71*7c478bd9Sstevel@tonic-gate #define	_DEFAULT_TYPE 			PTHREAD_PROCESS_PRIVATE
72*7c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
73*7c478bd9Sstevel@tonic-gate #define	DEFAULT_TYPE			_DEFAULT_TYPE
74*7c478bd9Sstevel@tonic-gate #endif
75*7c478bd9Sstevel@tonic-gate 
76*7c478bd9Sstevel@tonic-gate /*
77*7c478bd9Sstevel@tonic-gate  * mutex types
78*7c478bd9Sstevel@tonic-gate  * keep these in synch which sys/synch.h lock flags
79*7c478bd9Sstevel@tonic-gate  */
80*7c478bd9Sstevel@tonic-gate #define	PTHREAD_MUTEX_NORMAL		0x0
81*7c478bd9Sstevel@tonic-gate #define	PTHREAD_MUTEX_ERRORCHECK	0x2
82*7c478bd9Sstevel@tonic-gate #define	PTHREAD_MUTEX_RECURSIVE		0x4
83*7c478bd9Sstevel@tonic-gate #define	PTHREAD_MUTEX_DEFAULT		PTHREAD_MUTEX_NORMAL
84*7c478bd9Sstevel@tonic-gate 
85*7c478bd9Sstevel@tonic-gate /*
86*7c478bd9Sstevel@tonic-gate  * Mutex protocol values. Keep these in synch with sys/synch.h lock types.
87*7c478bd9Sstevel@tonic-gate  */
88*7c478bd9Sstevel@tonic-gate #define	PTHREAD_PRIO_NONE		0x0
89*7c478bd9Sstevel@tonic-gate #define	PTHREAD_PRIO_INHERIT		0x10
90*7c478bd9Sstevel@tonic-gate #define	PTHREAD_PRIO_PROTECT		0x20
91*7c478bd9Sstevel@tonic-gate 
92*7c478bd9Sstevel@tonic-gate /*
93*7c478bd9Sstevel@tonic-gate  * Mutex robustness attribute values. The robustness attribute is a
94*7c478bd9Sstevel@tonic-gate  * Solaris specific extension to support robust mutexes. Note the _NP suffix
95*7c478bd9Sstevel@tonic-gate  * to indicate these are not part of the current POSIX spec (POSIX 1003.1 1996),
96*7c478bd9Sstevel@tonic-gate  * but are platform specific non-portable extensions. Keep these in synch
97*7c478bd9Sstevel@tonic-gate  * with sys/synch.h lock types.
98*7c478bd9Sstevel@tonic-gate  */
99*7c478bd9Sstevel@tonic-gate #define	PTHREAD_MUTEX_STALL_NP		0x0
100*7c478bd9Sstevel@tonic-gate #define	PTHREAD_MUTEX_ROBUST_NP		0x40
101*7c478bd9Sstevel@tonic-gate 
102*7c478bd9Sstevel@tonic-gate /*
103*7c478bd9Sstevel@tonic-gate  * macros - default initializers defined as in synch.h
104*7c478bd9Sstevel@tonic-gate  * Any change here should be reflected in synch.h.
105*7c478bd9Sstevel@tonic-gate  *
106*7c478bd9Sstevel@tonic-gate  * NOTE:
107*7c478bd9Sstevel@tonic-gate  * Make sure that any change in the macros is consistent with the definition
108*7c478bd9Sstevel@tonic-gate  * of the corresponding types in sys/types.h (e.g. PTHREAD_MUTEX_INITIALIZER
109*7c478bd9Sstevel@tonic-gate  * should be consistent with the definition for pthread_mutex_t).
110*7c478bd9Sstevel@tonic-gate  */
111*7c478bd9Sstevel@tonic-gate #define	PTHREAD_MUTEX_INITIALIZER		/* = DEFAULTMUTEX */	\
112*7c478bd9Sstevel@tonic-gate 	{{0, 0, 0, _DEFAULT_TYPE, _MUTEX_MAGIC}, {{{0}}}, 0}
113*7c478bd9Sstevel@tonic-gate 
114*7c478bd9Sstevel@tonic-gate #define	PTHREAD_COND_INITIALIZER		/* = DEFAULTCV */	\
115*7c478bd9Sstevel@tonic-gate 	{{{0, 0, 0, 0}, _DEFAULT_TYPE, _COND_MAGIC}, 0}
116*7c478bd9Sstevel@tonic-gate 
117*7c478bd9Sstevel@tonic-gate #define	PTHREAD_RWLOCK_INITIALIZER		/* = DEFAULTRWLOCK */	\
118*7c478bd9Sstevel@tonic-gate 	{0, _DEFAULT_TYPE, _RWL_MAGIC, PTHREAD_MUTEX_INITIALIZER,	\
119*7c478bd9Sstevel@tonic-gate 	PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER}
120*7c478bd9Sstevel@tonic-gate 
121*7c478bd9Sstevel@tonic-gate /* cancellation type and state */
122*7c478bd9Sstevel@tonic-gate #define	PTHREAD_CANCEL_ENABLE		0x00
123*7c478bd9Sstevel@tonic-gate #define	PTHREAD_CANCEL_DISABLE		0x01
124*7c478bd9Sstevel@tonic-gate #define	PTHREAD_CANCEL_DEFERRED		0x00
125*7c478bd9Sstevel@tonic-gate #define	PTHREAD_CANCEL_ASYNCHRONOUS	0x02
126*7c478bd9Sstevel@tonic-gate #define	PTHREAD_CANCELED		(void *)-19
127*7c478bd9Sstevel@tonic-gate 
128*7c478bd9Sstevel@tonic-gate /* pthread_once related values */
129*7c478bd9Sstevel@tonic-gate #define	PTHREAD_ONCE_NOTDONE	0
130*7c478bd9Sstevel@tonic-gate #define	PTHREAD_ONCE_DONE	1
131*7c478bd9Sstevel@tonic-gate #define	PTHREAD_ONCE_INIT	{0, 0, 0, PTHREAD_ONCE_NOTDONE}
132*7c478bd9Sstevel@tonic-gate 
133*7c478bd9Sstevel@tonic-gate /* barriers */
134*7c478bd9Sstevel@tonic-gate #define	PTHREAD_BARRIER_SERIAL_THREAD	-2
135*7c478bd9Sstevel@tonic-gate 
136*7c478bd9Sstevel@tonic-gate #ifndef	_ASM
137*7c478bd9Sstevel@tonic-gate 
138*7c478bd9Sstevel@tonic-gate /*
139*7c478bd9Sstevel@tonic-gate  * cancellation cleanup structure
140*7c478bd9Sstevel@tonic-gate  */
141*7c478bd9Sstevel@tonic-gate typedef struct _cleanup {
142*7c478bd9Sstevel@tonic-gate 	uintptr_t	pthread_cleanup_pad[4];
143*7c478bd9Sstevel@tonic-gate } _cleanup_t;
144*7c478bd9Sstevel@tonic-gate 
145*7c478bd9Sstevel@tonic-gate #ifdef	__STDC__
146*7c478bd9Sstevel@tonic-gate 
147*7c478bd9Sstevel@tonic-gate void	__pthread_cleanup_push(void (*)(void *), void *, caddr_t, _cleanup_t *);
148*7c478bd9Sstevel@tonic-gate void	__pthread_cleanup_pop(int, _cleanup_t *);
149*7c478bd9Sstevel@tonic-gate caddr_t	_getfp(void);
150*7c478bd9Sstevel@tonic-gate 
151*7c478bd9Sstevel@tonic-gate #else	/* __STDC__ */
152*7c478bd9Sstevel@tonic-gate 
153*7c478bd9Sstevel@tonic-gate void	__pthread_cleanup_push();
154*7c478bd9Sstevel@tonic-gate void	__pthread_cleanup_pop();
155*7c478bd9Sstevel@tonic-gate caddr_t	_getfp();
156*7c478bd9Sstevel@tonic-gate 
157*7c478bd9Sstevel@tonic-gate #endif	/* __STDC__ */
158*7c478bd9Sstevel@tonic-gate 
159*7c478bd9Sstevel@tonic-gate #if __cplusplus
160*7c478bd9Sstevel@tonic-gate extern "C" {
161*7c478bd9Sstevel@tonic-gate #endif
162*7c478bd9Sstevel@tonic-gate 
163*7c478bd9Sstevel@tonic-gate typedef void (*_Voidfp)(void*); /* pointer to extern "C" function */
164*7c478bd9Sstevel@tonic-gate 
165*7c478bd9Sstevel@tonic-gate #if __cplusplus
166*7c478bd9Sstevel@tonic-gate } /* extern "C" */
167*7c478bd9Sstevel@tonic-gate #endif
168*7c478bd9Sstevel@tonic-gate 
169*7c478bd9Sstevel@tonic-gate #define	pthread_cleanup_push(routine, args) { \
170*7c478bd9Sstevel@tonic-gate 	_cleanup_t _cleanup_info; \
171*7c478bd9Sstevel@tonic-gate 	__pthread_cleanup_push((_Voidfp)(routine), (void *)(args), \
172*7c478bd9Sstevel@tonic-gate 				(caddr_t)_getfp(), &_cleanup_info);
173*7c478bd9Sstevel@tonic-gate 
174*7c478bd9Sstevel@tonic-gate #define	pthread_cleanup_pop(ex) \
175*7c478bd9Sstevel@tonic-gate 	__pthread_cleanup_pop(ex, &_cleanup_info); \
176*7c478bd9Sstevel@tonic-gate }
177*7c478bd9Sstevel@tonic-gate 
178*7c478bd9Sstevel@tonic-gate #ifdef	__STDC__
179*7c478bd9Sstevel@tonic-gate 
180*7c478bd9Sstevel@tonic-gate /*
181*7c478bd9Sstevel@tonic-gate  * function prototypes - thread related calls
182*7c478bd9Sstevel@tonic-gate  */
183*7c478bd9Sstevel@tonic-gate 
184*7c478bd9Sstevel@tonic-gate /*
185*7c478bd9Sstevel@tonic-gate  * pthread_atfork() is also declared in <unistd.h> as per SUSv2. The
186*7c478bd9Sstevel@tonic-gate  * declarations are identical. A change to either one may also require
187*7c478bd9Sstevel@tonic-gate  * appropriate namespace updates in order to avoid redeclaration
188*7c478bd9Sstevel@tonic-gate  * warnings in the case where both prototypes are exposed via inclusion
189*7c478bd9Sstevel@tonic-gate  * of both <pthread.h> and <unistd.h>.
190*7c478bd9Sstevel@tonic-gate  */
191*7c478bd9Sstevel@tonic-gate extern int pthread_atfork(void (*) (void), void (*) (void), void (*) (void));
192*7c478bd9Sstevel@tonic-gate extern int pthread_attr_init(pthread_attr_t *);
193*7c478bd9Sstevel@tonic-gate extern int pthread_attr_destroy(pthread_attr_t *);
194*7c478bd9Sstevel@tonic-gate extern int pthread_attr_setstack(pthread_attr_t *, void *, size_t);
195*7c478bd9Sstevel@tonic-gate extern int pthread_attr_getstack(const pthread_attr_t *_RESTRICT_KYWD,
196*7c478bd9Sstevel@tonic-gate 		void **_RESTRICT_KYWD, size_t *_RESTRICT_KYWD);
197*7c478bd9Sstevel@tonic-gate extern int pthread_attr_setstacksize(pthread_attr_t *, size_t);
198*7c478bd9Sstevel@tonic-gate extern int pthread_attr_getstacksize(const pthread_attr_t *_RESTRICT_KYWD,
199*7c478bd9Sstevel@tonic-gate 		size_t *_RESTRICT_KYWD);
200*7c478bd9Sstevel@tonic-gate extern int pthread_attr_setstackaddr(pthread_attr_t *, void *);
201*7c478bd9Sstevel@tonic-gate extern int pthread_attr_getstackaddr(const pthread_attr_t *_RESTRICT_KYWD,
202*7c478bd9Sstevel@tonic-gate 		void **_RESTRICT_KYWD);
203*7c478bd9Sstevel@tonic-gate extern int pthread_attr_setdetachstate(pthread_attr_t *, int);
204*7c478bd9Sstevel@tonic-gate extern int pthread_attr_getdetachstate(const pthread_attr_t *, int *);
205*7c478bd9Sstevel@tonic-gate extern int pthread_attr_setscope(pthread_attr_t *, int);
206*7c478bd9Sstevel@tonic-gate extern int pthread_attr_getscope(const pthread_attr_t *_RESTRICT_KYWD,
207*7c478bd9Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
208*7c478bd9Sstevel@tonic-gate extern int pthread_attr_setinheritsched(pthread_attr_t *, int);
209*7c478bd9Sstevel@tonic-gate extern int pthread_attr_getinheritsched(const pthread_attr_t *_RESTRICT_KYWD,
210*7c478bd9Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
211*7c478bd9Sstevel@tonic-gate extern int pthread_attr_setschedpolicy(pthread_attr_t *, int);
212*7c478bd9Sstevel@tonic-gate extern int pthread_attr_getschedpolicy(const pthread_attr_t *_RESTRICT_KYWD,
213*7c478bd9Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
214*7c478bd9Sstevel@tonic-gate extern int pthread_attr_setschedparam(pthread_attr_t *_RESTRICT_KYWD,
215*7c478bd9Sstevel@tonic-gate 		const struct sched_param *_RESTRICT_KYWD);
216*7c478bd9Sstevel@tonic-gate extern int pthread_attr_getschedparam(const pthread_attr_t *_RESTRICT_KYWD,
217*7c478bd9Sstevel@tonic-gate 		struct sched_param *_RESTRICT_KYWD);
218*7c478bd9Sstevel@tonic-gate extern int pthread_create(pthread_t *_RESTRICT_KYWD,
219*7c478bd9Sstevel@tonic-gate 		const pthread_attr_t *_RESTRICT_KYWD, void * (*)(void *),
220*7c478bd9Sstevel@tonic-gate 		void *_RESTRICT_KYWD);
221*7c478bd9Sstevel@tonic-gate extern int pthread_once(pthread_once_t *, void (*)(void));
222*7c478bd9Sstevel@tonic-gate extern int pthread_join(pthread_t, void **);
223*7c478bd9Sstevel@tonic-gate extern int pthread_detach(pthread_t);
224*7c478bd9Sstevel@tonic-gate extern void pthread_exit(void *) __NORETURN;
225*7c478bd9Sstevel@tonic-gate extern int pthread_cancel(pthread_t);
226*7c478bd9Sstevel@tonic-gate extern int pthread_setschedparam(pthread_t, int, const struct sched_param *);
227*7c478bd9Sstevel@tonic-gate extern int pthread_getschedparam(pthread_t, int *_RESTRICT_KYWD,
228*7c478bd9Sstevel@tonic-gate 		struct sched_param *_RESTRICT_KYWD);
229*7c478bd9Sstevel@tonic-gate extern int pthread_setschedprio(pthread_t, int);
230*7c478bd9Sstevel@tonic-gate extern int pthread_setcancelstate(int, int *);
231*7c478bd9Sstevel@tonic-gate extern int pthread_setcanceltype(int, int *);
232*7c478bd9Sstevel@tonic-gate extern void pthread_testcancel(void);
233*7c478bd9Sstevel@tonic-gate extern int pthread_equal(pthread_t, pthread_t);
234*7c478bd9Sstevel@tonic-gate extern int pthread_key_create(pthread_key_t *, void (*)(void *));
235*7c478bd9Sstevel@tonic-gate extern int pthread_key_delete(pthread_key_t);
236*7c478bd9Sstevel@tonic-gate extern int pthread_setspecific(pthread_key_t, const void *);
237*7c478bd9Sstevel@tonic-gate extern void *pthread_getspecific(pthread_key_t);
238*7c478bd9Sstevel@tonic-gate extern pthread_t pthread_self(void);
239*7c478bd9Sstevel@tonic-gate 
240*7c478bd9Sstevel@tonic-gate /*
241*7c478bd9Sstevel@tonic-gate  * function prototypes - synchronization related calls
242*7c478bd9Sstevel@tonic-gate  */
243*7c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_init(pthread_mutexattr_t *);
244*7c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_destroy(pthread_mutexattr_t *);
245*7c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int);
246*7c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_getpshared(
247*7c478bd9Sstevel@tonic-gate 	const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
248*7c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int);
249*7c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_getprotocol(
250*7c478bd9Sstevel@tonic-gate 	const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
251*7c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int);
252*7c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_getprioceiling(
253*7c478bd9Sstevel@tonic-gate 	const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
254*7c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_setrobust_np(pthread_mutexattr_t *, int);
255*7c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_getrobust_np(
256*7c478bd9Sstevel@tonic-gate 	const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
257*7c478bd9Sstevel@tonic-gate extern int pthread_mutex_init(pthread_mutex_t *_RESTRICT_KYWD,
258*7c478bd9Sstevel@tonic-gate 	const pthread_mutexattr_t *_RESTRICT_KYWD);
259*7c478bd9Sstevel@tonic-gate extern int pthread_mutex_consistent_np(pthread_mutex_t *);
260*7c478bd9Sstevel@tonic-gate extern int pthread_mutex_destroy(pthread_mutex_t *);
261*7c478bd9Sstevel@tonic-gate extern int pthread_mutex_lock(pthread_mutex_t *);
262*7c478bd9Sstevel@tonic-gate extern int pthread_mutex_timedlock(pthread_mutex_t *_RESTRICT_KYWD,
263*7c478bd9Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
264*7c478bd9Sstevel@tonic-gate extern int pthread_mutex_reltimedlock_np(pthread_mutex_t *_RESTRICT_KYWD,
265*7c478bd9Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
266*7c478bd9Sstevel@tonic-gate extern int pthread_mutex_unlock(pthread_mutex_t *);
267*7c478bd9Sstevel@tonic-gate extern int pthread_mutex_trylock(pthread_mutex_t *);
268*7c478bd9Sstevel@tonic-gate extern int pthread_mutex_setprioceiling(pthread_mutex_t *_RESTRICT_KYWD,
269*7c478bd9Sstevel@tonic-gate 	int, int *_RESTRICT_KYWD);
270*7c478bd9Sstevel@tonic-gate extern int pthread_mutex_getprioceiling(const pthread_mutex_t *_RESTRICT_KYWD,
271*7c478bd9Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
272*7c478bd9Sstevel@tonic-gate extern int pthread_condattr_init(pthread_condattr_t *);
273*7c478bd9Sstevel@tonic-gate extern int pthread_condattr_destroy(pthread_condattr_t *);
274*7c478bd9Sstevel@tonic-gate extern int pthread_condattr_setclock(pthread_condattr_t *, clockid_t);
275*7c478bd9Sstevel@tonic-gate extern int pthread_condattr_getclock(const pthread_condattr_t *_RESTRICT_KYWD,
276*7c478bd9Sstevel@tonic-gate 	clockid_t *_RESTRICT_KYWD);
277*7c478bd9Sstevel@tonic-gate extern int pthread_condattr_setpshared(pthread_condattr_t *, int);
278*7c478bd9Sstevel@tonic-gate extern int pthread_condattr_getpshared(const pthread_condattr_t *_RESTRICT_KYWD,
279*7c478bd9Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
280*7c478bd9Sstevel@tonic-gate extern int pthread_cond_init(pthread_cond_t *_RESTRICT_KYWD,
281*7c478bd9Sstevel@tonic-gate 	const pthread_condattr_t *_RESTRICT_KYWD);
282*7c478bd9Sstevel@tonic-gate extern int pthread_cond_destroy(pthread_cond_t *);
283*7c478bd9Sstevel@tonic-gate extern int pthread_cond_broadcast(pthread_cond_t *);
284*7c478bd9Sstevel@tonic-gate extern int pthread_cond_signal(pthread_cond_t *);
285*7c478bd9Sstevel@tonic-gate extern int pthread_cond_wait(pthread_cond_t *_RESTRICT_KYWD,
286*7c478bd9Sstevel@tonic-gate 	pthread_mutex_t *_RESTRICT_KYWD);
287*7c478bd9Sstevel@tonic-gate extern int pthread_cond_timedwait(pthread_cond_t *_RESTRICT_KYWD,
288*7c478bd9Sstevel@tonic-gate 	pthread_mutex_t *_RESTRICT_KYWD, const struct timespec *_RESTRICT_KYWD);
289*7c478bd9Sstevel@tonic-gate extern int pthread_cond_reltimedwait_np(pthread_cond_t *_RESTRICT_KYWD,
290*7c478bd9Sstevel@tonic-gate 	pthread_mutex_t *_RESTRICT_KYWD, const struct timespec *_RESTRICT_KYWD);
291*7c478bd9Sstevel@tonic-gate extern int pthread_attr_getguardsize(const pthread_attr_t *_RESTRICT_KYWD,
292*7c478bd9Sstevel@tonic-gate 	size_t *_RESTRICT_KYWD);
293*7c478bd9Sstevel@tonic-gate extern int pthread_attr_setguardsize(pthread_attr_t *, size_t);
294*7c478bd9Sstevel@tonic-gate extern int pthread_getconcurrency(void);
295*7c478bd9Sstevel@tonic-gate extern int pthread_setconcurrency(int);
296*7c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_settype(pthread_mutexattr_t *, int);
297*7c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_gettype(const pthread_mutexattr_t *_RESTRICT_KYWD,
298*7c478bd9Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
299*7c478bd9Sstevel@tonic-gate extern int pthread_rwlock_init(pthread_rwlock_t *_RESTRICT_KYWD,
300*7c478bd9Sstevel@tonic-gate 	const pthread_rwlockattr_t *_RESTRICT_KYWD);
301*7c478bd9Sstevel@tonic-gate extern int pthread_rwlock_destroy(pthread_rwlock_t *);
302*7c478bd9Sstevel@tonic-gate extern int pthread_rwlock_rdlock(pthread_rwlock_t *);
303*7c478bd9Sstevel@tonic-gate extern int pthread_rwlock_timedrdlock(pthread_rwlock_t *_RESTRICT_KYWD,
304*7c478bd9Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
305*7c478bd9Sstevel@tonic-gate extern int pthread_rwlock_reltimedrdlock_np(pthread_rwlock_t *_RESTRICT_KYWD,
306*7c478bd9Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
307*7c478bd9Sstevel@tonic-gate extern int pthread_rwlock_tryrdlock(pthread_rwlock_t *);
308*7c478bd9Sstevel@tonic-gate extern int pthread_rwlock_wrlock(pthread_rwlock_t *);
309*7c478bd9Sstevel@tonic-gate extern int pthread_rwlock_timedwrlock(pthread_rwlock_t *_RESTRICT_KYWD,
310*7c478bd9Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
311*7c478bd9Sstevel@tonic-gate extern int pthread_rwlock_reltimedwrlock_np(pthread_rwlock_t *_RESTRICT_KYWD,
312*7c478bd9Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
313*7c478bd9Sstevel@tonic-gate extern int pthread_rwlock_trywrlock(pthread_rwlock_t *);
314*7c478bd9Sstevel@tonic-gate extern int pthread_rwlock_unlock(pthread_rwlock_t *);
315*7c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_init(pthread_rwlockattr_t *);
316*7c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_destroy(pthread_rwlockattr_t *);
317*7c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_getpshared(
318*7c478bd9Sstevel@tonic-gate 	const pthread_rwlockattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
319*7c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int);
320*7c478bd9Sstevel@tonic-gate extern int pthread_spin_init(pthread_spinlock_t *, int);
321*7c478bd9Sstevel@tonic-gate extern int pthread_spin_destroy(pthread_spinlock_t *);
322*7c478bd9Sstevel@tonic-gate extern int pthread_spin_lock(pthread_spinlock_t *);
323*7c478bd9Sstevel@tonic-gate extern int pthread_spin_trylock(pthread_spinlock_t *);
324*7c478bd9Sstevel@tonic-gate extern int pthread_spin_unlock(pthread_spinlock_t *);
325*7c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_init(pthread_barrierattr_t *);
326*7c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_destroy(pthread_barrierattr_t *);
327*7c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int);
328*7c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_getpshared(
329*7c478bd9Sstevel@tonic-gate 	const pthread_barrierattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
330*7c478bd9Sstevel@tonic-gate extern int pthread_barrier_init(pthread_barrier_t *_RESTRICT_KYWD,
331*7c478bd9Sstevel@tonic-gate 	const pthread_barrierattr_t *_RESTRICT_KYWD, uint_t);
332*7c478bd9Sstevel@tonic-gate extern int pthread_barrier_destroy(pthread_barrier_t *);
333*7c478bd9Sstevel@tonic-gate extern int pthread_barrier_wait(pthread_barrier_t *);
334*7c478bd9Sstevel@tonic-gate 
335*7c478bd9Sstevel@tonic-gate #else	/* __STDC__ */
336*7c478bd9Sstevel@tonic-gate 
337*7c478bd9Sstevel@tonic-gate /*
338*7c478bd9Sstevel@tonic-gate  * function prototypes - thread related calls
339*7c478bd9Sstevel@tonic-gate  */
340*7c478bd9Sstevel@tonic-gate extern int pthread_atfork();
341*7c478bd9Sstevel@tonic-gate extern int pthread_attr_init();
342*7c478bd9Sstevel@tonic-gate extern int pthread_attr_destroy();
343*7c478bd9Sstevel@tonic-gate extern int pthread_attr_setstack();
344*7c478bd9Sstevel@tonic-gate extern int pthread_attr_getstack();
345*7c478bd9Sstevel@tonic-gate extern int pthread_attr_setstacksize();
346*7c478bd9Sstevel@tonic-gate extern int pthread_attr_getstacksize();
347*7c478bd9Sstevel@tonic-gate extern int pthread_attr_setstackaddr();
348*7c478bd9Sstevel@tonic-gate extern int pthread_attr_getstackaddr();
349*7c478bd9Sstevel@tonic-gate extern int pthread_attr_setdetachstate();
350*7c478bd9Sstevel@tonic-gate extern int pthread_attr_getdetachstate();
351*7c478bd9Sstevel@tonic-gate extern int pthread_attr_setscope();
352*7c478bd9Sstevel@tonic-gate extern int pthread_attr_getscope();
353*7c478bd9Sstevel@tonic-gate extern int pthread_attr_setinheritsched();
354*7c478bd9Sstevel@tonic-gate extern int pthread_attr_getinheritsched();
355*7c478bd9Sstevel@tonic-gate extern int pthread_attr_setschedpolicy();
356*7c478bd9Sstevel@tonic-gate extern int pthread_attr_getschedpolicy();
357*7c478bd9Sstevel@tonic-gate extern int pthread_attr_setschedparam();
358*7c478bd9Sstevel@tonic-gate extern int pthread_attr_getschedparam();
359*7c478bd9Sstevel@tonic-gate extern int pthread_create();
360*7c478bd9Sstevel@tonic-gate extern int pthread_once();
361*7c478bd9Sstevel@tonic-gate extern int pthread_join();
362*7c478bd9Sstevel@tonic-gate extern int pthread_detach();
363*7c478bd9Sstevel@tonic-gate extern void pthread_exit();
364*7c478bd9Sstevel@tonic-gate extern int pthread_cancel();
365*7c478bd9Sstevel@tonic-gate extern int pthread_setschedparam();
366*7c478bd9Sstevel@tonic-gate extern int pthread_getschedparam();
367*7c478bd9Sstevel@tonic-gate extern int pthread_setschedprio();
368*7c478bd9Sstevel@tonic-gate extern int pthread_setcancelstate();
369*7c478bd9Sstevel@tonic-gate extern int pthread_setcanceltype();
370*7c478bd9Sstevel@tonic-gate extern void pthread_testcancel();
371*7c478bd9Sstevel@tonic-gate extern int pthread_equal();
372*7c478bd9Sstevel@tonic-gate extern int pthread_key_create();
373*7c478bd9Sstevel@tonic-gate extern int pthread_key_delete();
374*7c478bd9Sstevel@tonic-gate extern int pthread_setspecific();
375*7c478bd9Sstevel@tonic-gate extern void *pthread_getspecific();
376*7c478bd9Sstevel@tonic-gate extern pthread_t pthread_self();
377*7c478bd9Sstevel@tonic-gate /*
378*7c478bd9Sstevel@tonic-gate  * function prototypes - synchronization related calls
379*7c478bd9Sstevel@tonic-gate  */
380*7c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_init();
381*7c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_destroy();
382*7c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_setpshared();
383*7c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_getpshared();
384*7c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_setprotocol();
385*7c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_getprotocol();
386*7c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_setprioceiling();
387*7c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_getprioceiling();
388*7c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_setrobust_np();
389*7c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_getrobust_np();
390*7c478bd9Sstevel@tonic-gate extern int pthread_mutex_init();
391*7c478bd9Sstevel@tonic-gate extern int pthread_mutex_consistent_np();
392*7c478bd9Sstevel@tonic-gate extern int pthread_mutex_destroy();
393*7c478bd9Sstevel@tonic-gate extern int pthread_mutex_lock();
394*7c478bd9Sstevel@tonic-gate extern int pthread_mutex_timedlock();
395*7c478bd9Sstevel@tonic-gate extern int pthread_mutex_reltimedlock_np();
396*7c478bd9Sstevel@tonic-gate extern int pthread_mutex_unlock();
397*7c478bd9Sstevel@tonic-gate extern int pthread_mutex_trylock();
398*7c478bd9Sstevel@tonic-gate extern int pthread_mutex_setprioceiling();
399*7c478bd9Sstevel@tonic-gate extern int pthread_mutex_getprioceiling();
400*7c478bd9Sstevel@tonic-gate extern int pthread_condattr_init();
401*7c478bd9Sstevel@tonic-gate extern int pthread_condattr_destroy();
402*7c478bd9Sstevel@tonic-gate extern int pthread_condattr_setclock();
403*7c478bd9Sstevel@tonic-gate extern int pthread_condattr_getclock();
404*7c478bd9Sstevel@tonic-gate extern int pthread_condattr_setpshared();
405*7c478bd9Sstevel@tonic-gate extern int pthread_condattr_getpshared();
406*7c478bd9Sstevel@tonic-gate extern int pthread_cond_init();
407*7c478bd9Sstevel@tonic-gate extern int pthread_cond_destroy();
408*7c478bd9Sstevel@tonic-gate extern int pthread_cond_broadcast();
409*7c478bd9Sstevel@tonic-gate extern int pthread_cond_signal();
410*7c478bd9Sstevel@tonic-gate extern int pthread_cond_wait();
411*7c478bd9Sstevel@tonic-gate extern int pthread_cond_timedwait();
412*7c478bd9Sstevel@tonic-gate extern int pthread_cond_reltimedwait_np();
413*7c478bd9Sstevel@tonic-gate extern int pthread_attr_getguardsize();
414*7c478bd9Sstevel@tonic-gate extern int pthread_attr_setguardsize();
415*7c478bd9Sstevel@tonic-gate extern int pthread_getconcurrency();
416*7c478bd9Sstevel@tonic-gate extern int pthread_setconcurrency();
417*7c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_settype();
418*7c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_gettype();
419*7c478bd9Sstevel@tonic-gate extern int pthread_rwlock_init();
420*7c478bd9Sstevel@tonic-gate extern int pthread_rwlock_destroy();
421*7c478bd9Sstevel@tonic-gate extern int pthread_rwlock_rdlock();
422*7c478bd9Sstevel@tonic-gate extern int pthread_rwlock_tryrdlock();
423*7c478bd9Sstevel@tonic-gate extern int pthread_rwlock_wrlock();
424*7c478bd9Sstevel@tonic-gate extern int pthread_rwlock_trywrlock();
425*7c478bd9Sstevel@tonic-gate extern int pthread_rwlock_unlock();
426*7c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_init();
427*7c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_destroy();
428*7c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_getpshared();
429*7c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_setpshared();
430*7c478bd9Sstevel@tonic-gate extern int pthread_spin_init();
431*7c478bd9Sstevel@tonic-gate extern int pthread_spin_destroy();
432*7c478bd9Sstevel@tonic-gate extern int pthread_spin_lock();
433*7c478bd9Sstevel@tonic-gate extern int pthread_spin_trylock();
434*7c478bd9Sstevel@tonic-gate extern int pthread_spin_unlock();
435*7c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_init();
436*7c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_destroy();
437*7c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_setpshared();
438*7c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_getpshared();
439*7c478bd9Sstevel@tonic-gate extern int pthread_barrier_init();
440*7c478bd9Sstevel@tonic-gate extern int pthread_barrier_destroy();
441*7c478bd9Sstevel@tonic-gate extern int pthread_barrier_wait();
442*7c478bd9Sstevel@tonic-gate 
443*7c478bd9Sstevel@tonic-gate #endif	/* __STDC__ */
444*7c478bd9Sstevel@tonic-gate 
445*7c478bd9Sstevel@tonic-gate #endif	/* _ASM */
446*7c478bd9Sstevel@tonic-gate 
447*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
448*7c478bd9Sstevel@tonic-gate }
449*7c478bd9Sstevel@tonic-gate #endif
450*7c478bd9Sstevel@tonic-gate 
451*7c478bd9Sstevel@tonic-gate #endif	/* _PTHREAD_H */
452