]>
Commit | Line | Data |
---|---|---|
91447636 | 1 | /* |
5d5c5d0d A |
2 | * Copyright (c) 2003 Apple Computer, Inc. All rights reserved. |
3 | * | |
8f6c56a5 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
91447636 | 5 | * |
8f6c56a5 A |
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 | |
8ad349bb | 24 | * limitations under the License. |
8f6c56a5 A |
25 | * |
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ | |
91447636 A |
27 | */ |
28 | ||
29 | #ifndef _SYS__TYPES_H_ | |
30 | #define _SYS__TYPES_H_ | |
31 | ||
32 | #include <sys/cdefs.h> | |
33 | #include <machine/_types.h> | |
34 | ||
35 | /* Forward references */ | |
36 | #ifndef _POSIX_C_SOURCE | |
37 | struct mcontext; | |
38 | struct mcontext64; | |
39 | #else /* _POSIX_C_SOURCE */ | |
40 | struct __darwin_mcontext; | |
41 | #endif /* _POSIX_C_SOURCE */ | |
42 | ||
43 | /* pthread opaque structures */ | |
44 | #if defined(__LP64__) | |
45 | #define __PTHREAD_SIZE__ 1168 | |
46 | #define __PTHREAD_ATTR_SIZE__ 56 | |
47 | #define __PTHREAD_MUTEXATTR_SIZE__ 8 | |
48 | #define __PTHREAD_MUTEX_SIZE__ 56 | |
49 | #define __PTHREAD_CONDATTR_SIZE__ 8 | |
50 | #define __PTHREAD_COND_SIZE__ 40 | |
51 | #define __PTHREAD_ONCE_SIZE__ 8 | |
52 | #define __PTHREAD_RWLOCK_SIZE__ 192 | |
53 | #define __PTHREAD_RWLOCKATTR_SIZE__ 16 | |
54 | #else /* __LP64__ */ | |
55 | #define __PTHREAD_SIZE__ 596 | |
56 | #define __PTHREAD_ATTR_SIZE__ 36 | |
57 | #define __PTHREAD_MUTEXATTR_SIZE__ 8 | |
58 | #define __PTHREAD_MUTEX_SIZE__ 40 | |
59 | #define __PTHREAD_CONDATTR_SIZE__ 4 | |
60 | #define __PTHREAD_COND_SIZE__ 24 | |
61 | #define __PTHREAD_ONCE_SIZE__ 4 | |
62 | #define __PTHREAD_RWLOCK_SIZE__ 124 | |
63 | #define __PTHREAD_RWLOCKATTR_SIZE__ 12 | |
64 | #endif /* __LP64__ */ | |
65 | ||
66 | struct __darwin_pthread_handler_rec | |
67 | { | |
68 | void (*__routine)(void *); /* Routine to call */ | |
69 | void *__arg; /* Argument to pass */ | |
70 | struct __darwin_pthread_handler_rec *__next; | |
71 | }; | |
72 | struct _opaque_pthread_attr_t { long __sig; char __opaque[__PTHREAD_ATTR_SIZE__]; }; | |
73 | struct _opaque_pthread_cond_t { long __sig; char __opaque[__PTHREAD_COND_SIZE__]; }; | |
74 | struct _opaque_pthread_condattr_t { long __sig; char __opaque[__PTHREAD_CONDATTR_SIZE__]; }; | |
75 | struct _opaque_pthread_mutex_t { long __sig; char __opaque[__PTHREAD_MUTEX_SIZE__]; }; | |
76 | struct _opaque_pthread_mutexattr_t { long __sig; char __opaque[__PTHREAD_MUTEXATTR_SIZE__]; }; | |
77 | struct _opaque_pthread_once_t { long __sig; char __opaque[__PTHREAD_ONCE_SIZE__]; }; | |
78 | struct _opaque_pthread_rwlock_t { long __sig; char __opaque[__PTHREAD_RWLOCK_SIZE__]; }; | |
79 | struct _opaque_pthread_rwlockattr_t { long __sig; char __opaque[__PTHREAD_RWLOCKATTR_SIZE__]; }; | |
80 | struct _opaque_pthread_t { long __sig; struct __darwin_pthread_handler_rec *__cleanup_stack; char __opaque[__PTHREAD_SIZE__]; }; | |
81 | ||
82 | /* | |
83 | * Type definitions; takes common type definitions that must be used | |
84 | * in multiple header files due to [XSI], removes them from the system | |
85 | * space, and puts them in the implementation space. | |
86 | */ | |
87 | ||
88 | #ifdef __cplusplus | |
89 | #ifdef __GNUG__ | |
90 | #define __DARWIN_NULL __null | |
91 | #else /* ! __GNUG__ */ | |
92 | #ifdef __LP64__ | |
93 | #define __DARWIN_NULL (0L) | |
94 | #else /* !__LP64__ */ | |
95 | #define __DARWIN_NULL 0 | |
96 | #endif /* __LP64__ */ | |
97 | #endif /* __GNUG__ */ | |
98 | #else /* ! __cplusplus */ | |
99 | #define __DARWIN_NULL ((void *)0) | |
100 | #endif /* __cplusplus */ | |
101 | ||
102 | typedef __int64_t __darwin_blkcnt_t; /* total blocks */ | |
103 | typedef __int32_t __darwin_blksize_t; /* preferred block size */ | |
104 | typedef __int32_t __darwin_dev_t; /* dev_t */ | |
105 | typedef unsigned int __darwin_fsblkcnt_t; /* Used by statvfs and fstatvfs */ | |
106 | typedef unsigned int __darwin_fsfilcnt_t; /* Used by statvfs and fstatvfs */ | |
107 | typedef __uint32_t __darwin_gid_t; /* [???] process and group IDs */ | |
108 | typedef __uint32_t __darwin_id_t; /* [XSI] pid_t, uid_t, or gid_t*/ | |
109 | typedef __uint32_t __darwin_ino_t; /* [???] Used for inodes */ | |
110 | typedef __darwin_natural_t __darwin_mach_port_name_t; /* Used by mach */ | |
111 | typedef __darwin_mach_port_name_t __darwin_mach_port_t; /* Used by mach */ | |
112 | #ifndef _POSIX_C_SOURCE | |
113 | typedef struct mcontext *__darwin_mcontext_t; /* [???] machine context */ | |
114 | typedef struct mcontext64 *__darwin_mcontext64_t; /* [???] machine context */ | |
115 | #else /* _POSIX_C_SOURCE */ | |
116 | typedef struct __darwin_mcontext *__darwin_mcontext_t; /* [???] machine context */ | |
117 | #endif /* _POSIX_C_SOURCE */ | |
118 | typedef __uint16_t __darwin_mode_t; /* [???] Some file attributes */ | |
119 | typedef __int64_t __darwin_off_t; /* [???] Used for file sizes */ | |
120 | typedef __int32_t __darwin_pid_t; /* [???] process and group IDs */ | |
121 | typedef struct _opaque_pthread_attr_t | |
122 | __darwin_pthread_attr_t; /* [???] Used for pthreads */ | |
123 | typedef struct _opaque_pthread_cond_t | |
124 | __darwin_pthread_cond_t; /* [???] Used for pthreads */ | |
125 | typedef struct _opaque_pthread_condattr_t | |
126 | __darwin_pthread_condattr_t; /* [???] Used for pthreads */ | |
127 | typedef unsigned long __darwin_pthread_key_t; /* [???] Used for pthreads */ | |
128 | typedef struct _opaque_pthread_mutex_t | |
129 | __darwin_pthread_mutex_t; /* [???] Used for pthreads */ | |
130 | typedef struct _opaque_pthread_mutexattr_t | |
131 | __darwin_pthread_mutexattr_t; /* [???] Used for pthreads */ | |
132 | typedef struct _opaque_pthread_once_t | |
133 | __darwin_pthread_once_t; /* [???] Used for pthreads */ | |
134 | typedef struct _opaque_pthread_rwlock_t | |
135 | __darwin_pthread_rwlock_t; /* [???] Used for pthreads */ | |
136 | typedef struct _opaque_pthread_rwlockattr_t | |
137 | __darwin_pthread_rwlockattr_t; /* [???] Used for pthreads */ | |
138 | typedef struct _opaque_pthread_t | |
139 | *__darwin_pthread_t; /* [???] Used for pthreads */ | |
140 | typedef __uint32_t __darwin_sigset_t; /* [???] signal set */ | |
141 | typedef __int32_t __darwin_suseconds_t; /* [???] microseconds */ | |
142 | typedef __uint32_t __darwin_uid_t; /* [???] user IDs */ | |
143 | typedef __uint32_t __darwin_useconds_t; /* [???] microseconds */ | |
144 | typedef unsigned char __darwin_uuid_t[16]; | |
145 | ||
146 | /* Structure used in sigaltstack call. */ | |
147 | #ifndef _POSIX_C_SOURCE | |
148 | struct sigaltstack | |
149 | #else /* _POSIX_C_SOURCE */ | |
150 | struct __darwin_sigaltstack | |
151 | #endif /* _POSIX_C_SOURCE */ | |
152 | { | |
153 | void *ss_sp; /* signal stack base */ | |
154 | __darwin_size_t ss_size; /* signal stack length */ | |
155 | int ss_flags; /* SA_DISABLE and/or SA_ONSTACK */ | |
156 | }; | |
157 | #ifndef _POSIX_C_SOURCE | |
158 | typedef struct sigaltstack __darwin_stack_t; /* [???] signal stack */ | |
159 | #else /* _POSIX_C_SOURCE */ | |
160 | typedef struct __darwin_sigaltstack __darwin_stack_t; /* [???] signal stack */ | |
161 | #endif /* _POSIX_C_SOURCE */ | |
162 | ||
163 | /* user context */ | |
164 | #ifndef _POSIX_C_SOURCE | |
165 | struct ucontext | |
166 | #else /* _POSIX_C_SOURCE */ | |
167 | struct __darwin_ucontext | |
168 | #endif /* _POSIX_C_SOURCE */ | |
169 | { | |
170 | int uc_onstack; | |
171 | __darwin_sigset_t uc_sigmask; /* signal mask used by this context */ | |
172 | __darwin_stack_t uc_stack; /* stack used by this context */ | |
173 | #ifndef _POSIX_C_SOURCE | |
174 | struct ucontext *uc_link; /* pointer to resuming context */ | |
175 | #else /* _POSIX_C_SOURCE */ | |
176 | struct __darwin_ucontext *uc_link; /* pointer to resuming context */ | |
177 | #endif /* _POSIX_C_SOURCE */ | |
178 | __darwin_size_t uc_mcsize; /* size of the machine context passed in */ | |
179 | __darwin_mcontext_t uc_mcontext; /* pointer to machine specific context */ | |
180 | }; | |
181 | #ifndef _POSIX_C_SOURCE | |
182 | typedef struct ucontext __darwin_ucontext_t; /* [???] user context */ | |
183 | #else /* _POSIX_C_SOURCE */ | |
184 | typedef struct __darwin_ucontext __darwin_ucontext_t; /* [???] user context */ | |
185 | #endif /* _POSIX_C_SOURCE */ | |
186 | ||
187 | #ifndef _POSIX_C_SOURCE | |
188 | struct ucontext64 { | |
189 | int uc_onstack; | |
190 | __darwin_sigset_t uc_sigmask; /* signal mask used by this context */ | |
191 | __darwin_stack_t uc_stack; /* stack used by this context */ | |
192 | struct ucontext64 *uc_link; /* pointer to resuming context */ | |
193 | __darwin_size_t uc_mcsize; /* size of the machine context passed in */ | |
194 | __darwin_mcontext64_t uc_mcontext64; /* pointer to machine specific context */ | |
195 | }; | |
196 | typedef struct ucontext64 __darwin_ucontext64_t; /* [???] user context */ | |
197 | #endif /* _POSIX_C_SOURCE */ | |
198 | ||
199 | #ifdef KERNEL | |
200 | #ifndef offsetof | |
201 | #define offsetof(type, member) ((size_t)(&((type *)0)->member)) | |
202 | #endif /* offsetof */ | |
203 | #endif /* KERNEL */ | |
204 | #endif /* _SYS__TYPES_H_ */ |