1 | /*␊ |
2 | * Copyright (c) 2000-2008 Apple Inc. All rights reserved.␊ |
3 | *␊ |
4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@␊ |
5 | * ␊ |
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␊ |
24 | * limitations under the License.␊ |
25 | * ␊ |
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@␊ |
27 | */␊ |
28 | /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */␊ |
29 | /*␊ |
30 | * Copyright (c) 1982, 1986, 1991, 1993, 1994␊ |
31 | *␉The Regents of the University of California. All rights reserved.␊ |
32 | * (c) UNIX System Laboratories, Inc.␊ |
33 | * All or some portions of this file are derived from material licensed␊ |
34 | * to the University of California by American Telephone and Telegraph␊ |
35 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with␊ |
36 | * the permission of UNIX System Laboratories, Inc.␊ |
37 | *␊ |
38 | * Redistribution and use in source and binary forms, with or without␊ |
39 | * modification, are permitted provided that the following conditions␊ |
40 | * are met:␊ |
41 | * 1. Redistributions of source code must retain the above copyright␊ |
42 | * notice, this list of conditions and the following disclaimer.␊ |
43 | * 2. Redistributions in binary form must reproduce the above copyright␊ |
44 | * notice, this list of conditions and the following disclaimer in the␊ |
45 | * documentation and/or other materials provided with the distribution.␊ |
46 | * 3. All advertising materials mentioning features or use of this software␊ |
47 | * must display the following acknowledgement:␊ |
48 | *␉This product includes software developed by the University of␊ |
49 | *␉California, Berkeley and its contributors.␊ |
50 | * 4. Neither the name of the University nor the names of its contributors␊ |
51 | * may be used to endorse or promote products derived from this software␊ |
52 | * without specific prior written permission.␊ |
53 | *␊ |
54 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND␊ |
55 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE␊ |
56 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE␊ |
57 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE␊ |
58 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL␊ |
59 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS␊ |
60 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)␊ |
61 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT␊ |
62 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY␊ |
63 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF␊ |
64 | * SUCH DAMAGE.␊ |
65 | *␊ |
66 | *␉@(#)types.h␉8.4 (Berkeley) 1/21/94␊ |
67 | */␊ |
68 | ␊ |
69 | #ifndef _SYS_TYPES_H_␊ |
70 | #define␉_SYS_TYPES_H_␊ |
71 | ␊ |
72 | #ifndef __ASSEMBLER__␊ |
73 | #include <sys/cdefs.h>␊ |
74 | ␊ |
75 | /* Machine type dependent parameters. */␊ |
76 | #include <machine/types.h>␊ |
77 | #include <sys/_types.h>␊ |
78 | #include <machine/endian.h>␊ |
79 | ␊ |
80 | #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)␊ |
81 | typedef␉unsigned char␉␉u_char;␊ |
82 | typedef␉unsigned short␉␉u_short;␊ |
83 | typedef␉unsigned int␉␉u_int;␊ |
84 | #ifndef _U_LONG␊ |
85 | typedef␉unsigned long␉␉u_long;␊ |
86 | #define _U_LONG␊ |
87 | #endif␊ |
88 | typedef␉unsigned short␉␉ushort;␉␉/* Sys V compatibility */␊ |
89 | typedef␉unsigned int␉␉uint;␉␉/* Sys V compatibility */␊ |
90 | #endif␊ |
91 | ␊ |
92 | typedef␉u_int64_t␉␉u_quad_t;␉/* quads */␊ |
93 | typedef␉int64_t␉␉␉quad_t;␊ |
94 | typedef␉quad_t *␉␉qaddr_t;␊ |
95 | ␊ |
96 | typedef␉char *␉␉␉caddr_t;␉/* core address */␊ |
97 | typedef␉int32_t␉␉␉daddr_t;␉/* disk address */␊ |
98 | ␊ |
99 | typedef␉u_int32_t␉␉fixpt_t;␉/* fixed point number */␊ |
100 | ␊ |
101 | ␊ |
102 | #ifndef _IN_ADDR_T␊ |
103 | #define _IN_ADDR_T␊ |
104 | typedef␉__uint32_t␉␉in_addr_t;␉/* base type for internet address */␊ |
105 | #endif␊ |
106 | ␊ |
107 | #ifndef _IN_PORT_T␊ |
108 | #define _IN_PORT_T␊ |
109 | typedef␉__uint16_t␉␉in_port_t;␊ |
110 | #endif␊ |
111 | ␊ |
112 | ␊ |
113 | #ifndef _KEY_T␊ |
114 | #define _KEY_T␊ |
115 | typedef␉__int32_t␉␉key_t;␉␉/* IPC key (for Sys V IPC) */␊ |
116 | #endif␊ |
117 | ␊ |
118 | #ifndef _NLINK_T␊ |
119 | typedef␉__uint16_t␉␉nlink_t;␉/* link count */␊ |
120 | #define␉_NLINK_T␊ |
121 | #endif␊ |
122 | ␊ |
123 | typedef␉int32_t␉␉␉segsz_t;␉/* segment size */␊ |
124 | typedef␉int32_t␉␉␉swblk_t;␉/* swap offset */␊ |
125 | ␊ |
126 | ␊ |
127 | #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)␊ |
128 | /* Major, minor numbers, dev_t's. */␊ |
129 | #if defined(__cplusplus)␊ |
130 | /*␊ |
131 | * These lowercase macros tend to match member functions in some C++ code,␊ |
132 | * so for C++, we must use inline functions instead.␊ |
133 | */␊ |
134 | ␊ |
135 | static inline __int32_t major(__uint32_t _x)␊ |
136 | {␊ |
137 | ␉return (__int32_t)(((__uint32_t)_x >> 24) & 0xff);␊ |
138 | }␊ |
139 | ␊ |
140 | static inline __int32_t minor(__uint32_t _x)␊ |
141 | {␊ |
142 | ␉return (__int32_t)((_x) & 0xffffff);␊ |
143 | }␊ |
144 | #else␉/* !__cplusplus */␊ |
145 | ␊ |
146 | #define␉major(x)␉((int32_t)(((u_int32_t)(x) >> 24) & 0xff))␊ |
147 | #define␉minor(x)␉((int32_t)((x) & 0xffffff))␊ |
148 | ␊ |
149 | #endif␉/* !__cplusplus */␊ |
150 | #endif␉/* !_POSIX_C_SOURCE */␊ |
151 | ␊ |
152 | #ifndef␉_CLOCK_T␊ |
153 | #define␉_CLOCK_T␊ |
154 | typedef␉__darwin_clock_t␉clock_t;␊ |
155 | #endif␊ |
156 | ␊ |
157 | #ifndef _SIZE_T␊ |
158 | #define _SIZE_T␊ |
159 | /* DO NOT REMOVE THIS COMMENT: fixincludes needs to see␊ |
160 | * _GCC_SIZE_T */␊ |
161 | typedef __darwin_size_t␉␉size_t;␊ |
162 | #endif␊ |
163 | ␊ |
164 | #ifndef␉_SSIZE_T␊ |
165 | #define␉_SSIZE_T␊ |
166 | typedef␉__darwin_ssize_t␉ssize_t;␊ |
167 | #endif␊ |
168 | ␊ |
169 | #ifndef␉_TIME_T␊ |
170 | #define␉_TIME_T␊ |
171 | typedef␉__darwin_time_t␉␉time_t;␊ |
172 | #endif␊ |
173 | ␊ |
174 | ␊ |
175 | #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)␊ |
176 | /*␊ |
177 | * This code is present here in order to maintain historical backward␊ |
178 | * compatability, and is intended to be removed at some point in the␊ |
179 | * future; please include <sys/select.h> instead.␊ |
180 | */␊ |
181 | #define __need_fd_set␊ |
182 | #include <sys/_structs.h>␊ |
183 | ␊ |
184 | #define␉NBBY␉␉__DARWIN_NBBY␉␉/* bits in a byte */␊ |
185 | #define NFDBITS␉␉__DARWIN_NFDBITS␉/* bits per mask */␊ |
186 | #define␉howmany(x, y)␉__DARWIN_howmany(x, y)␉/* # y's == x bits? */␊ |
187 | typedef __int32_t␉fd_mask;␊ |
188 | ␊ |
189 | /*␊ |
190 | * Select uses bit masks of file descriptors in longs. These macros␊ |
191 | * manipulate such bit fields (the filesystem macros use chars). The␊ |
192 | * extra protection here is to permit application redefinition above␊ |
193 | * the default size.␊ |
194 | */␊ |
195 | #ifndef␉FD_SETSIZE␊ |
196 | #define␉FD_SETSIZE␉__DARWIN_FD_SETSIZE␊ |
197 | #endif /* FD_SETSIZE */␊ |
198 | #ifndef FD_SET␊ |
199 | #define␉FD_SET(n, p)␉__DARWIN_FD_SET(n, p)␊ |
200 | #endif /* FD_SET */␊ |
201 | #ifndef FD_CLR␊ |
202 | #define␉FD_CLR(n, p)␉__DARWIN_FD_CLR(n, p)␊ |
203 | #endif /* FD_CLR */␊ |
204 | #ifndef FD_ISSET␊ |
205 | #define␉FD_ISSET(n, p)␉__DARWIN_FD_ISSET(n, p)␊ |
206 | #endif /* FD_ISSET */␊ |
207 | #ifndef FD_ZERO␊ |
208 | #define␉FD_ZERO(p)␉__DARWIN_FD_ZERO(p)␊ |
209 | #endif /* FD_ZERO */␊ |
210 | #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)␊ |
211 | #ifndef FD_COPY␊ |
212 | #define␉FD_COPY(f, t)␉__DARWIN_FD_COPY(f, t)␊ |
213 | #endif /* FD_COPY */␊ |
214 | #endif␉/* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */␊ |
215 | ␊ |
216 | ␊ |
217 | #if defined(__STDC__) && defined(KERNEL)␊ |
218 | /*␊ |
219 | * Forward structure declarations for function prototypes. We include the␊ |
220 | * common structures that cross subsystem boundaries here; others are mostly␊ |
221 | * used in the same place that the structure is defined.␊ |
222 | */␊ |
223 | struct␉proc;␊ |
224 | struct␉pgrp;␊ |
225 | struct␉ucred;␊ |
226 | struct␉rusage;␊ |
227 | struct␉file;␊ |
228 | struct␉buf;␊ |
229 | struct␉tty;␊ |
230 | struct␉uio;␊ |
231 | #endif␊ |
232 | ␊ |
233 | #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */␊ |
234 | #endif /* __ASSEMBLER__ */␊ |
235 | ␊ |
236 | ␊ |
237 | ␊ |
238 | ␊ |
239 | #endif /* !_SYS_TYPES_H_ */␊ |
240 | |