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. 25*7bb0eb34SAndy 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 757c478bd9Sstevel@tonic-gate * keep these in synch which sys/synch.h lock flags 767c478bd9Sstevel@tonic-gate */ 777c478bd9Sstevel@tonic-gate #define PTHREAD_MUTEX_NORMAL 0x0 787c478bd9Sstevel@tonic-gate #define PTHREAD_MUTEX_ERRORCHECK 0x2 797c478bd9Sstevel@tonic-gate #define PTHREAD_MUTEX_RECURSIVE 0x4 807c478bd9Sstevel@tonic-gate #define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gate /* 837c478bd9Sstevel@tonic-gate * Mutex protocol values. Keep these in synch with sys/synch.h lock types. 847c478bd9Sstevel@tonic-gate */ 857c478bd9Sstevel@tonic-gate #define PTHREAD_PRIO_NONE 0x0 867c478bd9Sstevel@tonic-gate #define PTHREAD_PRIO_INHERIT 0x10 877c478bd9Sstevel@tonic-gate #define PTHREAD_PRIO_PROTECT 0x20 887c478bd9Sstevel@tonic-gate 897c478bd9Sstevel@tonic-gate /* 9080d89c86SRoger A. Faulkner * Mutex robust attribute values. 9180d89c86SRoger A. Faulkner * Keep these in synch with sys/synch.h lock types. 927c478bd9Sstevel@tonic-gate */ 9380d89c86SRoger A. Faulkner #define PTHREAD_MUTEX_STALLED 0x0 9480d89c86SRoger A. Faulkner #define PTHREAD_MUTEX_ROBUST 0x40 9580d89c86SRoger A. Faulkner /* 9680d89c86SRoger A. Faulkner * Historical solaris-specific names, 9780d89c86SRoger A. Faulkner * from before pthread_mutexattr_getrobust() became standardized 9880d89c86SRoger A. Faulkner */ 9980d89c86SRoger A. Faulkner #define PTHREAD_MUTEX_STALL_NP PTHREAD_MUTEX_STALLED 10080d89c86SRoger A. Faulkner #define PTHREAD_MUTEX_ROBUST_NP PTHREAD_MUTEX_ROBUST 1017c478bd9Sstevel@tonic-gate 1027c478bd9Sstevel@tonic-gate /* 1037c478bd9Sstevel@tonic-gate * macros - default initializers defined as in synch.h 1047c478bd9Sstevel@tonic-gate * Any change here should be reflected in synch.h. 1057c478bd9Sstevel@tonic-gate * 1067c478bd9Sstevel@tonic-gate * NOTE: 1077c478bd9Sstevel@tonic-gate * Make sure that any change in the macros is consistent with the definition 1087c478bd9Sstevel@tonic-gate * of the corresponding types in sys/types.h (e.g. PTHREAD_MUTEX_INITIALIZER 1097c478bd9Sstevel@tonic-gate * should be consistent with the definition for pthread_mutex_t). 1107c478bd9Sstevel@tonic-gate */ 1117c478bd9Sstevel@tonic-gate #define PTHREAD_MUTEX_INITIALIZER /* = DEFAULTMUTEX */ \ 112a90d75b8SRichard PALO {{0, 0, 0, PTHREAD_PROCESS_PRIVATE, _MUTEX_MAGIC}, {{{0}}}, 0} 1137c478bd9Sstevel@tonic-gate 114*7bb0eb34SAndy Fiddaman #define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP /* = ERRORCHECKMUTEX */ \ 115*7bb0eb34SAndy Fiddaman {{0, 0, 0, PTHREAD_PROCESS_PRIVATE | PTHREAD_MUTEX_ERRORCHECK, \ 116*7bb0eb34SAndy Fiddaman _MUTEX_MAGIC}, {{{0}}}, 0} 117*7bb0eb34SAndy Fiddaman 118*7bb0eb34SAndy Fiddaman #define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP /* = RECURSIVEMUTEX */ \ 119*7bb0eb34SAndy Fiddaman {{0, 0, 0, PTHREAD_PROCESS_PRIVATE | PTHREAD_MUTEX_RECURSIVE | \ 120*7bb0eb34SAndy Fiddaman PTHREAD_MUTEX_ERRORCHECK, _MUTEX_MAGIC}, {{{0}}}, 0} 121*7bb0eb34SAndy Fiddaman 1227c478bd9Sstevel@tonic-gate #define PTHREAD_COND_INITIALIZER /* = DEFAULTCV */ \ 123a90d75b8SRichard PALO {{{0, 0, 0, 0}, PTHREAD_PROCESS_PRIVATE, _COND_MAGIC}, 0} 1247c478bd9Sstevel@tonic-gate 1257c478bd9Sstevel@tonic-gate #define PTHREAD_RWLOCK_INITIALIZER /* = DEFAULTRWLOCK */ \ 126a90d75b8SRichard PALO {0, PTHREAD_PROCESS_PRIVATE, _RWL_MAGIC, PTHREAD_MUTEX_INITIALIZER, \ 1277c478bd9Sstevel@tonic-gate PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER} 1287c478bd9Sstevel@tonic-gate 1297c478bd9Sstevel@tonic-gate /* cancellation type and state */ 1307c478bd9Sstevel@tonic-gate #define PTHREAD_CANCEL_ENABLE 0x00 1317c478bd9Sstevel@tonic-gate #define PTHREAD_CANCEL_DISABLE 0x01 1327c478bd9Sstevel@tonic-gate #define PTHREAD_CANCEL_DEFERRED 0x00 1337c478bd9Sstevel@tonic-gate #define PTHREAD_CANCEL_ASYNCHRONOUS 0x02 1347c478bd9Sstevel@tonic-gate #define PTHREAD_CANCELED (void *)-19 1357c478bd9Sstevel@tonic-gate 1367c478bd9Sstevel@tonic-gate /* pthread_once related values */ 1377c478bd9Sstevel@tonic-gate #define PTHREAD_ONCE_NOTDONE 0 1387c478bd9Sstevel@tonic-gate #define PTHREAD_ONCE_DONE 1 1391e2ea07cSRoger A. Faulkner #define PTHREAD_ONCE_INIT { {0, 0, 0, PTHREAD_ONCE_NOTDONE} } 1407c478bd9Sstevel@tonic-gate 141cb620785Sraf /* 142cb620785Sraf * The key to be created by pthread_key_create_once_np() 143cb620785Sraf * must be statically initialized with PTHREAD_ONCE_KEY_NP. 144cb620785Sraf * This must be the same as THR_ONCE_KEY in <thread.h> 145cb620785Sraf */ 146cb620785Sraf #define PTHREAD_ONCE_KEY_NP (pthread_key_t)(-1) 147cb620785Sraf 1487c478bd9Sstevel@tonic-gate /* barriers */ 1497c478bd9Sstevel@tonic-gate #define PTHREAD_BARRIER_SERIAL_THREAD -2 1507c478bd9Sstevel@tonic-gate 151ab618543SJohn Levon /* For pthread_{get,set}name_np(). */ 152ab618543SJohn Levon #define PTHREAD_MAX_NAMELEN_NP (32) 153ab618543SJohn Levon 1547c478bd9Sstevel@tonic-gate #ifndef _ASM 1557c478bd9Sstevel@tonic-gate 1567c478bd9Sstevel@tonic-gate /* 1577c478bd9Sstevel@tonic-gate * cancellation cleanup structure 1587c478bd9Sstevel@tonic-gate */ 1597c478bd9Sstevel@tonic-gate typedef struct _cleanup { 1607c478bd9Sstevel@tonic-gate uintptr_t pthread_cleanup_pad[4]; 1617c478bd9Sstevel@tonic-gate } _cleanup_t; 1627c478bd9Sstevel@tonic-gate 1637c478bd9Sstevel@tonic-gate void __pthread_cleanup_push(void (*)(void *), void *, caddr_t, _cleanup_t *); 1647c478bd9Sstevel@tonic-gate void __pthread_cleanup_pop(int, _cleanup_t *); 1657c478bd9Sstevel@tonic-gate caddr_t _getfp(void); 1667c478bd9Sstevel@tonic-gate 1677c478bd9Sstevel@tonic-gate #if __cplusplus 1687c478bd9Sstevel@tonic-gate extern "C" { 1697c478bd9Sstevel@tonic-gate #endif 1707c478bd9Sstevel@tonic-gate 1717c478bd9Sstevel@tonic-gate typedef void (*_Voidfp)(void*); /* pointer to extern "C" function */ 1727c478bd9Sstevel@tonic-gate 1737c478bd9Sstevel@tonic-gate #if __cplusplus 1747c478bd9Sstevel@tonic-gate } /* extern "C" */ 1757c478bd9Sstevel@tonic-gate #endif 1767c478bd9Sstevel@tonic-gate 1777c478bd9Sstevel@tonic-gate #define pthread_cleanup_push(routine, args) { \ 1787c478bd9Sstevel@tonic-gate _cleanup_t _cleanup_info; \ 1797c478bd9Sstevel@tonic-gate __pthread_cleanup_push((_Voidfp)(routine), (void *)(args), \ 1807c478bd9Sstevel@tonic-gate (caddr_t)_getfp(), &_cleanup_info); 1817c478bd9Sstevel@tonic-gate 1827c478bd9Sstevel@tonic-gate #define pthread_cleanup_pop(ex) \ 1837c478bd9Sstevel@tonic-gate __pthread_cleanup_pop(ex, &_cleanup_info); \ 1847c478bd9Sstevel@tonic-gate } 1857c478bd9Sstevel@tonic-gate 1867c478bd9Sstevel@tonic-gate /* 1877c478bd9Sstevel@tonic-gate * function prototypes - thread related calls 1887c478bd9Sstevel@tonic-gate */ 1897c478bd9Sstevel@tonic-gate 1907c478bd9Sstevel@tonic-gate /* 1917c478bd9Sstevel@tonic-gate * pthread_atfork() is also declared in <unistd.h> as per SUSv2. The 1927c478bd9Sstevel@tonic-gate * declarations are identical. A change to either one may also require 1937c478bd9Sstevel@tonic-gate * appropriate namespace updates in order to avoid redeclaration 1947c478bd9Sstevel@tonic-gate * warnings in the case where both prototypes are exposed via inclusion 1957c478bd9Sstevel@tonic-gate * of both <pthread.h> and <unistd.h>. 1967c478bd9Sstevel@tonic-gate */ 1977c478bd9Sstevel@tonic-gate extern int pthread_atfork(void (*) (void), void (*) (void), void (*) (void)); 1987c478bd9Sstevel@tonic-gate extern int pthread_attr_init(pthread_attr_t *); 1997c478bd9Sstevel@tonic-gate extern int pthread_attr_destroy(pthread_attr_t *); 2007c478bd9Sstevel@tonic-gate extern int pthread_attr_setstack(pthread_attr_t *, void *, size_t); 2017c478bd9Sstevel@tonic-gate extern int pthread_attr_getstack(const pthread_attr_t *_RESTRICT_KYWD, 2027c478bd9Sstevel@tonic-gate void **_RESTRICT_KYWD, size_t *_RESTRICT_KYWD); 2037c478bd9Sstevel@tonic-gate extern int pthread_attr_setstacksize(pthread_attr_t *, size_t); 2047c478bd9Sstevel@tonic-gate extern int pthread_attr_getstacksize(const pthread_attr_t *_RESTRICT_KYWD, 2057c478bd9Sstevel@tonic-gate size_t *_RESTRICT_KYWD); 2067c478bd9Sstevel@tonic-gate extern int pthread_attr_setstackaddr(pthread_attr_t *, void *); 2077c478bd9Sstevel@tonic-gate extern int pthread_attr_getstackaddr(const pthread_attr_t *_RESTRICT_KYWD, 2087c478bd9Sstevel@tonic-gate void **_RESTRICT_KYWD); 2097c478bd9Sstevel@tonic-gate extern int pthread_attr_setdetachstate(pthread_attr_t *, int); 2107c478bd9Sstevel@tonic-gate extern int pthread_attr_getdetachstate(const pthread_attr_t *, int *); 2117c478bd9Sstevel@tonic-gate extern int pthread_attr_setscope(pthread_attr_t *, int); 2127c478bd9Sstevel@tonic-gate extern int pthread_attr_getscope(const pthread_attr_t *_RESTRICT_KYWD, 2137c478bd9Sstevel@tonic-gate int *_RESTRICT_KYWD); 2147c478bd9Sstevel@tonic-gate extern int pthread_attr_setinheritsched(pthread_attr_t *, int); 2157c478bd9Sstevel@tonic-gate extern int pthread_attr_getinheritsched(const pthread_attr_t *_RESTRICT_KYWD, 2167c478bd9Sstevel@tonic-gate int *_RESTRICT_KYWD); 2177c478bd9Sstevel@tonic-gate extern int pthread_attr_setschedpolicy(pthread_attr_t *, int); 2187c478bd9Sstevel@tonic-gate extern int pthread_attr_getschedpolicy(const pthread_attr_t *_RESTRICT_KYWD, 2197c478bd9Sstevel@tonic-gate int *_RESTRICT_KYWD); 2207c478bd9Sstevel@tonic-gate extern int pthread_attr_setschedparam(pthread_attr_t *_RESTRICT_KYWD, 2217c478bd9Sstevel@tonic-gate const struct sched_param *_RESTRICT_KYWD); 2227c478bd9Sstevel@tonic-gate extern int pthread_attr_getschedparam(const pthread_attr_t *_RESTRICT_KYWD, 2237c478bd9Sstevel@tonic-gate struct sched_param *_RESTRICT_KYWD); 224ab618543SJohn Levon extern int pthread_attr_setname_np(pthread_attr_t *_RESTRICT_KYWD, 225ab618543SJohn Levon const char *_RESTRICT_KYWD); 226ab618543SJohn Levon extern int pthread_attr_getname_np(pthread_attr_t *_RESTRICT_KYWD, 227ab618543SJohn Levon char *_RESTRICT_KYWD, size_t); 2287c478bd9Sstevel@tonic-gate extern int pthread_create(pthread_t *_RESTRICT_KYWD, 2297c478bd9Sstevel@tonic-gate const pthread_attr_t *_RESTRICT_KYWD, void * (*)(void *), 2307c478bd9Sstevel@tonic-gate void *_RESTRICT_KYWD); 2317c478bd9Sstevel@tonic-gate extern int pthread_once(pthread_once_t *, void (*)(void)); 2327c478bd9Sstevel@tonic-gate extern int pthread_join(pthread_t, void **); 2337c478bd9Sstevel@tonic-gate extern int pthread_detach(pthread_t); 2347c478bd9Sstevel@tonic-gate extern void pthread_exit(void *) __NORETURN; 2357c478bd9Sstevel@tonic-gate extern int pthread_cancel(pthread_t); 2367c478bd9Sstevel@tonic-gate extern int pthread_setschedparam(pthread_t, int, const struct sched_param *); 2377c478bd9Sstevel@tonic-gate extern int pthread_getschedparam(pthread_t, int *_RESTRICT_KYWD, 2387c478bd9Sstevel@tonic-gate struct sched_param *_RESTRICT_KYWD); 2397c478bd9Sstevel@tonic-gate extern int pthread_setschedprio(pthread_t, int); 2407c478bd9Sstevel@tonic-gate extern int pthread_setcancelstate(int, int *); 2417c478bd9Sstevel@tonic-gate extern int pthread_setcanceltype(int, int *); 2427c478bd9Sstevel@tonic-gate extern void pthread_testcancel(void); 2437c478bd9Sstevel@tonic-gate extern int pthread_equal(pthread_t, pthread_t); 2447c478bd9Sstevel@tonic-gate extern int pthread_key_create(pthread_key_t *, void (*)(void *)); 245cb620785Sraf extern int pthread_key_create_once_np(pthread_key_t *, void (*)(void *)); 2467c478bd9Sstevel@tonic-gate extern int pthread_key_delete(pthread_key_t); 2477c478bd9Sstevel@tonic-gate extern int pthread_setspecific(pthread_key_t, const void *); 2487c478bd9Sstevel@tonic-gate extern void *pthread_getspecific(pthread_key_t); 2497c478bd9Sstevel@tonic-gate extern pthread_t pthread_self(void); 250ab618543SJohn Levon extern int pthread_setname_np(pthread_t, const char *); 251ab618543SJohn Levon extern int pthread_getname_np(pthread_t, char *, size_t); 2527c478bd9Sstevel@tonic-gate 2537c478bd9Sstevel@tonic-gate /* 2547c478bd9Sstevel@tonic-gate * function prototypes - synchronization related calls 2557c478bd9Sstevel@tonic-gate */ 2567c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_init(pthread_mutexattr_t *); 2577c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_destroy(pthread_mutexattr_t *); 2587c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int); 2597c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_getpshared( 2607c478bd9Sstevel@tonic-gate const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD); 2617c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int); 2627c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_getprotocol( 2637c478bd9Sstevel@tonic-gate const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD); 2647c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int); 2657c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_getprioceiling( 2667c478bd9Sstevel@tonic-gate const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD); 26780d89c86SRoger A. Faulkner extern int pthread_mutexattr_setrobust(pthread_mutexattr_t *, int); 26880d89c86SRoger A. Faulkner extern int pthread_mutexattr_getrobust( 2697c478bd9Sstevel@tonic-gate const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD); 2707c478bd9Sstevel@tonic-gate extern int pthread_mutex_init(pthread_mutex_t *_RESTRICT_KYWD, 2717c478bd9Sstevel@tonic-gate const pthread_mutexattr_t *_RESTRICT_KYWD); 27280d89c86SRoger A. Faulkner extern int pthread_mutex_consistent(pthread_mutex_t *); 2737c478bd9Sstevel@tonic-gate extern int pthread_mutex_destroy(pthread_mutex_t *); 2747c478bd9Sstevel@tonic-gate extern int pthread_mutex_lock(pthread_mutex_t *); 2757c478bd9Sstevel@tonic-gate extern int pthread_mutex_timedlock(pthread_mutex_t *_RESTRICT_KYWD, 2767c478bd9Sstevel@tonic-gate const struct timespec *_RESTRICT_KYWD); 2777c478bd9Sstevel@tonic-gate extern int pthread_mutex_reltimedlock_np(pthread_mutex_t *_RESTRICT_KYWD, 2787c478bd9Sstevel@tonic-gate const struct timespec *_RESTRICT_KYWD); 2797c478bd9Sstevel@tonic-gate extern int pthread_mutex_unlock(pthread_mutex_t *); 2807c478bd9Sstevel@tonic-gate extern int pthread_mutex_trylock(pthread_mutex_t *); 2817c478bd9Sstevel@tonic-gate extern int pthread_mutex_setprioceiling(pthread_mutex_t *_RESTRICT_KYWD, 2827c478bd9Sstevel@tonic-gate int, int *_RESTRICT_KYWD); 2837c478bd9Sstevel@tonic-gate extern int pthread_mutex_getprioceiling(const pthread_mutex_t *_RESTRICT_KYWD, 2847c478bd9Sstevel@tonic-gate int *_RESTRICT_KYWD); 2857c478bd9Sstevel@tonic-gate extern int pthread_condattr_init(pthread_condattr_t *); 2867c478bd9Sstevel@tonic-gate extern int pthread_condattr_destroy(pthread_condattr_t *); 2877c478bd9Sstevel@tonic-gate extern int pthread_condattr_setclock(pthread_condattr_t *, clockid_t); 2887c478bd9Sstevel@tonic-gate extern int pthread_condattr_getclock(const pthread_condattr_t *_RESTRICT_KYWD, 2897c478bd9Sstevel@tonic-gate clockid_t *_RESTRICT_KYWD); 2907c478bd9Sstevel@tonic-gate extern int pthread_condattr_setpshared(pthread_condattr_t *, int); 2917c478bd9Sstevel@tonic-gate extern int pthread_condattr_getpshared(const pthread_condattr_t *_RESTRICT_KYWD, 2927c478bd9Sstevel@tonic-gate int *_RESTRICT_KYWD); 2937c478bd9Sstevel@tonic-gate extern int pthread_cond_init(pthread_cond_t *_RESTRICT_KYWD, 2947c478bd9Sstevel@tonic-gate const pthread_condattr_t *_RESTRICT_KYWD); 2957c478bd9Sstevel@tonic-gate extern int pthread_cond_destroy(pthread_cond_t *); 2967c478bd9Sstevel@tonic-gate extern int pthread_cond_broadcast(pthread_cond_t *); 2977c478bd9Sstevel@tonic-gate extern int pthread_cond_signal(pthread_cond_t *); 2987c478bd9Sstevel@tonic-gate extern int pthread_cond_wait(pthread_cond_t *_RESTRICT_KYWD, 2997c478bd9Sstevel@tonic-gate pthread_mutex_t *_RESTRICT_KYWD); 3007c478bd9Sstevel@tonic-gate extern int pthread_cond_timedwait(pthread_cond_t *_RESTRICT_KYWD, 3017c478bd9Sstevel@tonic-gate pthread_mutex_t *_RESTRICT_KYWD, const struct timespec *_RESTRICT_KYWD); 3027c478bd9Sstevel@tonic-gate extern int pthread_cond_reltimedwait_np(pthread_cond_t *_RESTRICT_KYWD, 3037c478bd9Sstevel@tonic-gate pthread_mutex_t *_RESTRICT_KYWD, const struct timespec *_RESTRICT_KYWD); 3047c478bd9Sstevel@tonic-gate extern int pthread_attr_getguardsize(const pthread_attr_t *_RESTRICT_KYWD, 3057c478bd9Sstevel@tonic-gate size_t *_RESTRICT_KYWD); 3067c478bd9Sstevel@tonic-gate extern int pthread_attr_setguardsize(pthread_attr_t *, size_t); 3077c478bd9Sstevel@tonic-gate extern int pthread_getconcurrency(void); 3087c478bd9Sstevel@tonic-gate extern int pthread_setconcurrency(int); 3097c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_settype(pthread_mutexattr_t *, int); 3107c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_gettype(const pthread_mutexattr_t *_RESTRICT_KYWD, 3117c478bd9Sstevel@tonic-gate int *_RESTRICT_KYWD); 3127c478bd9Sstevel@tonic-gate extern int pthread_rwlock_init(pthread_rwlock_t *_RESTRICT_KYWD, 3137c478bd9Sstevel@tonic-gate const pthread_rwlockattr_t *_RESTRICT_KYWD); 3147c478bd9Sstevel@tonic-gate extern int pthread_rwlock_destroy(pthread_rwlock_t *); 3157c478bd9Sstevel@tonic-gate extern int pthread_rwlock_rdlock(pthread_rwlock_t *); 3167c478bd9Sstevel@tonic-gate extern int pthread_rwlock_timedrdlock(pthread_rwlock_t *_RESTRICT_KYWD, 3177c478bd9Sstevel@tonic-gate const struct timespec *_RESTRICT_KYWD); 3187c478bd9Sstevel@tonic-gate extern int pthread_rwlock_reltimedrdlock_np(pthread_rwlock_t *_RESTRICT_KYWD, 3197c478bd9Sstevel@tonic-gate const struct timespec *_RESTRICT_KYWD); 3207c478bd9Sstevel@tonic-gate extern int pthread_rwlock_tryrdlock(pthread_rwlock_t *); 3217c478bd9Sstevel@tonic-gate extern int pthread_rwlock_wrlock(pthread_rwlock_t *); 3227c478bd9Sstevel@tonic-gate extern int pthread_rwlock_timedwrlock(pthread_rwlock_t *_RESTRICT_KYWD, 3237c478bd9Sstevel@tonic-gate const struct timespec *_RESTRICT_KYWD); 3247c478bd9Sstevel@tonic-gate extern int pthread_rwlock_reltimedwrlock_np(pthread_rwlock_t *_RESTRICT_KYWD, 3257c478bd9Sstevel@tonic-gate const struct timespec *_RESTRICT_KYWD); 3267c478bd9Sstevel@tonic-gate extern int pthread_rwlock_trywrlock(pthread_rwlock_t *); 3277c478bd9Sstevel@tonic-gate extern int pthread_rwlock_unlock(pthread_rwlock_t *); 3287c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_init(pthread_rwlockattr_t *); 3297c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_destroy(pthread_rwlockattr_t *); 3307c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_getpshared( 3317c478bd9Sstevel@tonic-gate const pthread_rwlockattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD); 3327c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int); 3337c478bd9Sstevel@tonic-gate extern int pthread_spin_init(pthread_spinlock_t *, int); 3347c478bd9Sstevel@tonic-gate extern int pthread_spin_destroy(pthread_spinlock_t *); 3357c478bd9Sstevel@tonic-gate extern int pthread_spin_lock(pthread_spinlock_t *); 3367c478bd9Sstevel@tonic-gate extern int pthread_spin_trylock(pthread_spinlock_t *); 3377c478bd9Sstevel@tonic-gate extern int pthread_spin_unlock(pthread_spinlock_t *); 3387c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_init(pthread_barrierattr_t *); 3397c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_destroy(pthread_barrierattr_t *); 3407c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int); 3417c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_getpshared( 3427c478bd9Sstevel@tonic-gate const pthread_barrierattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD); 3437c478bd9Sstevel@tonic-gate extern int pthread_barrier_init(pthread_barrier_t *_RESTRICT_KYWD, 3447c478bd9Sstevel@tonic-gate const pthread_barrierattr_t *_RESTRICT_KYWD, uint_t); 3457c478bd9Sstevel@tonic-gate extern int pthread_barrier_destroy(pthread_barrier_t *); 3467c478bd9Sstevel@tonic-gate extern int pthread_barrier_wait(pthread_barrier_t *); 3477c478bd9Sstevel@tonic-gate 34880d89c86SRoger A. Faulkner /* Historical names -- present only for binary compatibility */ 34980d89c86SRoger A. Faulkner extern int pthread_mutex_consistent_np(pthread_mutex_t *); 35080d89c86SRoger A. Faulkner extern int pthread_mutexattr_setrobust_np(pthread_mutexattr_t *, int); 35180d89c86SRoger A. Faulkner extern int pthread_mutexattr_getrobust_np( 35280d89c86SRoger A. Faulkner const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD); 35380d89c86SRoger A. Faulkner 354e56998eeSRobert Mustacchi /* 355e56998eeSRobert Mustacchi * These are non-standardized extensions that we provide. Their origins are 356e56998eeSRobert Mustacchi * documented in their manual pages. 357e56998eeSRobert Mustacchi */ 358*7bb0eb34SAndy Fiddaman #if !defined(_STRICT_SYMBOLS) 359e56998eeSRobert Mustacchi extern int pthread_attr_get_np(pthread_t, pthread_attr_t *); 360*7bb0eb34SAndy Fiddaman extern void pthread_mutex_enter_np(pthread_mutex_t *); 361*7bb0eb34SAndy Fiddaman extern void pthread_mutex_exit_np(pthread_mutex_t *); 362*7bb0eb34SAndy Fiddaman #endif /* !_STRICT_SYMBOLS */ 363e56998eeSRobert Mustacchi 3647c478bd9Sstevel@tonic-gate #endif /* _ASM */ 3657c478bd9Sstevel@tonic-gate 3667c478bd9Sstevel@tonic-gate #ifdef __cplusplus 3677c478bd9Sstevel@tonic-gate } 3687c478bd9Sstevel@tonic-gate #endif 3697c478bd9Sstevel@tonic-gate 3707c478bd9Sstevel@tonic-gate #endif /* _PTHREAD_H */ 371