Print this page
remove support for non-ANSI compilation


   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*


  23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 #ifndef _PTHREAD_H
  28 #define _PTHREAD_H
  29 
  30 #include <sys/feature_tests.h>
  31 
  32 #ifndef _ASM
  33 #include <sys/types.h>
  34 #include <time.h>
  35 #include <sched.h>
  36 #endif  /* _ASM */
  37 
  38 #ifdef  __cplusplus
  39 extern "C" {
  40 #endif
  41 
  42 /*


 133 
 134 /*
 135  * The key to be created by pthread_key_create_once_np()
 136  * must be statically initialized with PTHREAD_ONCE_KEY_NP.
 137  * This must be the same as THR_ONCE_KEY in <thread.h>
 138  */
 139 #define PTHREAD_ONCE_KEY_NP     (pthread_key_t)(-1)
 140 
 141 /* barriers */
 142 #define PTHREAD_BARRIER_SERIAL_THREAD   -2
 143 
 144 #ifndef _ASM
 145 
 146 /*
 147  * cancellation cleanup structure
 148  */
 149 typedef struct _cleanup {
 150         uintptr_t       pthread_cleanup_pad[4];
 151 } _cleanup_t;
 152 
 153 #ifdef  __STDC__
 154 
 155 void    __pthread_cleanup_push(void (*)(void *), void *, caddr_t, _cleanup_t *);
 156 void    __pthread_cleanup_pop(int, _cleanup_t *);
 157 caddr_t _getfp(void);
 158 
 159 #else   /* __STDC__ */
 160 
 161 void    __pthread_cleanup_push();
 162 void    __pthread_cleanup_pop();
 163 caddr_t _getfp();
 164 
 165 #endif  /* __STDC__ */
 166 
 167 #if __cplusplus
 168 extern "C" {
 169 #endif
 170 
 171 typedef void (*_Voidfp)(void*); /* pointer to extern "C" function */
 172 
 173 #if __cplusplus
 174 } /* extern "C" */
 175 #endif
 176 
 177 #define pthread_cleanup_push(routine, args) { \
 178         _cleanup_t _cleanup_info; \
 179         __pthread_cleanup_push((_Voidfp)(routine), (void *)(args), \
 180                                 (caddr_t)_getfp(), &_cleanup_info);
 181 
 182 #define pthread_cleanup_pop(ex) \
 183         __pthread_cleanup_pop(ex, &_cleanup_info); \
 184 }
 185 
 186 #ifdef  __STDC__
 187 
 188 /*
 189  * function prototypes - thread related calls
 190  */
 191 
 192 /*
 193  * pthread_atfork() is also declared in <unistd.h> as per SUSv2. The
 194  * declarations are identical. A change to either one may also require
 195  * appropriate namespace updates in order to avoid redeclaration
 196  * warnings in the case where both prototypes are exposed via inclusion
 197  * of both <pthread.h> and <unistd.h>.
 198  */
 199 extern int pthread_atfork(void (*) (void), void (*) (void), void (*) (void));
 200 extern int pthread_attr_init(pthread_attr_t *);
 201 extern int pthread_attr_destroy(pthread_attr_t *);
 202 extern int pthread_attr_setstack(pthread_attr_t *, void *, size_t);
 203 extern int pthread_attr_getstack(const pthread_attr_t *_RESTRICT_KYWD,
 204                 void **_RESTRICT_KYWD, size_t *_RESTRICT_KYWD);
 205 extern int pthread_attr_setstacksize(pthread_attr_t *, size_t);
 206 extern int pthread_attr_getstacksize(const pthread_attr_t *_RESTRICT_KYWD,
 207                 size_t *_RESTRICT_KYWD);


 330 extern int pthread_spin_destroy(pthread_spinlock_t *);
 331 extern int pthread_spin_lock(pthread_spinlock_t *);
 332 extern int pthread_spin_trylock(pthread_spinlock_t *);
 333 extern int pthread_spin_unlock(pthread_spinlock_t *);
 334 extern int pthread_barrierattr_init(pthread_barrierattr_t *);
 335 extern int pthread_barrierattr_destroy(pthread_barrierattr_t *);
 336 extern int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int);
 337 extern int pthread_barrierattr_getpshared(
 338         const pthread_barrierattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
 339 extern int pthread_barrier_init(pthread_barrier_t *_RESTRICT_KYWD,
 340         const pthread_barrierattr_t *_RESTRICT_KYWD, uint_t);
 341 extern int pthread_barrier_destroy(pthread_barrier_t *);
 342 extern int pthread_barrier_wait(pthread_barrier_t *);
 343 
 344 /* Historical names -- present only for binary compatibility */
 345 extern int pthread_mutex_consistent_np(pthread_mutex_t *);
 346 extern int pthread_mutexattr_setrobust_np(pthread_mutexattr_t *, int);
 347 extern int pthread_mutexattr_getrobust_np(
 348         const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
 349 
 350 #else   /* __STDC__ */
 351 
 352 /*
 353  * function prototypes - thread related calls
 354  */
 355 extern int pthread_atfork();
 356 extern int pthread_attr_init();
 357 extern int pthread_attr_destroy();
 358 extern int pthread_attr_setstack();
 359 extern int pthread_attr_getstack();
 360 extern int pthread_attr_setstacksize();
 361 extern int pthread_attr_getstacksize();
 362 extern int pthread_attr_setstackaddr();
 363 extern int pthread_attr_getstackaddr();
 364 extern int pthread_attr_setdetachstate();
 365 extern int pthread_attr_getdetachstate();
 366 extern int pthread_attr_setscope();
 367 extern int pthread_attr_getscope();
 368 extern int pthread_attr_setinheritsched();
 369 extern int pthread_attr_getinheritsched();
 370 extern int pthread_attr_setschedpolicy();
 371 extern int pthread_attr_getschedpolicy();
 372 extern int pthread_attr_setschedparam();
 373 extern int pthread_attr_getschedparam();
 374 extern int pthread_create();
 375 extern int pthread_once();
 376 extern int pthread_join();
 377 extern int pthread_detach();
 378 extern void pthread_exit();
 379 extern int pthread_cancel();
 380 extern int pthread_setschedparam();
 381 extern int pthread_getschedparam();
 382 extern int pthread_setschedprio();
 383 extern int pthread_setcancelstate();
 384 extern int pthread_setcanceltype();
 385 extern void pthread_testcancel();
 386 extern int pthread_equal();
 387 extern int pthread_key_create();
 388 extern int pthread_key_create_once_np();
 389 extern int pthread_key_delete();
 390 extern int pthread_setspecific();
 391 extern void *pthread_getspecific();
 392 extern pthread_t pthread_self();
 393 /*
 394  * function prototypes - synchronization related calls
 395  */
 396 extern int pthread_mutexattr_init();
 397 extern int pthread_mutexattr_destroy();
 398 extern int pthread_mutexattr_setpshared();
 399 extern int pthread_mutexattr_getpshared();
 400 extern int pthread_mutexattr_setprotocol();
 401 extern int pthread_mutexattr_getprotocol();
 402 extern int pthread_mutexattr_setprioceiling();
 403 extern int pthread_mutexattr_getprioceiling();
 404 extern int pthread_mutexattr_setrobust();
 405 extern int pthread_mutexattr_getrobust();
 406 extern int pthread_mutex_init();
 407 extern int pthread_mutex_consistent();
 408 extern int pthread_mutex_destroy();
 409 extern int pthread_mutex_lock();
 410 extern int pthread_mutex_timedlock();
 411 extern int pthread_mutex_reltimedlock_np();
 412 extern int pthread_mutex_unlock();
 413 extern int pthread_mutex_trylock();
 414 extern int pthread_mutex_setprioceiling();
 415 extern int pthread_mutex_getprioceiling();
 416 extern int pthread_condattr_init();
 417 extern int pthread_condattr_destroy();
 418 extern int pthread_condattr_setclock();
 419 extern int pthread_condattr_getclock();
 420 extern int pthread_condattr_setpshared();
 421 extern int pthread_condattr_getpshared();
 422 extern int pthread_cond_init();
 423 extern int pthread_cond_destroy();
 424 extern int pthread_cond_broadcast();
 425 extern int pthread_cond_signal();
 426 extern int pthread_cond_wait();
 427 extern int pthread_cond_timedwait();
 428 extern int pthread_cond_reltimedwait_np();
 429 extern int pthread_attr_getguardsize();
 430 extern int pthread_attr_setguardsize();
 431 extern int pthread_getconcurrency();
 432 extern int pthread_setconcurrency();
 433 extern int pthread_mutexattr_settype();
 434 extern int pthread_mutexattr_gettype();
 435 extern int pthread_rwlock_init();
 436 extern int pthread_rwlock_destroy();
 437 extern int pthread_rwlock_rdlock();
 438 extern int pthread_rwlock_tryrdlock();
 439 extern int pthread_rwlock_wrlock();
 440 extern int pthread_rwlock_trywrlock();
 441 extern int pthread_rwlock_unlock();
 442 extern int pthread_rwlockattr_init();
 443 extern int pthread_rwlockattr_destroy();
 444 extern int pthread_rwlockattr_getpshared();
 445 extern int pthread_rwlockattr_setpshared();
 446 extern int pthread_spin_init();
 447 extern int pthread_spin_destroy();
 448 extern int pthread_spin_lock();
 449 extern int pthread_spin_trylock();
 450 extern int pthread_spin_unlock();
 451 extern int pthread_barrierattr_init();
 452 extern int pthread_barrierattr_destroy();
 453 extern int pthread_barrierattr_setpshared();
 454 extern int pthread_barrierattr_getpshared();
 455 extern int pthread_barrier_init();
 456 extern int pthread_barrier_destroy();
 457 extern int pthread_barrier_wait();
 458 
 459 /* Historical names -- present only for binary compatibility */
 460 extern int pthread_mutex_consistent_np();
 461 extern int pthread_mutexattr_setrobust_np();
 462 extern int pthread_mutexattr_getrobust_np();
 463 
 464 #endif  /* __STDC__ */
 465 
 466 #endif  /* _ASM */
 467 
 468 #ifdef  __cplusplus
 469 }
 470 #endif
 471 
 472 #endif  /* _PTHREAD_H */


   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
  24  *
  25  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  26  * Use is subject to license terms.
  27  */
  28 
  29 #ifndef _PTHREAD_H
  30 #define _PTHREAD_H
  31 
  32 #include <sys/feature_tests.h>
  33 
  34 #ifndef _ASM
  35 #include <sys/types.h>
  36 #include <time.h>
  37 #include <sched.h>
  38 #endif  /* _ASM */
  39 
  40 #ifdef  __cplusplus
  41 extern "C" {
  42 #endif
  43 
  44 /*


 135 
 136 /*
 137  * The key to be created by pthread_key_create_once_np()
 138  * must be statically initialized with PTHREAD_ONCE_KEY_NP.
 139  * This must be the same as THR_ONCE_KEY in <thread.h>
 140  */
 141 #define PTHREAD_ONCE_KEY_NP     (pthread_key_t)(-1)
 142 
 143 /* barriers */
 144 #define PTHREAD_BARRIER_SERIAL_THREAD   -2
 145 
 146 #ifndef _ASM
 147 
 148 /*
 149  * cancellation cleanup structure
 150  */
 151 typedef struct _cleanup {
 152         uintptr_t       pthread_cleanup_pad[4];
 153 } _cleanup_t;
 154 


 155 void    __pthread_cleanup_push(void (*)(void *), void *, caddr_t, _cleanup_t *);
 156 void    __pthread_cleanup_pop(int, _cleanup_t *);
 157 caddr_t _getfp(void);
 158 








 159 #if __cplusplus
 160 extern "C" {
 161 #endif
 162 
 163 typedef void (*_Voidfp)(void*); /* pointer to extern "C" function */
 164 
 165 #if __cplusplus
 166 } /* extern "C" */
 167 #endif
 168 
 169 #define pthread_cleanup_push(routine, args) { \
 170         _cleanup_t _cleanup_info; \
 171         __pthread_cleanup_push((_Voidfp)(routine), (void *)(args), \
 172                                 (caddr_t)_getfp(), &_cleanup_info);
 173 
 174 #define pthread_cleanup_pop(ex) \
 175         __pthread_cleanup_pop(ex, &_cleanup_info); \
 176 }
 177 


 178 /*
 179  * function prototypes - thread related calls
 180  */
 181 
 182 /*
 183  * pthread_atfork() is also declared in <unistd.h> as per SUSv2. The
 184  * declarations are identical. A change to either one may also require
 185  * appropriate namespace updates in order to avoid redeclaration
 186  * warnings in the case where both prototypes are exposed via inclusion
 187  * of both <pthread.h> and <unistd.h>.
 188  */
 189 extern int pthread_atfork(void (*) (void), void (*) (void), void (*) (void));
 190 extern int pthread_attr_init(pthread_attr_t *);
 191 extern int pthread_attr_destroy(pthread_attr_t *);
 192 extern int pthread_attr_setstack(pthread_attr_t *, void *, size_t);
 193 extern int pthread_attr_getstack(const pthread_attr_t *_RESTRICT_KYWD,
 194                 void **_RESTRICT_KYWD, size_t *_RESTRICT_KYWD);
 195 extern int pthread_attr_setstacksize(pthread_attr_t *, size_t);
 196 extern int pthread_attr_getstacksize(const pthread_attr_t *_RESTRICT_KYWD,
 197                 size_t *_RESTRICT_KYWD);


 320 extern int pthread_spin_destroy(pthread_spinlock_t *);
 321 extern int pthread_spin_lock(pthread_spinlock_t *);
 322 extern int pthread_spin_trylock(pthread_spinlock_t *);
 323 extern int pthread_spin_unlock(pthread_spinlock_t *);
 324 extern int pthread_barrierattr_init(pthread_barrierattr_t *);
 325 extern int pthread_barrierattr_destroy(pthread_barrierattr_t *);
 326 extern int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int);
 327 extern int pthread_barrierattr_getpshared(
 328         const pthread_barrierattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
 329 extern int pthread_barrier_init(pthread_barrier_t *_RESTRICT_KYWD,
 330         const pthread_barrierattr_t *_RESTRICT_KYWD, uint_t);
 331 extern int pthread_barrier_destroy(pthread_barrier_t *);
 332 extern int pthread_barrier_wait(pthread_barrier_t *);
 333 
 334 /* Historical names -- present only for binary compatibility */
 335 extern int pthread_mutex_consistent_np(pthread_mutex_t *);
 336 extern int pthread_mutexattr_setrobust_np(pthread_mutexattr_t *, int);
 337 extern int pthread_mutexattr_getrobust_np(
 338         const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
 339 




















































































































 340 #endif  /* _ASM */
 341 
 342 #ifdef  __cplusplus
 343 }
 344 #endif
 345 
 346 #endif  /* _PTHREAD_H */