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 $
46 contains the defined data types used in the kernel (most are
47 used through out the system).
52 #include <sys/cdefs.h>
54 /* Machine type dependent parameters. */
55 #include <sys/inttypes.h> /* includes <machine/ansi.h> */
56 #include <machine/types.h>
59 typedef unsigned char u_char;
60 typedef unsigned short u_short;
61 typedef unsigned int u_int;
62 typedef unsigned long u_long;
63 typedef unsigned short ushort; /* Sys V compatibility */
64 typedef unsigned int uint; /* Sys V compatibility */
67 typedef __uint8_t u_int8_t;
68 typedef __uint16_t u_int16_t;
69 typedef __uint32_t u_int32_t;
70 typedef __uint64_t u_int64_t;
72 typedef u_int64_t u_quad_t; /* quads */
73 typedef int64_t quad_t;
74 typedef quad_t * qaddr_t;
76 typedef char * caddr_t; /* core address */
77 typedef __const char * c_caddr_t; /* core address, pointer to const */
78 typedef __volatile char *v_caddr_t; /* core address, pointer to volatile */
79 typedef int32_t daddr_t; /* disk address */
80 typedef u_int32_t u_daddr_t; /* unsigned disk address */
81 typedef u_int32_t fixpt_t; /* fixed point number */
82 typedef u_int32_t gid_t; /* group id */
83 typedef u_int32_t ino_t; /* inode number */
84 typedef long key_t; /* IPC key (for Sys V IPC) */
85 typedef u_int16_t mode_t; /* permissions */
86 typedef u_int16_t nlink_t; /* link count */
87 typedef _BSD_OFF_T_ off_t; /* file offset */
88 typedef _BSD_PID_T_ pid_t; /* process id */
89 typedef quad_t rlim_t; /* resource limit */
90 #ifdef __alpha__ /* XXX should be in <machine/types.h> */
91 typedef int64_t segsz_t; /* segment size */
93 typedef int32_t segsz_t; /* segment size */
95 typedef int32_t swblk_t; /* swap offset */
96 typedef int32_t ufs_daddr_t;
97 typedef u_int32_t uid_t; /* user id */
100 typedef int boolean_t;
101 typedef u_int64_t uoff_t;
102 typedef struct vm_page *vm_page_t;
109 typedef u_int32_t udev_t; /* device number */
110 typedef struct specinfo *dev_t;
114 typedef u_int32_t dev_t; /* device number */
117 #ifndef _POSIX_SOURCE
120 * minor() gives a cookie instead of an index since we don't want to
121 * change the meanings of bits 0-15 or waste time and space shifting
122 * bits 16-31 for devices that don't use them.
124 #define major(x) ((int)(((u_int)(x) >> 8)&0xff)) /* major number */
125 #define minor(x) ((int)((x)&0xffff00ff)) /* minor number */
126 #define makedev(x,y) ((dev_t)(((x) << 8) | (y))) /* create dev_t */
128 #endif /* _POSIX_SOURCE */
130 #endif /* !_KERNEL */
132 #include <machine/endian.h>
135 typedef _BSD_CLOCK_T_ clock_t;
139 #ifdef _BSD_CLOCKID_T_
140 typedef _BSD_CLOCKID_T_ clockid_t;
141 #undef _BSD_CLOCKID_T_
145 typedef _BSD_SIZE_T_ size_t;
150 typedef _BSD_SSIZE_T_ ssize_t;
155 typedef _BSD_TIME_T_ time_t;
160 typedef _BSD_TIMER_T_ timer_t;
164 #ifndef _POSIX_SOURCE
165 #define NBBY 8 /* number of bits in a byte */
168 * Select uses bit masks of file descriptors in longs. These macros
169 * manipulate such bit fields (the filesystem macros use chars).
170 * FD_SETSIZE may be defined by the user, but the default here should
171 * be enough for most uses.
174 #define FD_SETSIZE 1024
177 typedef long fd_mask;
178 #define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */
181 #define howmany(x, y) (((x) + ((y) - 1)) / (y))
184 typedef struct fd_set {
185 fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
188 #define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
189 #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
190 #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
191 #define FD_COPY(f, t) bcopy(f, t, sizeof(*(f)))
192 #define FD_ZERO(p) bzero(p, sizeof(*(p)))
195 * These declarations belong elsewhere, but are repeated here and in
196 * <stdio.h> to give broken programs a better chance of working with
201 #ifndef _FTRUNCATE_DECLARED
202 #define _FTRUNCATE_DECLARED
203 int ftruncate __P((int, off_t));
205 #ifndef _LSEEK_DECLARED
206 #define _LSEEK_DECLARED
207 off_t lseek __P((int, off_t, int));
209 #ifndef _MMAP_DECLARED
210 #define _MMAP_DECLARED
211 void * mmap __P((void *, size_t, int, int, int, off_t));
213 #ifndef _TRUNCATE_DECLARED
214 #define _TRUNCATE_DECLARED
215 int truncate __P((const char *, off_t));
218 #endif /* !_KERNEL */
220 #endif /* !_POSIX_SOURCE */
222 #endif /* !_SYS_TYPES_H_ */