1 .\" Copyright (c) 1980, 1991, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" @(#)types.5 8.1 (Berkeley) 6/5/93
33 .\" $FreeBSD: src/share/man/man5/types.5,v 1.10.2.2 2001/12/17 11:30:15 ru Exp $
34 .\" $DragonFly: src/share/man/man5/Attic/types.5,v 1.4 2003/11/09 02:34:03 dillon Exp $
47 contains the defined data types used in the kernel (most are
48 used through out the system).
53 #include <sys/cdefs.h>
55 /* Machine type dependent parameters. */
56 #include <sys/inttypes.h>
57 #include <machine/stdint.h>
58 #include <machine/types.h>
61 typedef unsigned char u_char;
62 typedef unsigned short u_short;
63 typedef unsigned int u_int;
64 typedef unsigned long u_long;
65 typedef unsigned short ushort; /* Sys V compatibility */
66 typedef unsigned int uint; /* Sys V compatibility */
69 typedef __uint8_t u_int8_t;
70 typedef __uint16_t u_int16_t;
71 typedef __uint32_t u_int32_t;
72 typedef __uint64_t u_int64_t;
74 typedef u_int64_t u_quad_t; /* quads */
75 typedef int64_t quad_t;
76 typedef quad_t * qaddr_t;
78 typedef char * caddr_t; /* core address */
79 typedef const char * c_caddr_t; /* core address, pointer to const */
80 typedef volatile char *v_caddr_t; /* core address, pointer to volatile */
81 typedef int32_t daddr_t; /* disk address */
82 typedef u_int32_t u_daddr_t; /* unsigned disk address */
83 typedef u_int32_t fixpt_t; /* fixed point number */
84 typedef u_int32_t gid_t; /* group id */
85 typedef u_int32_t ino_t; /* inode number */
86 typedef long key_t; /* IPC key (for Sys V IPC) */
87 typedef u_int16_t mode_t; /* permissions */
88 typedef u_int16_t nlink_t; /* link count */
89 typedef _BSD_OFF_T_ off_t; /* file offset */
90 typedef _BSD_PID_T_ pid_t; /* process id */
91 typedef quad_t rlim_t; /* resource limit */
92 #ifdef __alpha__ /* XXX should be in <machine/types.h> */
93 typedef int64_t segsz_t; /* segment size */
95 typedef int32_t segsz_t; /* segment size */
97 typedef int32_t swblk_t; /* swap offset */
98 typedef int32_t ufs_daddr_t;
99 typedef u_int32_t uid_t; /* user id */
102 typedef int boolean_t;
103 typedef u_int64_t uoff_t;
104 typedef struct vm_page *vm_page_t;
111 typedef u_int32_t udev_t; /* device number */
112 typedef struct specinfo *dev_t;
116 typedef u_int32_t dev_t; /* device number */
119 #ifndef _POSIX_SOURCE
122 * minor() gives a cookie instead of an index since we don't want to
123 * change the meanings of bits 0-15 or waste time and space shifting
124 * bits 16-31 for devices that don't use them.
126 #define major(x) ((int)(((u_int)(x) >> 8)&0xff)) /* major number */
127 #define minor(x) ((int)((x)&0xffff00ff)) /* minor number */
128 #define makedev(x,y) ((dev_t)(((x) << 8) | (y))) /* create dev_t */
130 #endif /* _POSIX_SOURCE */
132 #endif /* !_KERNEL */
134 #include <machine/endian.h>
137 typedef _BSD_CLOCK_T_ clock_t;
141 #ifdef _BSD_CLOCKID_T_
142 typedef _BSD_CLOCKID_T_ clockid_t;
143 #undef _BSD_CLOCKID_T_
147 typedef _BSD_SIZE_T_ size_t;
152 typedef _BSD_SSIZE_T_ ssize_t;
157 typedef _BSD_TIME_T_ time_t;
162 typedef _BSD_TIMER_T_ timer_t;
166 #ifndef _POSIX_SOURCE
167 #define NBBY 8 /* number of bits in a byte */
170 * Select uses bit masks of file descriptors in longs. These macros
171 * manipulate such bit fields (the filesystem macros use chars).
172 * FD_SETSIZE may be defined by the user, but the default here should
173 * be enough for most uses.
176 #define FD_SETSIZE 1024
179 typedef long fd_mask;
180 #define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */
183 #define howmany(x, y) (((x) + ((y) - 1)) / (y))
186 typedef struct fd_set {
187 fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
190 #define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
191 #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
192 #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
193 #define FD_COPY(f, t) bcopy(f, t, sizeof(*(f)))
194 #define FD_ZERO(p) bzero(p, sizeof(*(p)))
197 * These declarations belong elsewhere, but are repeated here and in
198 * <stdio.h> to give broken programs a better chance of working with
203 #ifndef _FTRUNCATE_DECLARED
204 #define _FTRUNCATE_DECLARED
205 int ftruncate __P((int, off_t));
207 #ifndef _LSEEK_DECLARED
208 #define _LSEEK_DECLARED
209 off_t lseek __P((int, off_t, int));
211 #ifndef _MMAP_DECLARED
212 #define _MMAP_DECLARED
213 void * mmap __P((void *, size_t, int, int, int, off_t));
215 #ifndef _TRUNCATE_DECLARED
216 #define _TRUNCATE_DECLARED
217 int truncate __P((const char *, off_t));
220 #endif /* !_KERNEL */
222 #endif /* !_POSIX_SOURCE */
224 #endif /* !_SYS_TYPES_H_ */