2 * Copyright (c) 2000-2004 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@
22 /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
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.
32 * Redistribution and use in source and binary forms, with or without
33 * modification, are permitted provided that the following conditions
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.
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
60 * @(#)types.h 8.4 (Berkeley) 1/21/94
66 #include <sys/appleapiopts.h>
69 #include <sys/cdefs.h>
71 /* Machine type dependent parameters. */
72 #include <machine/types.h>
73 #include <sys/_types.h>
75 #include <machine/endian.h>
77 #ifndef _POSIX_C_SOURCE
78 typedef unsigned char u_char
;
79 typedef unsigned short u_short
;
80 typedef unsigned int u_int
;
82 typedef unsigned long u_long
;
85 typedef unsigned short ushort
; /* Sys V compatibility */
86 typedef unsigned int uint
; /* Sys V compatibility */
89 typedef u_int64_t u_quad_t
; /* quads */
90 typedef int64_t quad_t
;
91 typedef quad_t
* qaddr_t
;
93 typedef char * caddr_t
; /* core address */
94 typedef int32_t daddr_t
; /* disk address */
97 typedef __darwin_dev_t dev_t
; /* device number */
101 typedef u_int32_t fixpt_t
; /* fixed point number */
104 typedef __darwin_blkcnt_t blkcnt_t
;
109 typedef __darwin_blksize_t blksize_t
;
114 typedef __darwin_gid_t gid_t
;
120 typedef __uint32_t in_addr_t
; /* base type for internet address */
125 typedef __uint16_t in_port_t
;
129 typedef __darwin_ino_t ino_t
; /* inode number */
135 typedef __int32_t key_t
; /* IPC key (for Sys V IPC) */
139 typedef __darwin_mode_t mode_t
;
144 typedef __uint16_t nlink_t
; /* link count */
150 typedef __darwin_id_t id_t
; /* can hold pid_t, gid_t, or uid_t */
154 typedef __darwin_pid_t pid_t
;
159 typedef __darwin_off_t off_t
;
163 typedef int32_t segsz_t
; /* segment size */
164 typedef int32_t swblk_t
; /* swap offset */
167 typedef __darwin_uid_t uid_t
; /* user id */
172 typedef __darwin_id_t id_t
;
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)))
185 typedef __darwin_clock_t
clock_t;
190 /* DO NOT REMOVE THIS COMMENT: fixincludes needs to see
192 typedef __darwin_size_t
size_t;
197 typedef __darwin_ssize_t ssize_t
;
202 typedef __darwin_time_t
time_t;
207 typedef __darwin_useconds_t useconds_t
;
212 typedef __darwin_suseconds_t suseconds_t
;
215 #ifndef _POSIX_C_SOURCE
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.
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
;
228 * Note: We use _FD_SET to protect all select related
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
241 #define FD_SETSIZE 1024
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? */
249 typedef struct fd_set
{
250 __int32_t fds_bits
[__DARWIN_howmany(FD_SETSIZE
, __DARWIN_NFDBITS
)];
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
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.
262 #define FD_ZERO(p) __builtin_bzero(p, sizeof(*(p)))
264 #define FD_ZERO(p) bzero(p, sizeof(*(p)))
266 #ifndef _POSIX_C_SOURCE
267 #define FD_COPY(f, t) bcopy(f, t, sizeof(*(f)))
268 #endif /* !_POSIX_C_SOURCE */
270 #endif /* !_FD_SET */
273 #if defined(__STDC__) && defined(KERNEL)
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.
289 #endif /* !_POSIX_C_SOURCE */
290 #endif /* __ASSEMBLER__ */
292 #ifndef __POSIX_LIB__
294 #ifndef _PTHREAD_ATTR_T
295 #define _PTHREAD_ATTR_T
296 typedef __darwin_pthread_attr_t pthread_attr_t
;
298 #ifndef _PTHREAD_COND_T
299 #define _PTHREAD_COND_T
300 typedef __darwin_pthread_cond_t pthread_cond_t
;
302 #ifndef _PTHREAD_CONDATTR_T
303 #define _PTHREAD_CONDATTR_T
304 typedef __darwin_pthread_condattr_t pthread_condattr_t
;
306 #ifndef _PTHREAD_MUTEX_T
307 #define _PTHREAD_MUTEX_T
308 typedef __darwin_pthread_mutex_t pthread_mutex_t
;
310 #ifndef _PTHREAD_MUTEXATTR_T
311 #define _PTHREAD_MUTEXATTR_T
312 typedef __darwin_pthread_mutexattr_t pthread_mutexattr_t
;
314 #ifndef _PTHREAD_ONCE_T
315 #define _PTHREAD_ONCE_T
316 typedef __darwin_pthread_once_t pthread_once_t
;
318 #ifndef _PTHREAD_RWLOCK_T
319 #define _PTHREAD_RWLOCK_T
320 typedef __darwin_pthread_rwlock_t pthread_rwlock_t
;
322 #ifndef _PTHREAD_RWLOCKATTR_T
323 #define _PTHREAD_RWLOCKATTR_T
324 typedef __darwin_pthread_rwlockattr_t pthread_rwlockattr_t
;
328 typedef __darwin_pthread_t pthread_t
;
331 #endif /* __POSIX_LIB__ */
333 #ifndef _PTHREAD_KEY_T
334 #define _PTHREAD_KEY_T
335 typedef __darwin_pthread_key_t pthread_key_t
;
338 /* statvfs and fstatvfs */
341 typedef __darwin_fsblkcnt_t fsblkcnt_t
;
346 typedef __darwin_fsfilcnt_t fsfilcnt_t
;
349 #endif /* !_SYS_TYPES_H_ */