]> git.saurik.com Git - apple/xnu.git/blame - bsd/sys/types.h
xnu-4903.270.47.tar.gz
[apple/xnu.git] / bsd / sys / types.h
CommitLineData
1c79356b 1/*
b0d623f7 2 * Copyright (c) 2000-2008 Apple Inc. All rights reserved.
5d5c5d0d 3 *
2d21ac55 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
0a7de745 5 *
2d21ac55
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. 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.
0a7de745 14 *
2d21ac55
A
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
0a7de745 17 *
2d21ac55
A
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
8f6c56a5
A
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2d21ac55
A
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.
0a7de745 25 *
2d21ac55 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
1c79356b
A
27 */
28/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
b0d623f7 29/*
1c79356b
A
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_
0a7de745 70#define _SYS_TYPES_H_
1c79356b 71
9bccf70c
A
72#include <sys/appleapiopts.h>
73
1c79356b
A
74#ifndef __ASSEMBLER__
75#include <sys/cdefs.h>
76
77/* Machine type dependent parameters. */
78#include <machine/types.h>
91447636 79#include <sys/_types.h>
1c79356b 80
1c79356b
A
81#include <machine/endian.h>
82
2d21ac55 83#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
5ba3f43e
A
84#include <sys/_types/_u_char.h>
85#include <sys/_types/_u_short.h>
86#include <sys/_types/_u_int.h>
91447636 87#ifndef _U_LONG
0a7de745 88typedef unsigned long u_long;
91447636
A
89#define _U_LONG
90#endif
0a7de745
A
91typedef unsigned short ushort; /* Sys V compatibility */
92typedef unsigned int uint; /* Sys V compatibility */
91447636
A
93#endif
94
0a7de745
A
95typedef u_int64_t u_quad_t; /* quads */
96typedef int64_t quad_t;
97typedef quad_t * qaddr_t;
91447636 98
0a7de745 99#include <sys/_types/_caddr_t.h> /* core address */
5ba3f43e 100
0a7de745 101typedef int32_t daddr_t; /* disk address */
91447636 102
0a7de745 103#include <sys/_types/_dev_t.h> /* device number */
91447636 104
0a7de745 105typedef u_int32_t fixpt_t; /* fixed point number */
91447636 106
39236c6e
A
107#include <sys/_types/_blkcnt_t.h>
108#include <sys/_types/_blksize_t.h>
109#include <sys/_types/_gid_t.h>
110#include <sys/_types/_in_addr_t.h>
111#include <sys/_types/_in_port_t.h>
112#include <sys/_types/_ino_t.h>
91447636 113
2d21ac55 114#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
0a7de745 115#include <sys/_types/_ino64_t.h> /* 64bit inode number */
2d21ac55
A
116#endif /* !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) */
117
39236c6e
A
118#include <sys/_types/_key_t.h>
119#include <sys/_types/_mode_t.h>
120#include <sys/_types/_nlink_t.h>
121#include <sys/_types/_id_t.h>
122#include <sys/_types/_pid_t.h>
123#include <sys/_types/_off_t.h>
91447636 124
0a7de745
A
125typedef int32_t segsz_t; /* segment size */
126typedef int32_t swblk_t; /* swap offset */
91447636 127
39236c6e 128#include <sys/_types/_uid_t.h>
91447636 129
2d21ac55 130#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
1c79356b 131/* Major, minor numbers, dev_t's. */
2d21ac55
A
132#if defined(__cplusplus)
133/*
134 * These lowercase macros tend to match member functions in some C++ code,
135 * so for C++, we must use inline functions instead.
136 */
137
0a7de745
A
138static inline __int32_t
139major(__uint32_t _x)
2d21ac55
A
140{
141 return (__int32_t)(((__uint32_t)_x >> 24) & 0xff);
142}
143
0a7de745
A
144static inline __int32_t
145minor(__uint32_t _x)
2d21ac55
A
146{
147 return (__int32_t)((_x) & 0xffffff);
148}
149
0a7de745
A
150static inline dev_t
151makedev(__uint32_t _major, __uint32_t _minor)
2d21ac55
A
152{
153 return (dev_t)(((_major) << 24) | (_minor));
154}
155
0a7de745 156#else /* !__cplusplus */
2d21ac55 157
0a7de745
A
158#define major(x) ((int32_t)(((u_int32_t)(x) >> 24) & 0xff))
159#define minor(x) ((int32_t)((x) & 0xffffff))
160#define makedev(x, y) ((dev_t)(((x) << 24) | (y)))
2d21ac55 161
0a7de745
A
162#endif /* !__cplusplus */
163#endif /* !_POSIX_C_SOURCE */
1c79356b 164
39236c6e
A
165#include <sys/_types/_clock_t.h>
166#include <sys/_types/_size_t.h>
167#include <sys/_types/_ssize_t.h>
168#include <sys/_types/_time_t.h>
1c79356b 169
39236c6e
A
170#include <sys/_types/_useconds_t.h>
171#include <sys/_types/_suseconds_t.h>
1c79356b 172
39236c6e
A
173#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
174#include <sys/_types/_rsize_t.h>
175#include <sys/_types/_errno_t.h>
91447636
A
176#endif
177
2d21ac55 178#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
91447636
A
179/*
180 * This code is present here in order to maintain historical backward
181 * compatability, and is intended to be removed at some point in the
182 * future; please include <sys/select.h> instead.
183 */
39236c6e 184#include <sys/_types/_fd_def.h>
91447636 185
0a7de745
A
186#define NBBY __DARWIN_NBBY /* bits in a byte */
187#define NFDBITS __DARWIN_NFDBITS /* bits per mask */
188#define howmany(x, y) __DARWIN_howmany(x, y) /* # y's == x bits? */
189typedef __int32_t fd_mask;
1c79356b
A
190
191/*
192 * Select uses bit masks of file descriptors in longs. These macros
91447636
A
193 * manipulate such bit fields (the filesystem macros use chars). The
194 * extra protection here is to permit application redefinition above
195 * the default size.
1c79356b 196 */
39236c6e
A
197#include <sys/_types/_fd_setsize.h>
198#include <sys/_types/_fd_set.h>
199#include <sys/_types/_fd_clr.h>
200#include <sys/_types/_fd_zero.h>
201#include <sys/_types/_fd_isset.h>
202
2d21ac55 203#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
39236c6e 204#include <sys/_types/_fd_copy.h>
0a7de745 205#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
91447636 206
1c79356b
A
207
208#if defined(__STDC__) && defined(KERNEL)
209/*
210 * Forward structure declarations for function prototypes. We include the
211 * common structures that cross subsystem boundaries here; others are mostly
212 * used in the same place that the structure is defined.
213 */
0a7de745
A
214struct proc;
215struct pgrp;
216struct ucred;
217struct rusage;
218struct file;
219struct buf;
220struct tty;
221struct uio;
1c79356b
A
222#endif
223
2d21ac55 224#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
1c79356b
A
225#endif /* __ASSEMBLER__ */
226
fe8ab488
A
227#ifndef KERNEL
228
1c79356b
A
229#ifndef __POSIX_LIB__
230
fe8ab488
A
231#include <sys/_pthread/_pthread_attr_t.h>
232#include <sys/_pthread/_pthread_cond_t.h>
233#include <sys/_pthread/_pthread_condattr_t.h>
234#include <sys/_pthread/_pthread_mutex_t.h>
235#include <sys/_pthread/_pthread_mutexattr_t.h>
236#include <sys/_pthread/_pthread_once_t.h>
237#include <sys/_pthread/_pthread_rwlock_t.h>
238#include <sys/_pthread/_pthread_rwlockattr_t.h>
239#include <sys/_pthread/_pthread_t.h>
9bccf70c 240
91447636 241#endif /* __POSIX_LIB__ */
9bccf70c 242
fe8ab488
A
243#include <sys/_pthread/_pthread_key_t.h>
244
245#endif /* KERNEL */
1c79356b 246
91447636 247/* statvfs and fstatvfs */
1c79356b 248
39236c6e
A
249#include <sys/_types/_fsblkcnt_t.h>
250#include <sys/_types/_fsfilcnt_t.h>
b0d623f7 251
1c79356b 252#endif /* !_SYS_TYPES_H_ */