1 /* 2 * Copyright (c) 2003-2013 Apple Inc. All rights reserved. 3 * 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. The rights granted to you under the License 10 * may not be used to create, or enable the creation or redistribution of, 11 * unlawful or unlicensed copies of an Apple operating system, or to 12 * circumvent, violate, or enable the circumvention or violation of, any 13 * terms of an Apple operating system software license agreement. 14 * 15 * Please obtain a copy of the License at 16 * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 * 18 * The Original Code and all software distributed under the License are 19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 * Please see the License for the specific language governing rights and 24 * limitations under the License. 25 * 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 */ 28 29 #ifndef _SYS__PTHREAD_TYPES_H_ 30 #define _SYS__PTHREAD_TYPES_H_ 31 32 #include <sys/cdefs.h> 33 34 // pthread opaque structures 35 #if defined(__LP64__) 36 #define __PTHREAD_SIZE__ 8176 37 #define __PTHREAD_ATTR_SIZE__ 56 38 #define __PTHREAD_MUTEXATTR_SIZE__ 8 39 #define __PTHREAD_MUTEX_SIZE__ 56 40 #define __PTHREAD_CONDATTR_SIZE__ 8 41 #define __PTHREAD_COND_SIZE__ 40 42 #define __PTHREAD_ONCE_SIZE__ 8 43 #define __PTHREAD_RWLOCK_SIZE__ 192 44 #define __PTHREAD_RWLOCKATTR_SIZE__ 16 45 #else // !__LP64__ 46 #define __PTHREAD_SIZE__ 4088 47 #define __PTHREAD_ATTR_SIZE__ 36 48 #define __PTHREAD_MUTEXATTR_SIZE__ 8 49 #define __PTHREAD_MUTEX_SIZE__ 40 50 #define __PTHREAD_CONDATTR_SIZE__ 4 51 #define __PTHREAD_COND_SIZE__ 24 52 #define __PTHREAD_ONCE_SIZE__ 4 53 #define __PTHREAD_RWLOCK_SIZE__ 124 54 #define __PTHREAD_RWLOCKATTR_SIZE__ 12 55 #endif // !__LP64__ 56 57 struct __darwin_pthread_handler_rec { 58 void (*__routine)(void *); // Routine to call 59 void *__arg; // Argument to pass 60 struct __darwin_pthread_handler_rec *__next; 61 }; 62 63 struct _opaque_pthread_attr_t { 64 long __sig; 65 char __opaque[__PTHREAD_ATTR_SIZE__]; 66 }; 67 68 struct _opaque_pthread_cond_t { 69 long __sig; 70 char __opaque[__PTHREAD_COND_SIZE__]; 71 }; 72 73 struct _opaque_pthread_condattr_t { 74 long __sig; 75 char __opaque[__PTHREAD_CONDATTR_SIZE__]; 76 }; 77 78 struct _opaque_pthread_mutex_t { 79 long __sig; 80 char __opaque[__PTHREAD_MUTEX_SIZE__]; 81 }; 82 83 struct _opaque_pthread_mutexattr_t { 84 long __sig; 85 char __opaque[__PTHREAD_MUTEXATTR_SIZE__]; 86 }; 87 88 struct _opaque_pthread_once_t { 89 long __sig; 90 char __opaque[__PTHREAD_ONCE_SIZE__]; 91 }; 92 93 struct _opaque_pthread_rwlock_t { 94 long __sig; 95 char __opaque[__PTHREAD_RWLOCK_SIZE__]; 96 }; 97 98 struct _opaque_pthread_rwlockattr_t { 99 long __sig; 100 char __opaque[__PTHREAD_RWLOCKATTR_SIZE__]; 101 }; 102 103 struct _opaque_pthread_t { 104 long __sig; 105 struct __darwin_pthread_handler_rec *__cleanup_stack; 106 char __opaque[__PTHREAD_SIZE__]; 107 }; 108 109 typedef struct _opaque_pthread_attr_t __darwin_pthread_attr_t; 110 typedef struct _opaque_pthread_cond_t __darwin_pthread_cond_t; 111 typedef struct _opaque_pthread_condattr_t __darwin_pthread_condattr_t; 112 typedef unsigned long __darwin_pthread_key_t; 113 typedef struct _opaque_pthread_mutex_t __darwin_pthread_mutex_t; 114 typedef struct _opaque_pthread_mutexattr_t __darwin_pthread_mutexattr_t; 115 typedef struct _opaque_pthread_once_t __darwin_pthread_once_t; 116 typedef struct _opaque_pthread_rwlock_t __darwin_pthread_rwlock_t; 117 typedef struct _opaque_pthread_rwlockattr_t __darwin_pthread_rwlockattr_t; 118 typedef struct _opaque_pthread_t *__darwin_pthread_t; 119 120 #endif // _SYS__PTHREAD_TYPES_H_ 121