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