xref: /illumos-gate/usr/src/head/pthread.h (revision 50718d3e)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5cb620785Sraf  * Common Development and Distribution License (the "License").
6cb620785Sraf  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
21cb620785Sraf 
227c478bd9Sstevel@tonic-gate /*
23ba3594baSGarrett D'Amore  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24ab618543SJohn Levon  * Copyright 2018 Joyent, Inc.
257bb0eb34SAndy Fiddaman  * Copyright 2022 OmniOS Community Edition (OmniOSce) Association.
26ba3594baSGarrett D'Amore  *
271e2ea07cSRoger A. Faulkner  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
287c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
297c478bd9Sstevel@tonic-gate  */
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifndef _PTHREAD_H
327c478bd9Sstevel@tonic-gate #define	_PTHREAD_H
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h>
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate #ifndef	_ASM
377c478bd9Sstevel@tonic-gate #include <sys/types.h>
387c478bd9Sstevel@tonic-gate #include <time.h>
397c478bd9Sstevel@tonic-gate #include <sched.h>
407c478bd9Sstevel@tonic-gate #endif	/* _ASM */
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
437c478bd9Sstevel@tonic-gate extern "C" {
447c478bd9Sstevel@tonic-gate #endif
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate /*
477c478bd9Sstevel@tonic-gate  * Thread related attribute values defined as in thread.h.
487c478bd9Sstevel@tonic-gate  * These are defined as bit pattern in thread.h.
497c478bd9Sstevel@tonic-gate  * Any change here should be reflected in thread.h.
507c478bd9Sstevel@tonic-gate  */
517c478bd9Sstevel@tonic-gate /* detach */
527c478bd9Sstevel@tonic-gate #define	PTHREAD_CREATE_DETACHED		0x40	/* = THR_DETACHED */
537c478bd9Sstevel@tonic-gate #define	PTHREAD_CREATE_JOINABLE		0
547c478bd9Sstevel@tonic-gate /* scope */
557c478bd9Sstevel@tonic-gate #define	PTHREAD_SCOPE_SYSTEM		0x01	/* = THR_BOUND */
567c478bd9Sstevel@tonic-gate #define	PTHREAD_SCOPE_PROCESS		0
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate /*
597c478bd9Sstevel@tonic-gate  * Other attributes which are not defined in thread.h
607c478bd9Sstevel@tonic-gate  */
617c478bd9Sstevel@tonic-gate /* inherit */
627c478bd9Sstevel@tonic-gate #define	PTHREAD_INHERIT_SCHED		1
637c478bd9Sstevel@tonic-gate #define	PTHREAD_EXPLICIT_SCHED		0
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate /*
667c478bd9Sstevel@tonic-gate  * Value of process-shared attribute
677c478bd9Sstevel@tonic-gate  * These are defined as values defined in sys/synch.h
687c478bd9Sstevel@tonic-gate  * Any change here should be reflected in sys/synch.h.
697c478bd9Sstevel@tonic-gate  */
707c478bd9Sstevel@tonic-gate #define	PTHREAD_PROCESS_SHARED		1	/* = USYNC_PROCESS */
717c478bd9Sstevel@tonic-gate #define	PTHREAD_PROCESS_PRIVATE		0	/* = USYNC_THREAD */
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate /*
747c478bd9Sstevel@tonic-gate  * mutex types
75*50718d3eSRobert Mustacchi  *
76*50718d3eSRobert Mustacchi  * _ERRORCHECK and _RERCURSIVE are kept in line with their corresponding values
77*50718d3eSRobert Mustacchi  * in sys/synch.h; however, in general these types have their own semantics.
787c478bd9Sstevel@tonic-gate  */
797c478bd9Sstevel@tonic-gate #define	PTHREAD_MUTEX_NORMAL		0x0
807c478bd9Sstevel@tonic-gate #define	PTHREAD_MUTEX_ERRORCHECK	0x2
817c478bd9Sstevel@tonic-gate #define	PTHREAD_MUTEX_RECURSIVE		0x4
82*50718d3eSRobert Mustacchi #define	PTHREAD_MUTEX_DEFAULT		0x8
837c478bd9Sstevel@tonic-gate 
847c478bd9Sstevel@tonic-gate /*
857c478bd9Sstevel@tonic-gate  * Mutex protocol values. Keep these in synch with sys/synch.h lock types.
867c478bd9Sstevel@tonic-gate  */
877c478bd9Sstevel@tonic-gate #define	PTHREAD_PRIO_NONE		0x0
887c478bd9Sstevel@tonic-gate #define	PTHREAD_PRIO_INHERIT		0x10
897c478bd9Sstevel@tonic-gate #define	PTHREAD_PRIO_PROTECT		0x20
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate /*
9280d89c86SRoger A. Faulkner  * Mutex robust attribute values.
9380d89c86SRoger A. Faulkner  * Keep these in synch with sys/synch.h lock types.
947c478bd9Sstevel@tonic-gate  */
9580d89c86SRoger A. Faulkner #define	PTHREAD_MUTEX_STALLED		0x0
9680d89c86SRoger A. Faulkner #define	PTHREAD_MUTEX_ROBUST		0x40
9780d89c86SRoger A. Faulkner /*
9880d89c86SRoger A. Faulkner  * Historical solaris-specific names,
9980d89c86SRoger A. Faulkner  * from before pthread_mutexattr_getrobust() became standardized
10080d89c86SRoger A. Faulkner  */
10180d89c86SRoger A. Faulkner #define	PTHREAD_MUTEX_STALL_NP		PTHREAD_MUTEX_STALLED
10280d89c86SRoger A. Faulkner #define	PTHREAD_MUTEX_ROBUST_NP		PTHREAD_MUTEX_ROBUST
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate /*
1057c478bd9Sstevel@tonic-gate  * macros - default initializers defined as in synch.h
1067c478bd9Sstevel@tonic-gate  * Any change here should be reflected in synch.h.
1077c478bd9Sstevel@tonic-gate  *
1087c478bd9Sstevel@tonic-gate  * NOTE:
1097c478bd9Sstevel@tonic-gate  * Make sure that any change in the macros is consistent with the definition
1107c478bd9Sstevel@tonic-gate  * of the corresponding types in sys/types.h (e.g. PTHREAD_MUTEX_INITIALIZER
1117c478bd9Sstevel@tonic-gate  * should be consistent with the definition for pthread_mutex_t).
1127c478bd9Sstevel@tonic-gate  */
1137c478bd9Sstevel@tonic-gate #define	PTHREAD_MUTEX_INITIALIZER		/* = DEFAULTMUTEX */	\
114a90d75b8SRichard PALO 	{{0, 0, 0, PTHREAD_PROCESS_PRIVATE, _MUTEX_MAGIC}, {{{0}}}, 0}
1157c478bd9Sstevel@tonic-gate 
1167bb0eb34SAndy Fiddaman #define	PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP /* = ERRORCHECKMUTEX */ \
1177bb0eb34SAndy Fiddaman 	{{0, 0, 0, PTHREAD_PROCESS_PRIVATE | PTHREAD_MUTEX_ERRORCHECK,  \
1187bb0eb34SAndy Fiddaman 	_MUTEX_MAGIC}, {{{0}}}, 0}
1197bb0eb34SAndy Fiddaman 
1207bb0eb34SAndy Fiddaman #define	PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP  /* = RECURSIVEMUTEX */  \
1217bb0eb34SAndy Fiddaman 	{{0, 0, 0, PTHREAD_PROCESS_PRIVATE | PTHREAD_MUTEX_RECURSIVE |  \
1227bb0eb34SAndy Fiddaman 	PTHREAD_MUTEX_ERRORCHECK, _MUTEX_MAGIC}, {{{0}}}, 0}
1237bb0eb34SAndy Fiddaman 
1247c478bd9Sstevel@tonic-gate #define	PTHREAD_COND_INITIALIZER		/* = DEFAULTCV */	\
125a90d75b8SRichard PALO 	{{{0, 0, 0, 0}, PTHREAD_PROCESS_PRIVATE, _COND_MAGIC}, 0}
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate #define	PTHREAD_RWLOCK_INITIALIZER		/* = DEFAULTRWLOCK */	\
128a90d75b8SRichard PALO 	{0, PTHREAD_PROCESS_PRIVATE, _RWL_MAGIC, PTHREAD_MUTEX_INITIALIZER, \
1297c478bd9Sstevel@tonic-gate 	PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER}
1307c478bd9Sstevel@tonic-gate 
1317c478bd9Sstevel@tonic-gate /* cancellation type and state */
1327c478bd9Sstevel@tonic-gate #define	PTHREAD_CANCEL_ENABLE		0x00
1337c478bd9Sstevel@tonic-gate #define	PTHREAD_CANCEL_DISABLE		0x01
1347c478bd9Sstevel@tonic-gate #define	PTHREAD_CANCEL_DEFERRED		0x00
1357c478bd9Sstevel@tonic-gate #define	PTHREAD_CANCEL_ASYNCHRONOUS	0x02
1367c478bd9Sstevel@tonic-gate #define	PTHREAD_CANCELED		(void *)-19
1377c478bd9Sstevel@tonic-gate 
1387c478bd9Sstevel@tonic-gate /* pthread_once related values */
1397c478bd9Sstevel@tonic-gate #define	PTHREAD_ONCE_NOTDONE	0
1407c478bd9Sstevel@tonic-gate #define	PTHREAD_ONCE_DONE	1
1411e2ea07cSRoger A. Faulkner #define	PTHREAD_ONCE_INIT	{ {0, 0, 0, PTHREAD_ONCE_NOTDONE} }
1427c478bd9Sstevel@tonic-gate 
143cb620785Sraf /*
144cb620785Sraf  * The key to be created by pthread_key_create_once_np()
145cb620785Sraf  * must be statically initialized with PTHREAD_ONCE_KEY_NP.
146cb620785Sraf  * This must be the same as THR_ONCE_KEY in <thread.h>
147cb620785Sraf  */
148cb620785Sraf #define	PTHREAD_ONCE_KEY_NP	(pthread_key_t)(-1)
149cb620785Sraf 
1507c478bd9Sstevel@tonic-gate /* barriers */
1517c478bd9Sstevel@tonic-gate #define	PTHREAD_BARRIER_SERIAL_THREAD	-2
1527c478bd9Sstevel@tonic-gate 
153ab618543SJohn Levon /* For pthread_{get,set}name_np(). */
154ab618543SJohn Levon #define	PTHREAD_MAX_NAMELEN_NP (32)
155ab618543SJohn Levon 
1567c478bd9Sstevel@tonic-gate #ifndef	_ASM
1577c478bd9Sstevel@tonic-gate 
1587c478bd9Sstevel@tonic-gate /*
1597c478bd9Sstevel@tonic-gate  * cancellation cleanup structure
1607c478bd9Sstevel@tonic-gate  */
1617c478bd9Sstevel@tonic-gate typedef struct _cleanup {
1627c478bd9Sstevel@tonic-gate 	uintptr_t	pthread_cleanup_pad[4];
1637c478bd9Sstevel@tonic-gate } _cleanup_t;
1647c478bd9Sstevel@tonic-gate 
1657c478bd9Sstevel@tonic-gate void	__pthread_cleanup_push(void (*)(void *), void *, caddr_t, _cleanup_t *);
1667c478bd9Sstevel@tonic-gate void	__pthread_cleanup_pop(int, _cleanup_t *);
1677c478bd9Sstevel@tonic-gate caddr_t	_getfp(void);
1687c478bd9Sstevel@tonic-gate 
1697c478bd9Sstevel@tonic-gate #if __cplusplus
1707c478bd9Sstevel@tonic-gate extern "C" {
1717c478bd9Sstevel@tonic-gate #endif
1727c478bd9Sstevel@tonic-gate 
1737c478bd9Sstevel@tonic-gate typedef void (*_Voidfp)(void*); /* pointer to extern "C" function */
1747c478bd9Sstevel@tonic-gate 
1757c478bd9Sstevel@tonic-gate #if __cplusplus
1767c478bd9Sstevel@tonic-gate } /* extern "C" */
1777c478bd9Sstevel@tonic-gate #endif
1787c478bd9Sstevel@tonic-gate 
1797c478bd9Sstevel@tonic-gate #define	pthread_cleanup_push(routine, args) { \
1807c478bd9Sstevel@tonic-gate 	_cleanup_t _cleanup_info; \
1817c478bd9Sstevel@tonic-gate 	__pthread_cleanup_push((_Voidfp)(routine), (void *)(args), \
1827c478bd9Sstevel@tonic-gate 				(caddr_t)_getfp(), &_cleanup_info);
1837c478bd9Sstevel@tonic-gate 
1847c478bd9Sstevel@tonic-gate #define	pthread_cleanup_pop(ex) \
1857c478bd9Sstevel@tonic-gate 	__pthread_cleanup_pop(ex, &_cleanup_info); \
1867c478bd9Sstevel@tonic-gate }
1877c478bd9Sstevel@tonic-gate 
1887c478bd9Sstevel@tonic-gate /*
1897c478bd9Sstevel@tonic-gate  * function prototypes - thread related calls
1907c478bd9Sstevel@tonic-gate  */
1917c478bd9Sstevel@tonic-gate 
1927c478bd9Sstevel@tonic-gate /*
1937c478bd9Sstevel@tonic-gate  * pthread_atfork() is also declared in <unistd.h> as per SUSv2. The
1947c478bd9Sstevel@tonic-gate  * declarations are identical. A change to either one may also require
1957c478bd9Sstevel@tonic-gate  * appropriate namespace updates in order to avoid redeclaration
1967c478bd9Sstevel@tonic-gate  * warnings in the case where both prototypes are exposed via inclusion
1977c478bd9Sstevel@tonic-gate  * of both <pthread.h> and <unistd.h>.
1987c478bd9Sstevel@tonic-gate  */
1997c478bd9Sstevel@tonic-gate extern int pthread_atfork(void (*) (void), void (*) (void), void (*) (void));
2007c478bd9Sstevel@tonic-gate extern int pthread_attr_init(pthread_attr_t *);
2017c478bd9Sstevel@tonic-gate extern int pthread_attr_destroy(pthread_attr_t *);
2027c478bd9Sstevel@tonic-gate extern int pthread_attr_setstack(pthread_attr_t *, void *, size_t);
2037c478bd9Sstevel@tonic-gate extern int pthread_attr_getstack(const pthread_attr_t *_RESTRICT_KYWD,
2047c478bd9Sstevel@tonic-gate 		void **_RESTRICT_KYWD, size_t *_RESTRICT_KYWD);
2057c478bd9Sstevel@tonic-gate extern int pthread_attr_setstacksize(pthread_attr_t *, size_t);
2067c478bd9Sstevel@tonic-gate extern int pthread_attr_getstacksize(const pthread_attr_t *_RESTRICT_KYWD,
2077c478bd9Sstevel@tonic-gate 		size_t *_RESTRICT_KYWD);
2087c478bd9Sstevel@tonic-gate extern int pthread_attr_setstackaddr(pthread_attr_t *, void *);
2097c478bd9Sstevel@tonic-gate extern int pthread_attr_getstackaddr(const pthread_attr_t *_RESTRICT_KYWD,
2107c478bd9Sstevel@tonic-gate 		void **_RESTRICT_KYWD);
2117c478bd9Sstevel@tonic-gate extern int pthread_attr_setdetachstate(pthread_attr_t *, int);
2127c478bd9Sstevel@tonic-gate extern int pthread_attr_getdetachstate(const pthread_attr_t *, int *);
2137c478bd9Sstevel@tonic-gate extern int pthread_attr_setscope(pthread_attr_t *, int);
2147c478bd9Sstevel@tonic-gate extern int pthread_attr_getscope(const pthread_attr_t *_RESTRICT_KYWD,
2157c478bd9Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
2167c478bd9Sstevel@tonic-gate extern int pthread_attr_setinheritsched(pthread_attr_t *, int);
2177c478bd9Sstevel@tonic-gate extern int pthread_attr_getinheritsched(const pthread_attr_t *_RESTRICT_KYWD,
2187c478bd9Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
2197c478bd9Sstevel@tonic-gate extern int pthread_attr_setschedpolicy(pthread_attr_t *, int);
2207c478bd9Sstevel@tonic-gate extern int pthread_attr_getschedpolicy(const pthread_attr_t *_RESTRICT_KYWD,
2217c478bd9Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
2227c478bd9Sstevel@tonic-gate extern int pthread_attr_setschedparam(pthread_attr_t *_RESTRICT_KYWD,
2237c478bd9Sstevel@tonic-gate 		const struct sched_param *_RESTRICT_KYWD);
2247c478bd9Sstevel@tonic-gate extern int pthread_attr_getschedparam(const pthread_attr_t *_RESTRICT_KYWD,
2257c478bd9Sstevel@tonic-gate 		struct sched_param *_RESTRICT_KYWD);
226ab618543SJohn Levon extern int pthread_attr_setname_np(pthread_attr_t *_RESTRICT_KYWD,
227ab618543SJohn Levon     const char *_RESTRICT_KYWD);
228ab618543SJohn Levon extern int pthread_attr_getname_np(pthread_attr_t *_RESTRICT_KYWD,
229ab618543SJohn Levon     char *_RESTRICT_KYWD, size_t);
2307c478bd9Sstevel@tonic-gate extern int pthread_create(pthread_t *_RESTRICT_KYWD,
2317c478bd9Sstevel@tonic-gate 		const pthread_attr_t *_RESTRICT_KYWD, void * (*)(void *),
2327c478bd9Sstevel@tonic-gate 		void *_RESTRICT_KYWD);
2337c478bd9Sstevel@tonic-gate extern int pthread_once(pthread_once_t *, void (*)(void));
2347c478bd9Sstevel@tonic-gate extern int pthread_join(pthread_t, void **);
2357c478bd9Sstevel@tonic-gate extern int pthread_detach(pthread_t);
2367c478bd9Sstevel@tonic-gate extern void pthread_exit(void *) __NORETURN;
2377c478bd9Sstevel@tonic-gate extern int pthread_cancel(pthread_t);
2387c478bd9Sstevel@tonic-gate extern int pthread_setschedparam(pthread_t, int, const struct sched_param *);
2397c478bd9Sstevel@tonic-gate extern int pthread_getschedparam(pthread_t, int *_RESTRICT_KYWD,
2407c478bd9Sstevel@tonic-gate 		struct sched_param *_RESTRICT_KYWD);
2417c478bd9Sstevel@tonic-gate extern int pthread_setschedprio(pthread_t, int);
2427c478bd9Sstevel@tonic-gate extern int pthread_setcancelstate(int, int *);
2437c478bd9Sstevel@tonic-gate extern int pthread_setcanceltype(int, int *);
2447c478bd9Sstevel@tonic-gate extern void pthread_testcancel(void);
2457c478bd9Sstevel@tonic-gate extern int pthread_equal(pthread_t, pthread_t);
2467c478bd9Sstevel@tonic-gate extern int pthread_key_create(pthread_key_t *, void (*)(void *));
247cb620785Sraf extern int pthread_key_create_once_np(pthread_key_t *, void (*)(void *));
2487c478bd9Sstevel@tonic-gate extern int pthread_key_delete(pthread_key_t);
2497c478bd9Sstevel@tonic-gate extern int pthread_setspecific(pthread_key_t, const void *);
2507c478bd9Sstevel@tonic-gate extern void *pthread_getspecific(pthread_key_t);
2517c478bd9Sstevel@tonic-gate extern pthread_t pthread_self(void);
252ab618543SJohn Levon extern int pthread_setname_np(pthread_t, const char *);
253ab618543SJohn Levon extern int pthread_getname_np(pthread_t, char *, size_t);
2547c478bd9Sstevel@tonic-gate 
2557c478bd9Sstevel@tonic-gate /*
2567c478bd9Sstevel@tonic-gate  * function prototypes - synchronization related calls
2577c478bd9Sstevel@tonic-gate  */
2587c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_init(pthread_mutexattr_t *);
2597c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_destroy(pthread_mutexattr_t *);
2607c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int);
2617c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_getpshared(
2627c478bd9Sstevel@tonic-gate 	const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
2637c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int);
2647c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_getprotocol(
2657c478bd9Sstevel@tonic-gate 	const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
2667c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int);
2677c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_getprioceiling(
2687c478bd9Sstevel@tonic-gate 	const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
26980d89c86SRoger A. Faulkner extern int pthread_mutexattr_setrobust(pthread_mutexattr_t *, int);
27080d89c86SRoger A. Faulkner extern int pthread_mutexattr_getrobust(
2717c478bd9Sstevel@tonic-gate 	const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
2727c478bd9Sstevel@tonic-gate extern int pthread_mutex_init(pthread_mutex_t *_RESTRICT_KYWD,
2737c478bd9Sstevel@tonic-gate 	const pthread_mutexattr_t *_RESTRICT_KYWD);
27480d89c86SRoger A. Faulkner extern int pthread_mutex_consistent(pthread_mutex_t *);
2757c478bd9Sstevel@tonic-gate extern int pthread_mutex_destroy(pthread_mutex_t *);
2767c478bd9Sstevel@tonic-gate extern int pthread_mutex_lock(pthread_mutex_t *);
2777c478bd9Sstevel@tonic-gate extern int pthread_mutex_timedlock(pthread_mutex_t *_RESTRICT_KYWD,
2787c478bd9Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
2797c478bd9Sstevel@tonic-gate extern int pthread_mutex_reltimedlock_np(pthread_mutex_t *_RESTRICT_KYWD,
2807c478bd9Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
2817c478bd9Sstevel@tonic-gate extern int pthread_mutex_unlock(pthread_mutex_t *);
2827c478bd9Sstevel@tonic-gate extern int pthread_mutex_trylock(pthread_mutex_t *);
2837c478bd9Sstevel@tonic-gate extern int pthread_mutex_setprioceiling(pthread_mutex_t *_RESTRICT_KYWD,
2847c478bd9Sstevel@tonic-gate 	int, int *_RESTRICT_KYWD);
2857c478bd9Sstevel@tonic-gate extern int pthread_mutex_getprioceiling(const pthread_mutex_t *_RESTRICT_KYWD,
2867c478bd9Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
2877c478bd9Sstevel@tonic-gate extern int pthread_condattr_init(pthread_condattr_t *);
2887c478bd9Sstevel@tonic-gate extern int pthread_condattr_destroy(pthread_condattr_t *);
2897c478bd9Sstevel@tonic-gate extern int pthread_condattr_setclock(pthread_condattr_t *, clockid_t);
2907c478bd9Sstevel@tonic-gate extern int pthread_condattr_getclock(const pthread_condattr_t *_RESTRICT_KYWD,
2917c478bd9Sstevel@tonic-gate 	clockid_t *_RESTRICT_KYWD);
2927c478bd9Sstevel@tonic-gate extern int pthread_condattr_setpshared(pthread_condattr_t *, int);
2937c478bd9Sstevel@tonic-gate extern int pthread_condattr_getpshared(const pthread_condattr_t *_RESTRICT_KYWD,
2947c478bd9Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
2957c478bd9Sstevel@tonic-gate extern int pthread_cond_init(pthread_cond_t *_RESTRICT_KYWD,
2967c478bd9Sstevel@tonic-gate 	const pthread_condattr_t *_RESTRICT_KYWD);
2977c478bd9Sstevel@tonic-gate extern int pthread_cond_destroy(pthread_cond_t *);
2987c478bd9Sstevel@tonic-gate extern int pthread_cond_broadcast(pthread_cond_t *);
2997c478bd9Sstevel@tonic-gate extern int pthread_cond_signal(pthread_cond_t *);
3007c478bd9Sstevel@tonic-gate extern int pthread_cond_wait(pthread_cond_t *_RESTRICT_KYWD,
3017c478bd9Sstevel@tonic-gate 	pthread_mutex_t *_RESTRICT_KYWD);
3027c478bd9Sstevel@tonic-gate extern int pthread_cond_timedwait(pthread_cond_t *_RESTRICT_KYWD,
3037c478bd9Sstevel@tonic-gate 	pthread_mutex_t *_RESTRICT_KYWD, const struct timespec *_RESTRICT_KYWD);
3047c478bd9Sstevel@tonic-gate extern int pthread_cond_reltimedwait_np(pthread_cond_t *_RESTRICT_KYWD,
3057c478bd9Sstevel@tonic-gate 	pthread_mutex_t *_RESTRICT_KYWD, const struct timespec *_RESTRICT_KYWD);
3067c478bd9Sstevel@tonic-gate extern int pthread_attr_getguardsize(const pthread_attr_t *_RESTRICT_KYWD,
3077c478bd9Sstevel@tonic-gate 	size_t *_RESTRICT_KYWD);
3087c478bd9Sstevel@tonic-gate extern int pthread_attr_setguardsize(pthread_attr_t *, size_t);
3097c478bd9Sstevel@tonic-gate extern int pthread_getconcurrency(void);
3107c478bd9Sstevel@tonic-gate extern int pthread_setconcurrency(int);
3117c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_settype(pthread_mutexattr_t *, int);
3127c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_gettype(const pthread_mutexattr_t *_RESTRICT_KYWD,
3137c478bd9Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
3147c478bd9Sstevel@tonic-gate extern int pthread_rwlock_init(pthread_rwlock_t *_RESTRICT_KYWD,
3157c478bd9Sstevel@tonic-gate 	const pthread_rwlockattr_t *_RESTRICT_KYWD);
3167c478bd9Sstevel@tonic-gate extern int pthread_rwlock_destroy(pthread_rwlock_t *);
3177c478bd9Sstevel@tonic-gate extern int pthread_rwlock_rdlock(pthread_rwlock_t *);
3187c478bd9Sstevel@tonic-gate extern int pthread_rwlock_timedrdlock(pthread_rwlock_t *_RESTRICT_KYWD,
3197c478bd9Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
3207c478bd9Sstevel@tonic-gate extern int pthread_rwlock_reltimedrdlock_np(pthread_rwlock_t *_RESTRICT_KYWD,
3217c478bd9Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
3227c478bd9Sstevel@tonic-gate extern int pthread_rwlock_tryrdlock(pthread_rwlock_t *);
3237c478bd9Sstevel@tonic-gate extern int pthread_rwlock_wrlock(pthread_rwlock_t *);
3247c478bd9Sstevel@tonic-gate extern int pthread_rwlock_timedwrlock(pthread_rwlock_t *_RESTRICT_KYWD,
3257c478bd9Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
3267c478bd9Sstevel@tonic-gate extern int pthread_rwlock_reltimedwrlock_np(pthread_rwlock_t *_RESTRICT_KYWD,
3277c478bd9Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
3287c478bd9Sstevel@tonic-gate extern int pthread_rwlock_trywrlock(pthread_rwlock_t *);
3297c478bd9Sstevel@tonic-gate extern int pthread_rwlock_unlock(pthread_rwlock_t *);
3307c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_init(pthread_rwlockattr_t *);
3317c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_destroy(pthread_rwlockattr_t *);
3327c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_getpshared(
3337c478bd9Sstevel@tonic-gate 	const pthread_rwlockattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
3347c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int);
3357c478bd9Sstevel@tonic-gate extern int pthread_spin_init(pthread_spinlock_t *, int);
3367c478bd9Sstevel@tonic-gate extern int pthread_spin_destroy(pthread_spinlock_t *);
3377c478bd9Sstevel@tonic-gate extern int pthread_spin_lock(pthread_spinlock_t *);
3387c478bd9Sstevel@tonic-gate extern int pthread_spin_trylock(pthread_spinlock_t *);
3397c478bd9Sstevel@tonic-gate extern int pthread_spin_unlock(pthread_spinlock_t *);
3407c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_init(pthread_barrierattr_t *);
3417c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_destroy(pthread_barrierattr_t *);
3427c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int);
3437c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_getpshared(
3447c478bd9Sstevel@tonic-gate 	const pthread_barrierattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
3457c478bd9Sstevel@tonic-gate extern int pthread_barrier_init(pthread_barrier_t *_RESTRICT_KYWD,
3467c478bd9Sstevel@tonic-gate 	const pthread_barrierattr_t *_RESTRICT_KYWD, uint_t);
3477c478bd9Sstevel@tonic-gate extern int pthread_barrier_destroy(pthread_barrier_t *);
3487c478bd9Sstevel@tonic-gate extern int pthread_barrier_wait(pthread_barrier_t *);
3497c478bd9Sstevel@tonic-gate 
35080d89c86SRoger A. Faulkner /* Historical names -- present only for binary compatibility */
35180d89c86SRoger A. Faulkner extern int pthread_mutex_consistent_np(pthread_mutex_t *);
35280d89c86SRoger A. Faulkner extern int pthread_mutexattr_setrobust_np(pthread_mutexattr_t *, int);
35380d89c86SRoger A. Faulkner extern int pthread_mutexattr_getrobust_np(
35480d89c86SRoger A. Faulkner 	const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
35580d89c86SRoger A. Faulkner 
356e56998eeSRobert Mustacchi /*
357e56998eeSRobert Mustacchi  * These are non-standardized extensions that we provide. Their origins are
358e56998eeSRobert Mustacchi  * documented in their manual pages.
359e56998eeSRobert Mustacchi  */
3607bb0eb34SAndy Fiddaman #if !defined(_STRICT_SYMBOLS)
361e56998eeSRobert Mustacchi extern int pthread_attr_get_np(pthread_t, pthread_attr_t *);
3627bb0eb34SAndy Fiddaman extern void pthread_mutex_enter_np(pthread_mutex_t *);
3637bb0eb34SAndy Fiddaman extern void pthread_mutex_exit_np(pthread_mutex_t *);
3647bb0eb34SAndy Fiddaman #endif	/* !_STRICT_SYMBOLS */
365e56998eeSRobert Mustacchi 
3667c478bd9Sstevel@tonic-gate #endif	/* _ASM */
3677c478bd9Sstevel@tonic-gate 
3687c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
3697c478bd9Sstevel@tonic-gate }
3707c478bd9Sstevel@tonic-gate #endif
3717c478bd9Sstevel@tonic-gate 
3727c478bd9Sstevel@tonic-gate #endif	/* _PTHREAD_H */
373