xref: /illumos-gate/usr/src/head/pthread.h (revision 1e2ea07c)
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 /*
23*1e2ea07cSRoger A. Faulkner  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef _PTHREAD_H
287c478bd9Sstevel@tonic-gate #define	_PTHREAD_H
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h>
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #ifndef	_ASM
337c478bd9Sstevel@tonic-gate #include <sys/types.h>
347c478bd9Sstevel@tonic-gate #include <time.h>
357c478bd9Sstevel@tonic-gate #include <sched.h>
367c478bd9Sstevel@tonic-gate #endif	/* _ASM */
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
397c478bd9Sstevel@tonic-gate extern "C" {
407c478bd9Sstevel@tonic-gate #endif
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate /*
437c478bd9Sstevel@tonic-gate  * Thread related attribute values defined as in thread.h.
447c478bd9Sstevel@tonic-gate  * These are defined as bit pattern in thread.h.
457c478bd9Sstevel@tonic-gate  * Any change here should be reflected in thread.h.
467c478bd9Sstevel@tonic-gate  */
477c478bd9Sstevel@tonic-gate /* detach */
487c478bd9Sstevel@tonic-gate #define	PTHREAD_CREATE_DETACHED		0x40	/* = THR_DETACHED */
497c478bd9Sstevel@tonic-gate #define	PTHREAD_CREATE_JOINABLE		0
507c478bd9Sstevel@tonic-gate /* scope */
517c478bd9Sstevel@tonic-gate #define	PTHREAD_SCOPE_SYSTEM		0x01	/* = THR_BOUND */
527c478bd9Sstevel@tonic-gate #define	PTHREAD_SCOPE_PROCESS		0
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate /*
557c478bd9Sstevel@tonic-gate  * Other attributes which are not defined in thread.h
567c478bd9Sstevel@tonic-gate  */
577c478bd9Sstevel@tonic-gate /* inherit */
587c478bd9Sstevel@tonic-gate #define	PTHREAD_INHERIT_SCHED		1
597c478bd9Sstevel@tonic-gate #define	PTHREAD_EXPLICIT_SCHED		0
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate /*
627c478bd9Sstevel@tonic-gate  * Value of process-shared attribute
637c478bd9Sstevel@tonic-gate  * These are defined as values defined in sys/synch.h
647c478bd9Sstevel@tonic-gate  * Any change here should be reflected in sys/synch.h.
657c478bd9Sstevel@tonic-gate  */
667c478bd9Sstevel@tonic-gate #define	PTHREAD_PROCESS_SHARED		1	/* = USYNC_PROCESS */
677c478bd9Sstevel@tonic-gate #define	PTHREAD_PROCESS_PRIVATE		0	/* = USYNC_THREAD */
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate #define	_DEFAULT_TYPE 			PTHREAD_PROCESS_PRIVATE
707c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
717c478bd9Sstevel@tonic-gate #define	DEFAULT_TYPE			_DEFAULT_TYPE
727c478bd9Sstevel@tonic-gate #endif
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate /*
757c478bd9Sstevel@tonic-gate  * mutex types
767c478bd9Sstevel@tonic-gate  * keep these in synch which sys/synch.h lock flags
777c478bd9Sstevel@tonic-gate  */
787c478bd9Sstevel@tonic-gate #define	PTHREAD_MUTEX_NORMAL		0x0
797c478bd9Sstevel@tonic-gate #define	PTHREAD_MUTEX_ERRORCHECK	0x2
807c478bd9Sstevel@tonic-gate #define	PTHREAD_MUTEX_RECURSIVE		0x4
817c478bd9Sstevel@tonic-gate #define	PTHREAD_MUTEX_DEFAULT		PTHREAD_MUTEX_NORMAL
827c478bd9Sstevel@tonic-gate 
837c478bd9Sstevel@tonic-gate /*
847c478bd9Sstevel@tonic-gate  * Mutex protocol values. Keep these in synch with sys/synch.h lock types.
857c478bd9Sstevel@tonic-gate  */
867c478bd9Sstevel@tonic-gate #define	PTHREAD_PRIO_NONE		0x0
877c478bd9Sstevel@tonic-gate #define	PTHREAD_PRIO_INHERIT		0x10
887c478bd9Sstevel@tonic-gate #define	PTHREAD_PRIO_PROTECT		0x20
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate /*
917c478bd9Sstevel@tonic-gate  * Mutex robustness attribute values. The robustness attribute is a
927c478bd9Sstevel@tonic-gate  * Solaris specific extension to support robust mutexes. Note the _NP suffix
937c478bd9Sstevel@tonic-gate  * to indicate these are not part of the current POSIX spec (POSIX 1003.1 1996),
947c478bd9Sstevel@tonic-gate  * but are platform specific non-portable extensions. Keep these in synch
957c478bd9Sstevel@tonic-gate  * with sys/synch.h lock types.
967c478bd9Sstevel@tonic-gate  */
977c478bd9Sstevel@tonic-gate #define	PTHREAD_MUTEX_STALL_NP		0x0
987c478bd9Sstevel@tonic-gate #define	PTHREAD_MUTEX_ROBUST_NP		0x40
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate /*
1017c478bd9Sstevel@tonic-gate  * macros - default initializers defined as in synch.h
1027c478bd9Sstevel@tonic-gate  * Any change here should be reflected in synch.h.
1037c478bd9Sstevel@tonic-gate  *
1047c478bd9Sstevel@tonic-gate  * NOTE:
1057c478bd9Sstevel@tonic-gate  * Make sure that any change in the macros is consistent with the definition
1067c478bd9Sstevel@tonic-gate  * of the corresponding types in sys/types.h (e.g. PTHREAD_MUTEX_INITIALIZER
1077c478bd9Sstevel@tonic-gate  * should be consistent with the definition for pthread_mutex_t).
1087c478bd9Sstevel@tonic-gate  */
1097c478bd9Sstevel@tonic-gate #define	PTHREAD_MUTEX_INITIALIZER		/* = DEFAULTMUTEX */	\
1107c478bd9Sstevel@tonic-gate 	{{0, 0, 0, _DEFAULT_TYPE, _MUTEX_MAGIC}, {{{0}}}, 0}
1117c478bd9Sstevel@tonic-gate 
1127c478bd9Sstevel@tonic-gate #define	PTHREAD_COND_INITIALIZER		/* = DEFAULTCV */	\
1137c478bd9Sstevel@tonic-gate 	{{{0, 0, 0, 0}, _DEFAULT_TYPE, _COND_MAGIC}, 0}
1147c478bd9Sstevel@tonic-gate 
1157c478bd9Sstevel@tonic-gate #define	PTHREAD_RWLOCK_INITIALIZER		/* = DEFAULTRWLOCK */	\
1167c478bd9Sstevel@tonic-gate 	{0, _DEFAULT_TYPE, _RWL_MAGIC, PTHREAD_MUTEX_INITIALIZER,	\
1177c478bd9Sstevel@tonic-gate 	PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER}
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate /* cancellation type and state */
1207c478bd9Sstevel@tonic-gate #define	PTHREAD_CANCEL_ENABLE		0x00
1217c478bd9Sstevel@tonic-gate #define	PTHREAD_CANCEL_DISABLE		0x01
1227c478bd9Sstevel@tonic-gate #define	PTHREAD_CANCEL_DEFERRED		0x00
1237c478bd9Sstevel@tonic-gate #define	PTHREAD_CANCEL_ASYNCHRONOUS	0x02
1247c478bd9Sstevel@tonic-gate #define	PTHREAD_CANCELED		(void *)-19
1257c478bd9Sstevel@tonic-gate 
1267c478bd9Sstevel@tonic-gate /* pthread_once related values */
1277c478bd9Sstevel@tonic-gate #define	PTHREAD_ONCE_NOTDONE	0
1287c478bd9Sstevel@tonic-gate #define	PTHREAD_ONCE_DONE	1
129*1e2ea07cSRoger A. Faulkner #define	PTHREAD_ONCE_INIT	{ {0, 0, 0, PTHREAD_ONCE_NOTDONE} }
1307c478bd9Sstevel@tonic-gate 
131cb620785Sraf /*
132cb620785Sraf  * The key to be created by pthread_key_create_once_np()
133cb620785Sraf  * must be statically initialized with PTHREAD_ONCE_KEY_NP.
134cb620785Sraf  * This must be the same as THR_ONCE_KEY in <thread.h>
135cb620785Sraf  */
136cb620785Sraf #define	PTHREAD_ONCE_KEY_NP	(pthread_key_t)(-1)
137cb620785Sraf 
1387c478bd9Sstevel@tonic-gate /* barriers */
1397c478bd9Sstevel@tonic-gate #define	PTHREAD_BARRIER_SERIAL_THREAD	-2
1407c478bd9Sstevel@tonic-gate 
1417c478bd9Sstevel@tonic-gate #ifndef	_ASM
1427c478bd9Sstevel@tonic-gate 
1437c478bd9Sstevel@tonic-gate /*
1447c478bd9Sstevel@tonic-gate  * cancellation cleanup structure
1457c478bd9Sstevel@tonic-gate  */
1467c478bd9Sstevel@tonic-gate typedef struct _cleanup {
1477c478bd9Sstevel@tonic-gate 	uintptr_t	pthread_cleanup_pad[4];
1487c478bd9Sstevel@tonic-gate } _cleanup_t;
1497c478bd9Sstevel@tonic-gate 
1507c478bd9Sstevel@tonic-gate #ifdef	__STDC__
1517c478bd9Sstevel@tonic-gate 
1527c478bd9Sstevel@tonic-gate void	__pthread_cleanup_push(void (*)(void *), void *, caddr_t, _cleanup_t *);
1537c478bd9Sstevel@tonic-gate void	__pthread_cleanup_pop(int, _cleanup_t *);
1547c478bd9Sstevel@tonic-gate caddr_t	_getfp(void);
1557c478bd9Sstevel@tonic-gate 
1567c478bd9Sstevel@tonic-gate #else	/* __STDC__ */
1577c478bd9Sstevel@tonic-gate 
1587c478bd9Sstevel@tonic-gate void	__pthread_cleanup_push();
1597c478bd9Sstevel@tonic-gate void	__pthread_cleanup_pop();
1607c478bd9Sstevel@tonic-gate caddr_t	_getfp();
1617c478bd9Sstevel@tonic-gate 
1627c478bd9Sstevel@tonic-gate #endif	/* __STDC__ */
1637c478bd9Sstevel@tonic-gate 
1647c478bd9Sstevel@tonic-gate #if __cplusplus
1657c478bd9Sstevel@tonic-gate extern "C" {
1667c478bd9Sstevel@tonic-gate #endif
1677c478bd9Sstevel@tonic-gate 
1687c478bd9Sstevel@tonic-gate typedef void (*_Voidfp)(void*); /* pointer to extern "C" function */
1697c478bd9Sstevel@tonic-gate 
1707c478bd9Sstevel@tonic-gate #if __cplusplus
1717c478bd9Sstevel@tonic-gate } /* extern "C" */
1727c478bd9Sstevel@tonic-gate #endif
1737c478bd9Sstevel@tonic-gate 
1747c478bd9Sstevel@tonic-gate #define	pthread_cleanup_push(routine, args) { \
1757c478bd9Sstevel@tonic-gate 	_cleanup_t _cleanup_info; \
1767c478bd9Sstevel@tonic-gate 	__pthread_cleanup_push((_Voidfp)(routine), (void *)(args), \
1777c478bd9Sstevel@tonic-gate 				(caddr_t)_getfp(), &_cleanup_info);
1787c478bd9Sstevel@tonic-gate 
1797c478bd9Sstevel@tonic-gate #define	pthread_cleanup_pop(ex) \
1807c478bd9Sstevel@tonic-gate 	__pthread_cleanup_pop(ex, &_cleanup_info); \
1817c478bd9Sstevel@tonic-gate }
1827c478bd9Sstevel@tonic-gate 
1837c478bd9Sstevel@tonic-gate #ifdef	__STDC__
1847c478bd9Sstevel@tonic-gate 
1857c478bd9Sstevel@tonic-gate /*
1867c478bd9Sstevel@tonic-gate  * function prototypes - thread related calls
1877c478bd9Sstevel@tonic-gate  */
1887c478bd9Sstevel@tonic-gate 
1897c478bd9Sstevel@tonic-gate /*
1907c478bd9Sstevel@tonic-gate  * pthread_atfork() is also declared in <unistd.h> as per SUSv2. The
1917c478bd9Sstevel@tonic-gate  * declarations are identical. A change to either one may also require
1927c478bd9Sstevel@tonic-gate  * appropriate namespace updates in order to avoid redeclaration
1937c478bd9Sstevel@tonic-gate  * warnings in the case where both prototypes are exposed via inclusion
1947c478bd9Sstevel@tonic-gate  * of both <pthread.h> and <unistd.h>.
1957c478bd9Sstevel@tonic-gate  */
1967c478bd9Sstevel@tonic-gate extern int pthread_atfork(void (*) (void), void (*) (void), void (*) (void));
1977c478bd9Sstevel@tonic-gate extern int pthread_attr_init(pthread_attr_t *);
1987c478bd9Sstevel@tonic-gate extern int pthread_attr_destroy(pthread_attr_t *);
1997c478bd9Sstevel@tonic-gate extern int pthread_attr_setstack(pthread_attr_t *, void *, size_t);
2007c478bd9Sstevel@tonic-gate extern int pthread_attr_getstack(const pthread_attr_t *_RESTRICT_KYWD,
2017c478bd9Sstevel@tonic-gate 		void **_RESTRICT_KYWD, size_t *_RESTRICT_KYWD);
2027c478bd9Sstevel@tonic-gate extern int pthread_attr_setstacksize(pthread_attr_t *, size_t);
2037c478bd9Sstevel@tonic-gate extern int pthread_attr_getstacksize(const pthread_attr_t *_RESTRICT_KYWD,
2047c478bd9Sstevel@tonic-gate 		size_t *_RESTRICT_KYWD);
2057c478bd9Sstevel@tonic-gate extern int pthread_attr_setstackaddr(pthread_attr_t *, void *);
2067c478bd9Sstevel@tonic-gate extern int pthread_attr_getstackaddr(const pthread_attr_t *_RESTRICT_KYWD,
2077c478bd9Sstevel@tonic-gate 		void **_RESTRICT_KYWD);
2087c478bd9Sstevel@tonic-gate extern int pthread_attr_setdetachstate(pthread_attr_t *, int);
2097c478bd9Sstevel@tonic-gate extern int pthread_attr_getdetachstate(const pthread_attr_t *, int *);
2107c478bd9Sstevel@tonic-gate extern int pthread_attr_setscope(pthread_attr_t *, int);
2117c478bd9Sstevel@tonic-gate extern int pthread_attr_getscope(const pthread_attr_t *_RESTRICT_KYWD,
2127c478bd9Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
2137c478bd9Sstevel@tonic-gate extern int pthread_attr_setinheritsched(pthread_attr_t *, int);
2147c478bd9Sstevel@tonic-gate extern int pthread_attr_getinheritsched(const pthread_attr_t *_RESTRICT_KYWD,
2157c478bd9Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
2167c478bd9Sstevel@tonic-gate extern int pthread_attr_setschedpolicy(pthread_attr_t *, int);
2177c478bd9Sstevel@tonic-gate extern int pthread_attr_getschedpolicy(const pthread_attr_t *_RESTRICT_KYWD,
2187c478bd9Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
2197c478bd9Sstevel@tonic-gate extern int pthread_attr_setschedparam(pthread_attr_t *_RESTRICT_KYWD,
2207c478bd9Sstevel@tonic-gate 		const struct sched_param *_RESTRICT_KYWD);
2217c478bd9Sstevel@tonic-gate extern int pthread_attr_getschedparam(const pthread_attr_t *_RESTRICT_KYWD,
2227c478bd9Sstevel@tonic-gate 		struct sched_param *_RESTRICT_KYWD);
2237c478bd9Sstevel@tonic-gate extern int pthread_create(pthread_t *_RESTRICT_KYWD,
2247c478bd9Sstevel@tonic-gate 		const pthread_attr_t *_RESTRICT_KYWD, void * (*)(void *),
2257c478bd9Sstevel@tonic-gate 		void *_RESTRICT_KYWD);
2267c478bd9Sstevel@tonic-gate extern int pthread_once(pthread_once_t *, void (*)(void));
2277c478bd9Sstevel@tonic-gate extern int pthread_join(pthread_t, void **);
2287c478bd9Sstevel@tonic-gate extern int pthread_detach(pthread_t);
2297c478bd9Sstevel@tonic-gate extern void pthread_exit(void *) __NORETURN;
2307c478bd9Sstevel@tonic-gate extern int pthread_cancel(pthread_t);
2317c478bd9Sstevel@tonic-gate extern int pthread_setschedparam(pthread_t, int, const struct sched_param *);
2327c478bd9Sstevel@tonic-gate extern int pthread_getschedparam(pthread_t, int *_RESTRICT_KYWD,
2337c478bd9Sstevel@tonic-gate 		struct sched_param *_RESTRICT_KYWD);
2347c478bd9Sstevel@tonic-gate extern int pthread_setschedprio(pthread_t, int);
2357c478bd9Sstevel@tonic-gate extern int pthread_setcancelstate(int, int *);
2367c478bd9Sstevel@tonic-gate extern int pthread_setcanceltype(int, int *);
2377c478bd9Sstevel@tonic-gate extern void pthread_testcancel(void);
2387c478bd9Sstevel@tonic-gate extern int pthread_equal(pthread_t, pthread_t);
2397c478bd9Sstevel@tonic-gate extern int pthread_key_create(pthread_key_t *, void (*)(void *));
240cb620785Sraf extern int pthread_key_create_once_np(pthread_key_t *, void (*)(void *));
2417c478bd9Sstevel@tonic-gate extern int pthread_key_delete(pthread_key_t);
2427c478bd9Sstevel@tonic-gate extern int pthread_setspecific(pthread_key_t, const void *);
2437c478bd9Sstevel@tonic-gate extern void *pthread_getspecific(pthread_key_t);
2447c478bd9Sstevel@tonic-gate extern pthread_t pthread_self(void);
2457c478bd9Sstevel@tonic-gate 
2467c478bd9Sstevel@tonic-gate /*
2477c478bd9Sstevel@tonic-gate  * function prototypes - synchronization related calls
2487c478bd9Sstevel@tonic-gate  */
2497c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_init(pthread_mutexattr_t *);
2507c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_destroy(pthread_mutexattr_t *);
2517c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int);
2527c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_getpshared(
2537c478bd9Sstevel@tonic-gate 	const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
2547c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int);
2557c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_getprotocol(
2567c478bd9Sstevel@tonic-gate 	const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
2577c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int);
2587c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_getprioceiling(
2597c478bd9Sstevel@tonic-gate 	const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
2607c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_setrobust_np(pthread_mutexattr_t *, int);
2617c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_getrobust_np(
2627c478bd9Sstevel@tonic-gate 	const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
2637c478bd9Sstevel@tonic-gate extern int pthread_mutex_init(pthread_mutex_t *_RESTRICT_KYWD,
2647c478bd9Sstevel@tonic-gate 	const pthread_mutexattr_t *_RESTRICT_KYWD);
2657c478bd9Sstevel@tonic-gate extern int pthread_mutex_consistent_np(pthread_mutex_t *);
2667c478bd9Sstevel@tonic-gate extern int pthread_mutex_destroy(pthread_mutex_t *);
2677c478bd9Sstevel@tonic-gate extern int pthread_mutex_lock(pthread_mutex_t *);
2687c478bd9Sstevel@tonic-gate extern int pthread_mutex_timedlock(pthread_mutex_t *_RESTRICT_KYWD,
2697c478bd9Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
2707c478bd9Sstevel@tonic-gate extern int pthread_mutex_reltimedlock_np(pthread_mutex_t *_RESTRICT_KYWD,
2717c478bd9Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
2727c478bd9Sstevel@tonic-gate extern int pthread_mutex_unlock(pthread_mutex_t *);
2737c478bd9Sstevel@tonic-gate extern int pthread_mutex_trylock(pthread_mutex_t *);
2747c478bd9Sstevel@tonic-gate extern int pthread_mutex_setprioceiling(pthread_mutex_t *_RESTRICT_KYWD,
2757c478bd9Sstevel@tonic-gate 	int, int *_RESTRICT_KYWD);
2767c478bd9Sstevel@tonic-gate extern int pthread_mutex_getprioceiling(const pthread_mutex_t *_RESTRICT_KYWD,
2777c478bd9Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
2787c478bd9Sstevel@tonic-gate extern int pthread_condattr_init(pthread_condattr_t *);
2797c478bd9Sstevel@tonic-gate extern int pthread_condattr_destroy(pthread_condattr_t *);
2807c478bd9Sstevel@tonic-gate extern int pthread_condattr_setclock(pthread_condattr_t *, clockid_t);
2817c478bd9Sstevel@tonic-gate extern int pthread_condattr_getclock(const pthread_condattr_t *_RESTRICT_KYWD,
2827c478bd9Sstevel@tonic-gate 	clockid_t *_RESTRICT_KYWD);
2837c478bd9Sstevel@tonic-gate extern int pthread_condattr_setpshared(pthread_condattr_t *, int);
2847c478bd9Sstevel@tonic-gate extern int pthread_condattr_getpshared(const pthread_condattr_t *_RESTRICT_KYWD,
2857c478bd9Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
2867c478bd9Sstevel@tonic-gate extern int pthread_cond_init(pthread_cond_t *_RESTRICT_KYWD,
2877c478bd9Sstevel@tonic-gate 	const pthread_condattr_t *_RESTRICT_KYWD);
2887c478bd9Sstevel@tonic-gate extern int pthread_cond_destroy(pthread_cond_t *);
2897c478bd9Sstevel@tonic-gate extern int pthread_cond_broadcast(pthread_cond_t *);
2907c478bd9Sstevel@tonic-gate extern int pthread_cond_signal(pthread_cond_t *);
2917c478bd9Sstevel@tonic-gate extern int pthread_cond_wait(pthread_cond_t *_RESTRICT_KYWD,
2927c478bd9Sstevel@tonic-gate 	pthread_mutex_t *_RESTRICT_KYWD);
2937c478bd9Sstevel@tonic-gate extern int pthread_cond_timedwait(pthread_cond_t *_RESTRICT_KYWD,
2947c478bd9Sstevel@tonic-gate 	pthread_mutex_t *_RESTRICT_KYWD, const struct timespec *_RESTRICT_KYWD);
2957c478bd9Sstevel@tonic-gate extern int pthread_cond_reltimedwait_np(pthread_cond_t *_RESTRICT_KYWD,
2967c478bd9Sstevel@tonic-gate 	pthread_mutex_t *_RESTRICT_KYWD, const struct timespec *_RESTRICT_KYWD);
2977c478bd9Sstevel@tonic-gate extern int pthread_attr_getguardsize(const pthread_attr_t *_RESTRICT_KYWD,
2987c478bd9Sstevel@tonic-gate 	size_t *_RESTRICT_KYWD);
2997c478bd9Sstevel@tonic-gate extern int pthread_attr_setguardsize(pthread_attr_t *, size_t);
3007c478bd9Sstevel@tonic-gate extern int pthread_getconcurrency(void);
3017c478bd9Sstevel@tonic-gate extern int pthread_setconcurrency(int);
3027c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_settype(pthread_mutexattr_t *, int);
3037c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_gettype(const pthread_mutexattr_t *_RESTRICT_KYWD,
3047c478bd9Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
3057c478bd9Sstevel@tonic-gate extern int pthread_rwlock_init(pthread_rwlock_t *_RESTRICT_KYWD,
3067c478bd9Sstevel@tonic-gate 	const pthread_rwlockattr_t *_RESTRICT_KYWD);
3077c478bd9Sstevel@tonic-gate extern int pthread_rwlock_destroy(pthread_rwlock_t *);
3087c478bd9Sstevel@tonic-gate extern int pthread_rwlock_rdlock(pthread_rwlock_t *);
3097c478bd9Sstevel@tonic-gate extern int pthread_rwlock_timedrdlock(pthread_rwlock_t *_RESTRICT_KYWD,
3107c478bd9Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
3117c478bd9Sstevel@tonic-gate extern int pthread_rwlock_reltimedrdlock_np(pthread_rwlock_t *_RESTRICT_KYWD,
3127c478bd9Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
3137c478bd9Sstevel@tonic-gate extern int pthread_rwlock_tryrdlock(pthread_rwlock_t *);
3147c478bd9Sstevel@tonic-gate extern int pthread_rwlock_wrlock(pthread_rwlock_t *);
3157c478bd9Sstevel@tonic-gate extern int pthread_rwlock_timedwrlock(pthread_rwlock_t *_RESTRICT_KYWD,
3167c478bd9Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
3177c478bd9Sstevel@tonic-gate extern int pthread_rwlock_reltimedwrlock_np(pthread_rwlock_t *_RESTRICT_KYWD,
3187c478bd9Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
3197c478bd9Sstevel@tonic-gate extern int pthread_rwlock_trywrlock(pthread_rwlock_t *);
3207c478bd9Sstevel@tonic-gate extern int pthread_rwlock_unlock(pthread_rwlock_t *);
3217c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_init(pthread_rwlockattr_t *);
3227c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_destroy(pthread_rwlockattr_t *);
3237c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_getpshared(
3247c478bd9Sstevel@tonic-gate 	const pthread_rwlockattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
3257c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int);
3267c478bd9Sstevel@tonic-gate extern int pthread_spin_init(pthread_spinlock_t *, int);
3277c478bd9Sstevel@tonic-gate extern int pthread_spin_destroy(pthread_spinlock_t *);
3287c478bd9Sstevel@tonic-gate extern int pthread_spin_lock(pthread_spinlock_t *);
3297c478bd9Sstevel@tonic-gate extern int pthread_spin_trylock(pthread_spinlock_t *);
3307c478bd9Sstevel@tonic-gate extern int pthread_spin_unlock(pthread_spinlock_t *);
3317c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_init(pthread_barrierattr_t *);
3327c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_destroy(pthread_barrierattr_t *);
3337c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int);
3347c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_getpshared(
3357c478bd9Sstevel@tonic-gate 	const pthread_barrierattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
3367c478bd9Sstevel@tonic-gate extern int pthread_barrier_init(pthread_barrier_t *_RESTRICT_KYWD,
3377c478bd9Sstevel@tonic-gate 	const pthread_barrierattr_t *_RESTRICT_KYWD, uint_t);
3387c478bd9Sstevel@tonic-gate extern int pthread_barrier_destroy(pthread_barrier_t *);
3397c478bd9Sstevel@tonic-gate extern int pthread_barrier_wait(pthread_barrier_t *);
3407c478bd9Sstevel@tonic-gate 
3417c478bd9Sstevel@tonic-gate #else	/* __STDC__ */
3427c478bd9Sstevel@tonic-gate 
3437c478bd9Sstevel@tonic-gate /*
3447c478bd9Sstevel@tonic-gate  * function prototypes - thread related calls
3457c478bd9Sstevel@tonic-gate  */
3467c478bd9Sstevel@tonic-gate extern int pthread_atfork();
3477c478bd9Sstevel@tonic-gate extern int pthread_attr_init();
3487c478bd9Sstevel@tonic-gate extern int pthread_attr_destroy();
3497c478bd9Sstevel@tonic-gate extern int pthread_attr_setstack();
3507c478bd9Sstevel@tonic-gate extern int pthread_attr_getstack();
3517c478bd9Sstevel@tonic-gate extern int pthread_attr_setstacksize();
3527c478bd9Sstevel@tonic-gate extern int pthread_attr_getstacksize();
3537c478bd9Sstevel@tonic-gate extern int pthread_attr_setstackaddr();
3547c478bd9Sstevel@tonic-gate extern int pthread_attr_getstackaddr();
3557c478bd9Sstevel@tonic-gate extern int pthread_attr_setdetachstate();
3567c478bd9Sstevel@tonic-gate extern int pthread_attr_getdetachstate();
3577c478bd9Sstevel@tonic-gate extern int pthread_attr_setscope();
3587c478bd9Sstevel@tonic-gate extern int pthread_attr_getscope();
3597c478bd9Sstevel@tonic-gate extern int pthread_attr_setinheritsched();
3607c478bd9Sstevel@tonic-gate extern int pthread_attr_getinheritsched();
3617c478bd9Sstevel@tonic-gate extern int pthread_attr_setschedpolicy();
3627c478bd9Sstevel@tonic-gate extern int pthread_attr_getschedpolicy();
3637c478bd9Sstevel@tonic-gate extern int pthread_attr_setschedparam();
3647c478bd9Sstevel@tonic-gate extern int pthread_attr_getschedparam();
3657c478bd9Sstevel@tonic-gate extern int pthread_create();
3667c478bd9Sstevel@tonic-gate extern int pthread_once();
3677c478bd9Sstevel@tonic-gate extern int pthread_join();
3687c478bd9Sstevel@tonic-gate extern int pthread_detach();
3697c478bd9Sstevel@tonic-gate extern void pthread_exit();
3707c478bd9Sstevel@tonic-gate extern int pthread_cancel();
3717c478bd9Sstevel@tonic-gate extern int pthread_setschedparam();
3727c478bd9Sstevel@tonic-gate extern int pthread_getschedparam();
3737c478bd9Sstevel@tonic-gate extern int pthread_setschedprio();
3747c478bd9Sstevel@tonic-gate extern int pthread_setcancelstate();
3757c478bd9Sstevel@tonic-gate extern int pthread_setcanceltype();
3767c478bd9Sstevel@tonic-gate extern void pthread_testcancel();
3777c478bd9Sstevel@tonic-gate extern int pthread_equal();
3787c478bd9Sstevel@tonic-gate extern int pthread_key_create();
379cb620785Sraf extern int pthread_key_create_once_np();
3807c478bd9Sstevel@tonic-gate extern int pthread_key_delete();
3817c478bd9Sstevel@tonic-gate extern int pthread_setspecific();
3827c478bd9Sstevel@tonic-gate extern void *pthread_getspecific();
3837c478bd9Sstevel@tonic-gate extern pthread_t pthread_self();
3847c478bd9Sstevel@tonic-gate /*
3857c478bd9Sstevel@tonic-gate  * function prototypes - synchronization related calls
3867c478bd9Sstevel@tonic-gate  */
3877c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_init();
3887c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_destroy();
3897c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_setpshared();
3907c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_getpshared();
3917c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_setprotocol();
3927c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_getprotocol();
3937c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_setprioceiling();
3947c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_getprioceiling();
3957c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_setrobust_np();
3967c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_getrobust_np();
3977c478bd9Sstevel@tonic-gate extern int pthread_mutex_init();
3987c478bd9Sstevel@tonic-gate extern int pthread_mutex_consistent_np();
3997c478bd9Sstevel@tonic-gate extern int pthread_mutex_destroy();
4007c478bd9Sstevel@tonic-gate extern int pthread_mutex_lock();
4017c478bd9Sstevel@tonic-gate extern int pthread_mutex_timedlock();
4027c478bd9Sstevel@tonic-gate extern int pthread_mutex_reltimedlock_np();
4037c478bd9Sstevel@tonic-gate extern int pthread_mutex_unlock();
4047c478bd9Sstevel@tonic-gate extern int pthread_mutex_trylock();
4057c478bd9Sstevel@tonic-gate extern int pthread_mutex_setprioceiling();
4067c478bd9Sstevel@tonic-gate extern int pthread_mutex_getprioceiling();
4077c478bd9Sstevel@tonic-gate extern int pthread_condattr_init();
4087c478bd9Sstevel@tonic-gate extern int pthread_condattr_destroy();
4097c478bd9Sstevel@tonic-gate extern int pthread_condattr_setclock();
4107c478bd9Sstevel@tonic-gate extern int pthread_condattr_getclock();
4117c478bd9Sstevel@tonic-gate extern int pthread_condattr_setpshared();
4127c478bd9Sstevel@tonic-gate extern int pthread_condattr_getpshared();
4137c478bd9Sstevel@tonic-gate extern int pthread_cond_init();
4147c478bd9Sstevel@tonic-gate extern int pthread_cond_destroy();
4157c478bd9Sstevel@tonic-gate extern int pthread_cond_broadcast();
4167c478bd9Sstevel@tonic-gate extern int pthread_cond_signal();
4177c478bd9Sstevel@tonic-gate extern int pthread_cond_wait();
4187c478bd9Sstevel@tonic-gate extern int pthread_cond_timedwait();
4197c478bd9Sstevel@tonic-gate extern int pthread_cond_reltimedwait_np();
4207c478bd9Sstevel@tonic-gate extern int pthread_attr_getguardsize();
4217c478bd9Sstevel@tonic-gate extern int pthread_attr_setguardsize();
4227c478bd9Sstevel@tonic-gate extern int pthread_getconcurrency();
4237c478bd9Sstevel@tonic-gate extern int pthread_setconcurrency();
4247c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_settype();
4257c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_gettype();
4267c478bd9Sstevel@tonic-gate extern int pthread_rwlock_init();
4277c478bd9Sstevel@tonic-gate extern int pthread_rwlock_destroy();
4287c478bd9Sstevel@tonic-gate extern int pthread_rwlock_rdlock();
4297c478bd9Sstevel@tonic-gate extern int pthread_rwlock_tryrdlock();
4307c478bd9Sstevel@tonic-gate extern int pthread_rwlock_wrlock();
4317c478bd9Sstevel@tonic-gate extern int pthread_rwlock_trywrlock();
4327c478bd9Sstevel@tonic-gate extern int pthread_rwlock_unlock();
4337c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_init();
4347c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_destroy();
4357c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_getpshared();
4367c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_setpshared();
4377c478bd9Sstevel@tonic-gate extern int pthread_spin_init();
4387c478bd9Sstevel@tonic-gate extern int pthread_spin_destroy();
4397c478bd9Sstevel@tonic-gate extern int pthread_spin_lock();
4407c478bd9Sstevel@tonic-gate extern int pthread_spin_trylock();
4417c478bd9Sstevel@tonic-gate extern int pthread_spin_unlock();
4427c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_init();
4437c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_destroy();
4447c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_setpshared();
4457c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_getpshared();
4467c478bd9Sstevel@tonic-gate extern int pthread_barrier_init();
4477c478bd9Sstevel@tonic-gate extern int pthread_barrier_destroy();
4487c478bd9Sstevel@tonic-gate extern int pthread_barrier_wait();
4497c478bd9Sstevel@tonic-gate 
4507c478bd9Sstevel@tonic-gate #endif	/* __STDC__ */
4517c478bd9Sstevel@tonic-gate 
4527c478bd9Sstevel@tonic-gate #endif	/* _ASM */
4537c478bd9Sstevel@tonic-gate 
4547c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
4557c478bd9Sstevel@tonic-gate }
4567c478bd9Sstevel@tonic-gate #endif
4577c478bd9Sstevel@tonic-gate 
4587c478bd9Sstevel@tonic-gate #endif	/* _PTHREAD_H */
459