Annotation of sys/sys/types.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: types.h,v 1.30 2006/10/03 19:49:06 pedro Exp $ */
2: /* $NetBSD: types.h,v 1.29 1996/11/15 22:48:25 jtc Exp $ */
3:
4: /*-
5: * Copyright (c) 1982, 1986, 1991, 1993
6: * The Regents of the University of California. All rights reserved.
7: * (c) UNIX System Laboratories, Inc.
8: * All or some portions of this file are derived from material licensed
9: * to the University of California by American Telephone and Telegraph
10: * Co. or Unix System Laboratories, Inc. and are reproduced herein with
11: * the permission of UNIX System Laboratories, Inc.
12: *
13: * Redistribution and use in source and binary forms, with or without
14: * modification, are permitted provided that the following conditions
15: * are met:
16: * 1. Redistributions of source code must retain the above copyright
17: * notice, this list of conditions and the following disclaimer.
18: * 2. Redistributions in binary form must reproduce the above copyright
19: * notice, this list of conditions and the following disclaimer in the
20: * documentation and/or other materials provided with the distribution.
21: * 3. Neither the name of the University nor the names of its contributors
22: * may be used to endorse or promote products derived from this software
23: * without specific prior written permission.
24: *
25: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35: * SUCH DAMAGE.
36: *
37: * @(#)types.h 8.4 (Berkeley) 1/21/94
38: */
39:
40: #ifndef _SYS_TYPES_H_
41: #define _SYS_TYPES_H_
42:
43: #include <sys/cdefs.h>
44: #include <sys/_types.h>
45: #include <machine/endian.h>
46:
47: #if __BSD_VISIBLE
48: typedef unsigned char u_char;
49: typedef unsigned short u_short;
50: typedef unsigned int u_int;
51: typedef unsigned long u_long;
52:
53: typedef unsigned char unchar; /* Sys V compatibility */
54: typedef unsigned short ushort; /* Sys V compatibility */
55: typedef unsigned int uint; /* Sys V compatibility */
56: typedef unsigned long ulong; /* Sys V compatibility */
57:
58: typedef __cpuid_t cpuid_t; /* CPU id */
59: typedef __register_t register_t; /* register-sized type */
60: #endif /* __BSD_VISIBLE */
61:
62: /*
63: * XXX The exact-width bit types should only be exposed if __BSD_VISIBLE
64: * but the rest of the includes are not ready for that yet.
65: */
66: #ifndef __BIT_TYPES_DEFINED__
67: #define __BIT_TYPES_DEFINED__
68: #endif
69:
70: #ifndef _INT8_T_DEFINED_
71: #define _INT8_T_DEFINED_
72: typedef __int8_t int8_t;
73: #endif
74:
75: #ifndef _UINT8_T_DEFINED_
76: #define _UINT8_T_DEFINED_
77: typedef __uint8_t uint8_t;
78: #endif
79:
80: #ifndef _INT16_T_DEFINED_
81: #define _INT16_T_DEFINED_
82: typedef __int16_t int16_t;
83: #endif
84:
85: #ifndef _UINT16_T_DEFINED_
86: #define _UINT16_T_DEFINED_
87: typedef __uint16_t uint16_t;
88: #endif
89:
90: #ifndef _INT32_T_DEFINED_
91: #define _INT32_T_DEFINED_
92: typedef __int32_t int32_t;
93: #endif
94:
95: #ifndef _UINT32_T_DEFINED_
96: #define _UINT32_T_DEFINED_
97: typedef __uint32_t uint32_t;
98: #endif
99:
100: #ifndef _INT64_T_DEFINED_
101: #define _INT64_T_DEFINED_
102: typedef __int64_t int64_t;
103: #endif
104:
105: #ifndef _UINT64_T_DEFINED_
106: #define _UINT64_T_DEFINED_
107: typedef __uint64_t uint64_t;
108: #endif
109:
110: /* BSD-style unsigned bits types */
111: typedef __uint8_t u_int8_t;
112: typedef __uint16_t u_int16_t;
113: typedef __uint32_t u_int32_t;
114: typedef __uint64_t u_int64_t;
115:
116: /* quads, deprecated in favor of 64 bit int types */
117: typedef __int64_t quad_t;
118: typedef __uint64_t u_quad_t;
119: typedef quad_t * qaddr_t;
120:
121: #if __BSD_VISIBLE
122: /* VM system types */
123: typedef __vaddr_t vaddr_t;
124: typedef __paddr_t paddr_t;
125: typedef __vsize_t vsize_t;
126: typedef __psize_t psize_t;
127: #endif /* __BSD_VISIBLE */
128:
129: /* Standard system types */
130: typedef char * caddr_t; /* core address */
131: typedef __int32_t daddr_t; /* 32-bit disk address */
132: typedef __int32_t daddr32_t; /* 32-bit disk address */
133: typedef __int64_t daddr64_t; /* 64-bit disk address */
134: typedef __dev_t dev_t; /* device number */
135: typedef __fixpt_t fixpt_t; /* fixed point number */
136: typedef __gid_t gid_t; /* group id */
137: typedef __id_t id_t; /* may contain pid, uid or gid */
138: typedef __ino_t ino_t; /* inode number */
139: typedef __key_t key_t; /* IPC key (for Sys V IPC) */
140: typedef __mode_t mode_t; /* permissions */
141: typedef __nlink_t nlink_t; /* link count */
142: typedef __pid_t pid_t; /* process id */
143: typedef __rlim_t rlim_t; /* resource limit */
144: typedef __segsz_t segsz_t; /* segment size */
145: typedef __swblk_t swblk_t; /* swap offset */
146: typedef __uid_t uid_t; /* user id */
147: typedef __useconds_t useconds_t; /* microseconds */
148: typedef __suseconds_t suseconds_t; /* microseconds (signed) */
149:
150: /*
151: * XPG4.2 states that inclusion of <netinet/in.h> must pull these
152: * in and that inclusion of <sys/socket.h> must pull in sa_family_t.
153: * We put these here because there are other headers that require
154: * these types and <sys/socket.h> and <netinet/in.h> will indirectly
155: * include <sys/types.h>.
156: * XXX - now that we have protected versions these should move.
157: */
158: typedef __in_addr_t in_addr_t; /* base type for internet address */
159: typedef __in_port_t in_port_t; /* IP port type */
160: typedef __sa_family_t sa_family_t; /* sockaddr address family type */
161: typedef __socklen_t socklen_t; /* length type for network syscalls */
162:
163: /*
164: * The following types may be defined in multiple header files.
165: */
166: #ifndef _CLOCK_T_DEFINED_
167: #define _CLOCK_T_DEFINED_
168: typedef __clock_t clock_t;
169: #endif
170:
171: #ifndef _CLOCKID_T_DEFINED_
172: #define _CLOCKID_T_DEFINED_
173: typedef __clockid_t clockid_t;
174: #endif
175:
176: #ifndef _SIZE_T_DEFINED_
177: #define _SIZE_T_DEFINED_
178: typedef __size_t size_t;
179: #endif
180:
181: #ifndef _SSIZE_T_DEFINED_
182: #define _SSIZE_T_DEFINED_
183: typedef __ssize_t ssize_t;
184: #endif
185:
186: #ifndef _TIME_T_DEFINED_
187: #define _TIME_T_DEFINED_
188: typedef __time_t time_t;
189: #endif
190:
191: #ifndef _TIMER_T_DEFINED_
192: #define _TIMER_T_DEFINED_
193: typedef __timer_t timer_t;
194: #endif
195:
196: #ifndef _OFF_T_DEFINED_
197: #define _OFF_T_DEFINED_
198: typedef __off_t off_t;
199: #endif
200:
201: /*
202: * These belong in unistd.h, but are placed here too to ensure that
203: * long arguments will be promoted to off_t if the program fails to
204: * include that header or explicitly cast them to off_t.
205: */
206: #if __BSD_VISIBLE && !defined(_KERNEL)
207: __BEGIN_DECLS
208: off_t lseek(int, off_t, int);
209: int ftruncate(int, off_t);
210: int truncate(const char *, off_t);
211: __END_DECLS
212: #endif /* __BSD_VISIBLE && !_KERNEL */
213:
214: #if __BSD_VISIBLE
215: /* Major, minor numbers, dev_t's. */
216: #define major(x) ((int32_t)(((u_int32_t)(x) >> 8) & 0xff))
217: #define minor(x) ((int32_t)((x) & 0xff) | (((x) & 0xffff0000) >> 8))
218: #define makedev(x,y) ((dev_t)((((x) & 0xff) << 8) | ((y) & 0xff) | (((y) & 0xffff00) << 8)))
219: #endif
220:
221: #if __BSD_VISIBLE
222: #include <sys/select.h> /* must be after type declarations */
223: #endif
224:
225: #if defined(__STDC__) && defined(_KERNEL)
226: /*
227: * Forward structure declarations for function prototypes. We include the
228: * common structures that cross subsystem boundaries here; others are mostly
229: * used in the same place that the structure is defined.
230: */
231: struct proc;
232: struct pgrp;
233: struct ucred;
234: struct rusage;
235: struct file;
236: struct buf;
237: struct tty;
238: struct uio;
239: #endif
240:
241: #endif /* !_SYS_TYPES_H_ */
CVSweb