/* [<][>][^][v][top][bottom][index][help] */
1 /*
2 * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008
3 * The President and Fellows of Harvard College.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of the University nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30 #ifndef _KERN_TYPES_H_
31 #define _KERN_TYPES_H_
32
33 /* Get machine-dependent types. */
34 #include <kern/machine/types.h>
35
36 /*
37 * Machine-independent types visible to user level.
38 *
39 * Define everything with leading underscores to avoid polluting the C
40 * namespace for applications.
41 *
42 * The C standard (and additionally the POSIX standard) define rules
43 * for what families of symbol names are allowed to be used by
44 * application programmers, and what families of symbol names can be
45 * defined by various standard header files. The C library needs to
46 * conform to those rules, to the extent reasonably practical, to make
47 * sure that application code compiles and behaves as intended.
48 *
49 * Many of the C library's headers need to use one or more of these
50 * types in places where the "real" name of the type cannot be
51 * exposed, or expose the names of some of these types and not others.
52 * (For example, <string.h> is supposed to define size_t, but is not
53 * supposed to also define e.g. pid_t.)
54 *
55 * For this reason we define everything with two underscores in front
56 * of it; in C such symbol names are reserved for the implementation,
57 * which we are, so this file can be included anywhere in any libc
58 * header without causing namespace problems. The "real" type names
59 * are defined with an additional layer of typedefs; this happens for
60 * the kernel in <types.h> and for userland in (mostly) <sys/types.h>
61 * and also various other places as per relevant standards.
62 */
63
64 typedef __u32 __blkcnt_t; /* Count of blocks */
65 typedef __u32 __blksize_t; /* Size of an I/O block */
66 typedef __u64 __counter_t; /* Event counter */
67 typedef __u32 __daddr_t; /* Disk block number */
68 typedef __u32 __dev_t; /* Hardware device ID */
69 typedef __u32 __fsid_t; /* Filesystem ID */
70 typedef __i32 __gid_t; /* Group ID */
71 typedef __u32 __in_addr_t; /* Internet address */
72 typedef __u32 __in_port_t; /* Internet port number */
73 typedef __u32 __ino_t; /* Inode number */
74 typedef __u32 __mode_t; /* File access mode */
75 typedef __u16 __nlink_t; /* Number of links (intentionally only 16 bits) */
76 typedef __i64 __off_t; /* Offset within file */
77 typedef __i32 __pid_t; /* Process ID */
78 typedef __u64 __rlim_t; /* Resource limit quantity */
79 typedef __u8 __sa_family_t;/* Socket address family */
80 typedef __i64 __time_t; /* Time in seconds */
81 typedef __i32 __uid_t; /* User ID */
82
83 typedef int __nfds_t; /* Number of file handles */
84 typedef int __socklen_t; /* Socket-related length */
85
86 /* See note in <stdarg.h> */
87 #ifdef __GNUC__
88 typedef __builtin_va_list __va_list;
89 #endif
90
91
92 #endif /* _KERN_TYPES_H_ */