]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
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. | |
11 | * | |
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 | |
18 | * under the License. | |
19 | * | |
20 | * @APPLE_LICENSE_HEADER_END@ | |
21 | */ | |
22 | /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ | |
23 | /*- | |
24 | * Copyright (c) 1982, 1986, 1991, 1993, 1994 | |
25 | * The Regents of the University of California. All rights reserved. | |
26 | * (c) UNIX System Laboratories, Inc. | |
27 | * All or some portions of this file are derived from material licensed | |
28 | * to the University of California by American Telephone and Telegraph | |
29 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with | |
30 | * the permission of UNIX System Laboratories, Inc. | |
31 | * | |
32 | * Redistribution and use in source and binary forms, with or without | |
33 | * modification, are permitted provided that the following conditions | |
34 | * are met: | |
35 | * 1. Redistributions of source code must retain the above copyright | |
36 | * notice, this list of conditions and the following disclaimer. | |
37 | * 2. Redistributions in binary form must reproduce the above copyright | |
38 | * notice, this list of conditions and the following disclaimer in the | |
39 | * documentation and/or other materials provided with the distribution. | |
40 | * 3. All advertising materials mentioning features or use of this software | |
41 | * must display the following acknowledgement: | |
42 | * This product includes software developed by the University of | |
43 | * California, Berkeley and its contributors. | |
44 | * 4. Neither the name of the University nor the names of its contributors | |
45 | * may be used to endorse or promote products derived from this software | |
46 | * without specific prior written permission. | |
47 | * | |
48 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
49 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
50 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
51 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
52 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
53 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
54 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
55 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
56 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
57 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
58 | * SUCH DAMAGE. | |
59 | * | |
60 | * @(#)types.h 8.4 (Berkeley) 1/21/94 | |
61 | */ | |
62 | ||
63 | #ifndef _SYS_TYPES_H_ | |
64 | #define _SYS_TYPES_H_ | |
65 | ||
66 | #include <sys/appleapiopts.h> | |
67 | ||
68 | #ifndef __ASSEMBLER__ | |
69 | #include <sys/cdefs.h> | |
70 | ||
71 | /* Machine type dependent parameters. */ | |
72 | #include <machine/types.h> | |
73 | #include <sys/_types.h> | |
74 | ||
75 | #include <machine/endian.h> | |
76 | ||
77 | #ifndef _POSIX_C_SOURCE | |
78 | typedef unsigned char u_char; | |
79 | typedef unsigned short u_short; | |
80 | typedef unsigned int u_int; | |
81 | #ifndef _U_LONG | |
82 | typedef unsigned long u_long; | |
83 | #define _U_LONG | |
84 | #endif | |
85 | typedef unsigned short ushort; /* Sys V compatibility */ | |
86 | typedef unsigned int uint; /* Sys V compatibility */ | |
87 | #endif | |
88 | ||
89 | typedef u_int64_t u_quad_t; /* quads */ | |
90 | typedef int64_t quad_t; | |
91 | typedef quad_t * qaddr_t; | |
92 | ||
93 | typedef char * caddr_t; /* core address */ | |
94 | typedef int32_t daddr_t; /* disk address */ | |
95 | ||
96 | #ifndef _DEV_T | |
97 | typedef __darwin_dev_t dev_t; /* device number */ | |
98 | #define _DEV_T | |
99 | #endif | |
100 | ||
101 | typedef u_int32_t fixpt_t; /* fixed point number */ | |
102 | ||
103 | #ifndef _BLKCNT_T | |
104 | typedef __darwin_blkcnt_t blkcnt_t; | |
105 | #define _BLKCNT_T | |
106 | #endif | |
107 | ||
108 | #ifndef _BLKSIZE_T | |
109 | typedef __darwin_blksize_t blksize_t; | |
110 | #define _BLKSIZE_T | |
111 | #endif | |
112 | ||
113 | #ifndef _GID_T | |
114 | typedef __darwin_gid_t gid_t; | |
115 | #define _GID_T | |
116 | #endif | |
117 | ||
118 | #ifndef _IN_ADDR_T | |
119 | #define _IN_ADDR_T | |
120 | typedef __uint32_t in_addr_t; /* base type for internet address */ | |
121 | #endif | |
122 | ||
123 | #ifndef _IN_PORT_T | |
124 | #define _IN_PORT_T | |
125 | typedef __uint16_t in_port_t; | |
126 | #endif | |
127 | ||
128 | #ifndef _INO_T | |
129 | typedef __darwin_ino_t ino_t; /* inode number */ | |
130 | #define _INO_T | |
131 | #endif | |
132 | ||
133 | #ifndef _KEY_T | |
134 | #define _KEY_T | |
135 | typedef __int32_t key_t; /* IPC key (for Sys V IPC) */ | |
136 | #endif | |
137 | ||
138 | #ifndef _MODE_T | |
139 | typedef __darwin_mode_t mode_t; | |
140 | #define _MODE_T | |
141 | #endif | |
142 | ||
143 | #ifndef _NLINK_T | |
144 | typedef __uint16_t nlink_t; /* link count */ | |
145 | #define _NLINK_T | |
146 | #endif | |
147 | ||
148 | #ifndef _ID_T | |
149 | #define _ID_T | |
150 | typedef __darwin_id_t id_t; /* can hold pid_t, gid_t, or uid_t */ | |
151 | #endif | |
152 | ||
153 | #ifndef _PID_T | |
154 | typedef __darwin_pid_t pid_t; | |
155 | #define _PID_T | |
156 | #endif | |
157 | ||
158 | #ifndef _OFF_T | |
159 | typedef __darwin_off_t off_t; | |
160 | #define _OFF_T | |
161 | #endif | |
162 | ||
163 | typedef int32_t segsz_t; /* segment size */ | |
164 | typedef int32_t swblk_t; /* swap offset */ | |
165 | ||
166 | #ifndef _UID_T | |
167 | typedef __darwin_uid_t uid_t; /* user id */ | |
168 | #define _UID_T | |
169 | #endif | |
170 | ||
171 | #ifndef _ID_T | |
172 | typedef __darwin_id_t id_t; | |
173 | #define _ID_T | |
174 | #endif | |
175 | ||
176 | #ifndef _POSIX_C_SOURCE | |
177 | /* Major, minor numbers, dev_t's. */ | |
178 | #define major(x) ((int32_t)(((u_int32_t)(x) >> 24) & 0xff)) | |
179 | #define minor(x) ((int32_t)((x) & 0xffffff)) | |
180 | #define makedev(x,y) ((dev_t)(((x) << 24) | (y))) | |
181 | #endif | |
182 | ||
183 | #ifndef _CLOCK_T | |
184 | #define _CLOCK_T | |
185 | typedef __darwin_clock_t clock_t; | |
186 | #endif | |
187 | ||
188 | #ifndef _SIZE_T | |
189 | #define _SIZE_T | |
190 | /* DO NOT REMOVE THIS COMMENT: fixincludes needs to see | |
191 | * _GCC_SIZE_T */ | |
192 | typedef __darwin_size_t size_t; | |
193 | #endif | |
194 | ||
195 | #ifndef _SSIZE_T | |
196 | #define _SSIZE_T | |
197 | typedef __darwin_ssize_t ssize_t; | |
198 | #endif | |
199 | ||
200 | #ifndef _TIME_T | |
201 | #define _TIME_T | |
202 | typedef __darwin_time_t time_t; | |
203 | #endif | |
204 | ||
205 | #ifndef _USECONDS_T | |
206 | #define _USECONDS_T | |
207 | typedef __darwin_useconds_t useconds_t; | |
208 | #endif | |
209 | ||
210 | #ifndef _SUSECONDS_T | |
211 | #define _SUSECONDS_T | |
212 | typedef __darwin_suseconds_t suseconds_t; | |
213 | #endif | |
214 | ||
215 | #ifndef _POSIX_C_SOURCE | |
216 | /* | |
217 | * This code is present here in order to maintain historical backward | |
218 | * compatability, and is intended to be removed at some point in the | |
219 | * future; please include <sys/select.h> instead. | |
220 | */ | |
221 | #define NBBY 8 /* bits in a byte */ | |
222 | #define NFDBITS (sizeof(__int32_t) * NBBY) /* bits per mask */ | |
223 | #define howmany(x, y) (((x) + ((y) - 1)) / (y)) /* # y's == x bits? */ | |
224 | typedef __int32_t fd_mask; | |
225 | ||
226 | ||
227 | /* | |
228 | * Note: We use _FD_SET to protect all select related | |
229 | * types and macros | |
230 | */ | |
231 | #ifndef _FD_SET | |
232 | #define _FD_SET | |
233 | ||
234 | /* | |
235 | * Select uses bit masks of file descriptors in longs. These macros | |
236 | * manipulate such bit fields (the filesystem macros use chars). The | |
237 | * extra protection here is to permit application redefinition above | |
238 | * the default size. | |
239 | */ | |
240 | #ifndef FD_SETSIZE | |
241 | #define FD_SETSIZE 1024 | |
242 | #endif | |
243 | ||
244 | #define __DARWIN_NBBY 8 /* bits in a byte */ | |
245 | #define __DARWIN_NFDBITS (sizeof(__int32_t) * __DARWIN_NBBY) /* bits per mask */ | |
246 | #define __DARWIN_howmany(x, y) (((x) + ((y) - 1)) / (y)) /* # y's == x bits? */ | |
247 | ||
248 | __BEGIN_DECLS | |
249 | typedef struct fd_set { | |
250 | __int32_t fds_bits[__DARWIN_howmany(FD_SETSIZE, __DARWIN_NFDBITS)]; | |
251 | } fd_set; | |
252 | __END_DECLS | |
253 | ||
254 | #define FD_SET(n, p) ((p)->fds_bits[(n)/__DARWIN_NFDBITS] |= (1<<((n) % __DARWIN_NFDBITS))) | |
255 | #define FD_CLR(n, p) ((p)->fds_bits[(n)/__DARWIN_NFDBITS] &= ~(1<<((n) % __DARWIN_NFDBITS))) | |
256 | #define FD_ISSET(n, p) ((p)->fds_bits[(n)/__DARWIN_NFDBITS] & (1<<((n) % __DARWIN_NFDBITS))) | |
257 | #if __GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ >= 3 | |
258 | /* | |
259 | * Use the built-in bzero function instead of the library version so that | |
260 | * we do not pollute the namespace or introduce prototype warnings. | |
261 | */ | |
262 | #define FD_ZERO(p) __builtin_bzero(p, sizeof(*(p))) | |
263 | #else | |
264 | #define FD_ZERO(p) bzero(p, sizeof(*(p))) | |
265 | #endif | |
266 | #ifndef _POSIX_C_SOURCE | |
267 | #define FD_COPY(f, t) bcopy(f, t, sizeof(*(f))) | |
268 | #endif /* !_POSIX_C_SOURCE */ | |
269 | ||
270 | #endif /* !_FD_SET */ | |
271 | ||
272 | ||
273 | #if defined(__STDC__) && defined(KERNEL) | |
274 | /* | |
275 | * Forward structure declarations for function prototypes. We include the | |
276 | * common structures that cross subsystem boundaries here; others are mostly | |
277 | * used in the same place that the structure is defined. | |
278 | */ | |
279 | struct proc; | |
280 | struct pgrp; | |
281 | struct ucred; | |
282 | struct rusage; | |
283 | struct file; | |
284 | struct buf; | |
285 | struct tty; | |
286 | struct uio; | |
287 | #endif | |
288 | ||
289 | #endif /* !_POSIX_C_SOURCE */ | |
290 | #endif /* __ASSEMBLER__ */ | |
291 | ||
292 | #ifndef __POSIX_LIB__ | |
293 | ||
294 | #ifndef _PTHREAD_ATTR_T | |
295 | #define _PTHREAD_ATTR_T | |
296 | typedef __darwin_pthread_attr_t pthread_attr_t; | |
297 | #endif | |
298 | #ifndef _PTHREAD_COND_T | |
299 | #define _PTHREAD_COND_T | |
300 | typedef __darwin_pthread_cond_t pthread_cond_t; | |
301 | #endif | |
302 | #ifndef _PTHREAD_CONDATTR_T | |
303 | #define _PTHREAD_CONDATTR_T | |
304 | typedef __darwin_pthread_condattr_t pthread_condattr_t; | |
305 | #endif | |
306 | #ifndef _PTHREAD_MUTEX_T | |
307 | #define _PTHREAD_MUTEX_T | |
308 | typedef __darwin_pthread_mutex_t pthread_mutex_t; | |
309 | #endif | |
310 | #ifndef _PTHREAD_MUTEXATTR_T | |
311 | #define _PTHREAD_MUTEXATTR_T | |
312 | typedef __darwin_pthread_mutexattr_t pthread_mutexattr_t; | |
313 | #endif | |
314 | #ifndef _PTHREAD_ONCE_T | |
315 | #define _PTHREAD_ONCE_T | |
316 | typedef __darwin_pthread_once_t pthread_once_t; | |
317 | #endif | |
318 | #ifndef _PTHREAD_RWLOCK_T | |
319 | #define _PTHREAD_RWLOCK_T | |
320 | typedef __darwin_pthread_rwlock_t pthread_rwlock_t; | |
321 | #endif | |
322 | #ifndef _PTHREAD_RWLOCKATTR_T | |
323 | #define _PTHREAD_RWLOCKATTR_T | |
324 | typedef __darwin_pthread_rwlockattr_t pthread_rwlockattr_t; | |
325 | #endif | |
326 | #ifndef _PTHREAD_T | |
327 | #define _PTHREAD_T | |
328 | typedef __darwin_pthread_t pthread_t; | |
329 | #endif | |
330 | ||
331 | #endif /* __POSIX_LIB__ */ | |
332 | ||
333 | #ifndef _PTHREAD_KEY_T | |
334 | #define _PTHREAD_KEY_T | |
335 | typedef __darwin_pthread_key_t pthread_key_t; | |
336 | #endif | |
337 | ||
338 | /* statvfs and fstatvfs */ | |
339 | #ifndef _FSBLKCNT_T | |
340 | #define _FSBLKCNT_T | |
341 | typedef __darwin_fsblkcnt_t fsblkcnt_t; | |
342 | #endif | |
343 | ||
344 | #ifndef _FSFILCNT_T | |
345 | #define _FSFILCNT_T | |
346 | typedef __darwin_fsfilcnt_t fsfilcnt_t; | |
347 | #endif | |
348 | ||
349 | #endif /* !_SYS_TYPES_H_ */ |