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