xref: /illumos-gate/usr/src/boot/sys/sys/types.h (revision 199767f8919635c4928607450d9e0abb932109ce)
1*199767f8SToomas Soome /*-
2*199767f8SToomas Soome  * Copyright (c) 1982, 1986, 1991, 1993, 1994
3*199767f8SToomas Soome  *	The Regents of the University of California.  All rights reserved.
4*199767f8SToomas Soome  * (c) UNIX System Laboratories, Inc.
5*199767f8SToomas Soome  * All or some portions of this file are derived from material licensed
6*199767f8SToomas Soome  * to the University of California by American Telephone and Telegraph
7*199767f8SToomas Soome  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8*199767f8SToomas Soome  * the permission of UNIX System Laboratories, Inc.
9*199767f8SToomas Soome  *
10*199767f8SToomas Soome  * Redistribution and use in source and binary forms, with or without
11*199767f8SToomas Soome  * modification, are permitted provided that the following conditions
12*199767f8SToomas Soome  * are met:
13*199767f8SToomas Soome  * 1. Redistributions of source code must retain the above copyright
14*199767f8SToomas Soome  *    notice, this list of conditions and the following disclaimer.
15*199767f8SToomas Soome  * 2. Redistributions in binary form must reproduce the above copyright
16*199767f8SToomas Soome  *    notice, this list of conditions and the following disclaimer in the
17*199767f8SToomas Soome  *    documentation and/or other materials provided with the distribution.
18*199767f8SToomas Soome  * 4. Neither the name of the University nor the names of its contributors
19*199767f8SToomas Soome  *    may be used to endorse or promote products derived from this software
20*199767f8SToomas Soome  *    without specific prior written permission.
21*199767f8SToomas Soome  *
22*199767f8SToomas Soome  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23*199767f8SToomas Soome  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24*199767f8SToomas Soome  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25*199767f8SToomas Soome  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26*199767f8SToomas Soome  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27*199767f8SToomas Soome  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28*199767f8SToomas Soome  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29*199767f8SToomas Soome  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30*199767f8SToomas Soome  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31*199767f8SToomas Soome  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32*199767f8SToomas Soome  * SUCH DAMAGE.
33*199767f8SToomas Soome  *
34*199767f8SToomas Soome  *	@(#)types.h	8.6 (Berkeley) 2/19/95
35*199767f8SToomas Soome  * $FreeBSD$
36*199767f8SToomas Soome  */
37*199767f8SToomas Soome 
38*199767f8SToomas Soome #ifndef _SYS_TYPES_H_
39*199767f8SToomas Soome #define	_SYS_TYPES_H_
40*199767f8SToomas Soome 
41*199767f8SToomas Soome #include <sys/cdefs.h>
42*199767f8SToomas Soome 
43*199767f8SToomas Soome /* Machine type dependent parameters. */
44*199767f8SToomas Soome #include <machine/endian.h>
45*199767f8SToomas Soome #include <sys/_types.h>
46*199767f8SToomas Soome 
47*199767f8SToomas Soome #include <sys/_pthreadtypes.h>
48*199767f8SToomas Soome 
49*199767f8SToomas Soome #if __BSD_VISIBLE
50*199767f8SToomas Soome typedef	unsigned char	u_char;
51*199767f8SToomas Soome typedef	unsigned short	u_short;
52*199767f8SToomas Soome typedef	unsigned int	u_int;
53*199767f8SToomas Soome typedef	unsigned long	u_long;
54*199767f8SToomas Soome #ifndef _KERNEL
55*199767f8SToomas Soome typedef	unsigned short	ushort;		/* Sys V compatibility */
56*199767f8SToomas Soome typedef	unsigned int	uint;		/* Sys V compatibility */
57*199767f8SToomas Soome #endif
58*199767f8SToomas Soome #endif
59*199767f8SToomas Soome 
60*199767f8SToomas Soome /*
61*199767f8SToomas Soome  * XXX POSIX sized integrals that should appear only in <sys/stdint.h>.
62*199767f8SToomas Soome  */
63*199767f8SToomas Soome #include <sys/_stdint.h>
64*199767f8SToomas Soome 
65*199767f8SToomas Soome typedef __uint8_t	u_int8_t;	/* unsigned integrals (deprecated) */
66*199767f8SToomas Soome typedef __uint16_t	u_int16_t;
67*199767f8SToomas Soome typedef __uint32_t	u_int32_t;
68*199767f8SToomas Soome typedef __uint64_t	u_int64_t;
69*199767f8SToomas Soome 
70*199767f8SToomas Soome typedef	__uint64_t	u_quad_t;	/* quads (deprecated) */
71*199767f8SToomas Soome typedef	__int64_t	quad_t;
72*199767f8SToomas Soome typedef	quad_t *	qaddr_t;
73*199767f8SToomas Soome 
74*199767f8SToomas Soome typedef	char *		caddr_t;	/* core address */
75*199767f8SToomas Soome typedef	const char *	c_caddr_t;	/* core address, pointer to const */
76*199767f8SToomas Soome 
77*199767f8SToomas Soome #ifndef _BLKSIZE_T_DECLARED
78*199767f8SToomas Soome typedef	__blksize_t	blksize_t;
79*199767f8SToomas Soome #define	_BLKSIZE_T_DECLARED
80*199767f8SToomas Soome #endif
81*199767f8SToomas Soome 
82*199767f8SToomas Soome typedef	__cpuwhich_t	cpuwhich_t;
83*199767f8SToomas Soome typedef	__cpulevel_t	cpulevel_t;
84*199767f8SToomas Soome typedef	__cpusetid_t	cpusetid_t;
85*199767f8SToomas Soome 
86*199767f8SToomas Soome #ifndef _BLKCNT_T_DECLARED
87*199767f8SToomas Soome typedef	__blkcnt_t	blkcnt_t;
88*199767f8SToomas Soome #define	_BLKCNT_T_DECLARED
89*199767f8SToomas Soome #endif
90*199767f8SToomas Soome 
91*199767f8SToomas Soome #ifndef _CLOCK_T_DECLARED
92*199767f8SToomas Soome typedef	__clock_t	clock_t;
93*199767f8SToomas Soome #define	_CLOCK_T_DECLARED
94*199767f8SToomas Soome #endif
95*199767f8SToomas Soome 
96*199767f8SToomas Soome #ifndef _CLOCKID_T_DECLARED
97*199767f8SToomas Soome typedef	__clockid_t	clockid_t;
98*199767f8SToomas Soome #define	_CLOCKID_T_DECLARED
99*199767f8SToomas Soome #endif
100*199767f8SToomas Soome 
101*199767f8SToomas Soome typedef	__critical_t	critical_t;	/* Critical section value */
102*199767f8SToomas Soome typedef	__int64_t	daddr_t;	/* disk address */
103*199767f8SToomas Soome 
104*199767f8SToomas Soome #ifndef _DEV_T_DECLARED
105*199767f8SToomas Soome typedef	__dev_t		dev_t;		/* device number or struct cdev */
106*199767f8SToomas Soome #define	_DEV_T_DECLARED
107*199767f8SToomas Soome #endif
108*199767f8SToomas Soome 
109*199767f8SToomas Soome #ifndef _FFLAGS_T_DECLARED
110*199767f8SToomas Soome typedef	__fflags_t	fflags_t;	/* file flags */
111*199767f8SToomas Soome #define	_FFLAGS_T_DECLARED
112*199767f8SToomas Soome #endif
113*199767f8SToomas Soome 
114*199767f8SToomas Soome typedef	__fixpt_t	fixpt_t;	/* fixed point number */
115*199767f8SToomas Soome 
116*199767f8SToomas Soome #ifndef _FSBLKCNT_T_DECLARED		/* for statvfs() */
117*199767f8SToomas Soome typedef	__fsblkcnt_t	fsblkcnt_t;
118*199767f8SToomas Soome typedef	__fsfilcnt_t	fsfilcnt_t;
119*199767f8SToomas Soome #define	_FSBLKCNT_T_DECLARED
120*199767f8SToomas Soome #endif
121*199767f8SToomas Soome 
122*199767f8SToomas Soome #ifndef _GID_T_DECLARED
123*199767f8SToomas Soome typedef	__gid_t		gid_t;		/* group id */
124*199767f8SToomas Soome #define	_GID_T_DECLARED
125*199767f8SToomas Soome #endif
126*199767f8SToomas Soome 
127*199767f8SToomas Soome #ifndef _IN_ADDR_T_DECLARED
128*199767f8SToomas Soome typedef	__uint32_t	in_addr_t;	/* base type for internet address */
129*199767f8SToomas Soome #define	_IN_ADDR_T_DECLARED
130*199767f8SToomas Soome #endif
131*199767f8SToomas Soome 
132*199767f8SToomas Soome #ifndef _IN_PORT_T_DECLARED
133*199767f8SToomas Soome typedef	__uint16_t	in_port_t;
134*199767f8SToomas Soome #define	_IN_PORT_T_DECLARED
135*199767f8SToomas Soome #endif
136*199767f8SToomas Soome 
137*199767f8SToomas Soome #ifndef _ID_T_DECLARED
138*199767f8SToomas Soome typedef	__id_t		id_t;		/* can hold a uid_t or pid_t */
139*199767f8SToomas Soome #define	_ID_T_DECLARED
140*199767f8SToomas Soome #endif
141*199767f8SToomas Soome 
142*199767f8SToomas Soome #ifndef _INO_T_DECLARED
143*199767f8SToomas Soome typedef	__ino_t		ino_t;		/* inode number */
144*199767f8SToomas Soome #define	_INO_T_DECLARED
145*199767f8SToomas Soome #endif
146*199767f8SToomas Soome 
147*199767f8SToomas Soome #ifndef _KEY_T_DECLARED
148*199767f8SToomas Soome typedef	__key_t		key_t;		/* IPC key (for Sys V IPC) */
149*199767f8SToomas Soome #define	_KEY_T_DECLARED
150*199767f8SToomas Soome #endif
151*199767f8SToomas Soome 
152*199767f8SToomas Soome #ifndef _LWPID_T_DECLARED
153*199767f8SToomas Soome typedef	__lwpid_t	lwpid_t;	/* Thread ID (a.k.a. LWP) */
154*199767f8SToomas Soome #define	_LWPID_T_DECLARED
155*199767f8SToomas Soome #endif
156*199767f8SToomas Soome 
157*199767f8SToomas Soome #ifndef _MODE_T_DECLARED
158*199767f8SToomas Soome typedef	__mode_t	mode_t;		/* permissions */
159*199767f8SToomas Soome #define	_MODE_T_DECLARED
160*199767f8SToomas Soome #endif
161*199767f8SToomas Soome 
162*199767f8SToomas Soome #ifndef _ACCMODE_T_DECLARED
163*199767f8SToomas Soome typedef	__accmode_t	accmode_t;	/* access permissions */
164*199767f8SToomas Soome #define	_ACCMODE_T_DECLARED
165*199767f8SToomas Soome #endif
166*199767f8SToomas Soome 
167*199767f8SToomas Soome #ifndef _NLINK_T_DECLARED
168*199767f8SToomas Soome typedef	__nlink_t	nlink_t;	/* link count */
169*199767f8SToomas Soome #define	_NLINK_T_DECLARED
170*199767f8SToomas Soome #endif
171*199767f8SToomas Soome 
172*199767f8SToomas Soome #ifndef _OFF_T_DECLARED
173*199767f8SToomas Soome typedef	__off_t		off_t;		/* file offset */
174*199767f8SToomas Soome #define	_OFF_T_DECLARED
175*199767f8SToomas Soome #endif
176*199767f8SToomas Soome 
177*199767f8SToomas Soome #ifndef _PID_T_DECLARED
178*199767f8SToomas Soome typedef	__pid_t		pid_t;		/* process id */
179*199767f8SToomas Soome #define	_PID_T_DECLARED
180*199767f8SToomas Soome #endif
181*199767f8SToomas Soome 
182*199767f8SToomas Soome typedef	__register_t	register_t;
183*199767f8SToomas Soome 
184*199767f8SToomas Soome #ifndef _RLIM_T_DECLARED
185*199767f8SToomas Soome typedef	__rlim_t	rlim_t;		/* resource limit */
186*199767f8SToomas Soome #define	_RLIM_T_DECLARED
187*199767f8SToomas Soome #endif
188*199767f8SToomas Soome 
189*199767f8SToomas Soome typedef	__int64_t	sbintime_t;
190*199767f8SToomas Soome 
191*199767f8SToomas Soome typedef	__segsz_t	segsz_t;	/* segment size (in pages) */
192*199767f8SToomas Soome 
193*199767f8SToomas Soome #ifndef _SIZE_T_DECLARED
194*199767f8SToomas Soome typedef	__size_t	size_t;
195*199767f8SToomas Soome #define	_SIZE_T_DECLARED
196*199767f8SToomas Soome #endif
197*199767f8SToomas Soome 
198*199767f8SToomas Soome #ifndef _SSIZE_T_DECLARED
199*199767f8SToomas Soome typedef	__ssize_t	ssize_t;
200*199767f8SToomas Soome #define	_SSIZE_T_DECLARED
201*199767f8SToomas Soome #endif
202*199767f8SToomas Soome 
203*199767f8SToomas Soome #ifndef _SUSECONDS_T_DECLARED
204*199767f8SToomas Soome typedef	__suseconds_t	suseconds_t;	/* microseconds (signed) */
205*199767f8SToomas Soome #define	_SUSECONDS_T_DECLARED
206*199767f8SToomas Soome #endif
207*199767f8SToomas Soome 
208*199767f8SToomas Soome #ifndef _TIME_T_DECLARED
209*199767f8SToomas Soome typedef	__time_t	time_t;
210*199767f8SToomas Soome #define	_TIME_T_DECLARED
211*199767f8SToomas Soome #endif
212*199767f8SToomas Soome 
213*199767f8SToomas Soome #ifndef _TIMER_T_DECLARED
214*199767f8SToomas Soome typedef	__timer_t	timer_t;
215*199767f8SToomas Soome #define	_TIMER_T_DECLARED
216*199767f8SToomas Soome #endif
217*199767f8SToomas Soome 
218*199767f8SToomas Soome #ifndef _MQD_T_DECLARED
219*199767f8SToomas Soome typedef	__mqd_t	mqd_t;
220*199767f8SToomas Soome #define	_MQD_T_DECLARED
221*199767f8SToomas Soome #endif
222*199767f8SToomas Soome 
223*199767f8SToomas Soome typedef	__u_register_t	u_register_t;
224*199767f8SToomas Soome 
225*199767f8SToomas Soome #ifndef _UID_T_DECLARED
226*199767f8SToomas Soome typedef	__uid_t		uid_t;		/* user id */
227*199767f8SToomas Soome #define	_UID_T_DECLARED
228*199767f8SToomas Soome #endif
229*199767f8SToomas Soome 
230*199767f8SToomas Soome #ifndef _USECONDS_T_DECLARED
231*199767f8SToomas Soome typedef	__useconds_t	useconds_t;	/* microseconds (unsigned) */
232*199767f8SToomas Soome #define	_USECONDS_T_DECLARED
233*199767f8SToomas Soome #endif
234*199767f8SToomas Soome 
235*199767f8SToomas Soome #ifndef _CAP_IOCTL_T_DECLARED
236*199767f8SToomas Soome #define	_CAP_IOCTL_T_DECLARED
237*199767f8SToomas Soome typedef	unsigned long	cap_ioctl_t;
238*199767f8SToomas Soome #endif
239*199767f8SToomas Soome 
240*199767f8SToomas Soome #ifndef _CAP_RIGHTS_T_DECLARED
241*199767f8SToomas Soome #define	_CAP_RIGHTS_T_DECLARED
242*199767f8SToomas Soome struct cap_rights;
243*199767f8SToomas Soome 
244*199767f8SToomas Soome typedef	struct cap_rights	cap_rights_t;
245*199767f8SToomas Soome #endif
246*199767f8SToomas Soome 
247*199767f8SToomas Soome typedef	__vm_offset_t	vm_offset_t;
248*199767f8SToomas Soome typedef	__vm_ooffset_t	vm_ooffset_t;
249*199767f8SToomas Soome typedef	__vm_paddr_t	vm_paddr_t;
250*199767f8SToomas Soome typedef	__vm_pindex_t	vm_pindex_t;
251*199767f8SToomas Soome typedef	__vm_size_t	vm_size_t;
252*199767f8SToomas Soome 
253*199767f8SToomas Soome typedef __rman_res_t    rman_res_t;
254*199767f8SToomas Soome 
255*199767f8SToomas Soome #ifdef _KERNEL
256*199767f8SToomas Soome typedef	int		boolean_t;
257*199767f8SToomas Soome typedef	struct device	*device_t;
258*199767f8SToomas Soome typedef	__intfptr_t	intfptr_t;
259*199767f8SToomas Soome 
260*199767f8SToomas Soome /*
261*199767f8SToomas Soome  * XXX this is fixed width for historical reasons.  It should have had type
262*199767f8SToomas Soome  * __int_fast32_t.  Fixed-width types should not be used unless binary
263*199767f8SToomas Soome  * compatibility is essential.  Least-width types should be used even less
264*199767f8SToomas Soome  * since they provide smaller benefits.
265*199767f8SToomas Soome  *
266*199767f8SToomas Soome  * XXX should be MD.
267*199767f8SToomas Soome  *
268*199767f8SToomas Soome  * XXX this is bogus in -current, but still used for spl*().
269*199767f8SToomas Soome  */
270*199767f8SToomas Soome typedef	__uint32_t	intrmask_t;	/* Interrupt mask (spl, xxx_imask...) */
271*199767f8SToomas Soome 
272*199767f8SToomas Soome typedef	__uintfptr_t	uintfptr_t;
273*199767f8SToomas Soome typedef	__uint64_t	uoff_t;
274*199767f8SToomas Soome typedef	char		vm_memattr_t;	/* memory attribute codes */
275*199767f8SToomas Soome typedef	struct vm_page	*vm_page_t;
276*199767f8SToomas Soome 
277*199767f8SToomas Soome #if !defined(__bool_true_false_are_defined) && !defined(__cplusplus)
278*199767f8SToomas Soome #define	__bool_true_false_are_defined	1
279*199767f8SToomas Soome #define	false	0
280*199767f8SToomas Soome #define	true	1
281*199767f8SToomas Soome #if __STDC_VERSION__ < 199901L && __GNUC__ < 3 && !defined(__INTEL_COMPILER)
282*199767f8SToomas Soome typedef	int	_Bool;
283*199767f8SToomas Soome #endif
284*199767f8SToomas Soome typedef	_Bool	bool;
285*199767f8SToomas Soome #endif /* !__bool_true_false_are_defined && !__cplusplus */
286*199767f8SToomas Soome 
287*199767f8SToomas Soome #define offsetof(type, field) __offsetof(type, field)
288*199767f8SToomas Soome 
289*199767f8SToomas Soome #endif /* !_KERNEL */
290*199767f8SToomas Soome 
291*199767f8SToomas Soome /*
292*199767f8SToomas Soome  * The following are all things that really shouldn't exist in this header,
293*199767f8SToomas Soome  * since its purpose is to provide typedefs, not miscellaneous doodads.
294*199767f8SToomas Soome  */
295*199767f8SToomas Soome 
296*199767f8SToomas Soome #ifdef __POPCNT__
297*199767f8SToomas Soome #define	__bitcount64(x)	__builtin_popcountll((__uint64_t)(x))
298*199767f8SToomas Soome #define	__bitcount32(x)	__builtin_popcount((__uint32_t)(x))
299*199767f8SToomas Soome #define	__bitcount16(x)	__builtin_popcount((__uint16_t)(x))
300*199767f8SToomas Soome #define	__bitcountl(x)	__builtin_popcountl((unsigned long)(x))
301*199767f8SToomas Soome #define	__bitcount(x)	__builtin_popcount((unsigned int)(x))
302*199767f8SToomas Soome #else
303*199767f8SToomas Soome /*
304*199767f8SToomas Soome  * Population count algorithm using SWAR approach
305*199767f8SToomas Soome  * - "SIMD Within A Register".
306*199767f8SToomas Soome  */
307*199767f8SToomas Soome static __inline __uint16_t
308*199767f8SToomas Soome __bitcount16(__uint16_t _x)
309*199767f8SToomas Soome {
310*199767f8SToomas Soome 
311*199767f8SToomas Soome 	_x = (_x & 0x5555) + ((_x & 0xaaaa) >> 1);
312*199767f8SToomas Soome 	_x = (_x & 0x3333) + ((_x & 0xcccc) >> 2);
313*199767f8SToomas Soome 	_x = (_x + (_x >> 4)) & 0x0f0f;
314*199767f8SToomas Soome 	_x = (_x + (_x >> 8)) & 0x00ff;
315*199767f8SToomas Soome 	return (_x);
316*199767f8SToomas Soome }
317*199767f8SToomas Soome 
318*199767f8SToomas Soome static __inline __uint32_t
319*199767f8SToomas Soome __bitcount32(__uint32_t _x)
320*199767f8SToomas Soome {
321*199767f8SToomas Soome 
322*199767f8SToomas Soome 	_x = (_x & 0x55555555) + ((_x & 0xaaaaaaaa) >> 1);
323*199767f8SToomas Soome 	_x = (_x & 0x33333333) + ((_x & 0xcccccccc) >> 2);
324*199767f8SToomas Soome 	_x = (_x + (_x >> 4)) & 0x0f0f0f0f;
325*199767f8SToomas Soome 	_x = (_x + (_x >> 8));
326*199767f8SToomas Soome 	_x = (_x + (_x >> 16)) & 0x000000ff;
327*199767f8SToomas Soome 	return (_x);
328*199767f8SToomas Soome }
329*199767f8SToomas Soome 
330*199767f8SToomas Soome #ifdef __LP64__
331*199767f8SToomas Soome static __inline __uint64_t
332*199767f8SToomas Soome __bitcount64(__uint64_t _x)
333*199767f8SToomas Soome {
334*199767f8SToomas Soome 
335*199767f8SToomas Soome 	_x = (_x & 0x5555555555555555) + ((_x & 0xaaaaaaaaaaaaaaaa) >> 1);
336*199767f8SToomas Soome 	_x = (_x & 0x3333333333333333) + ((_x & 0xcccccccccccccccc) >> 2);
337*199767f8SToomas Soome 	_x = (_x + (_x >> 4)) & 0x0f0f0f0f0f0f0f0f;
338*199767f8SToomas Soome 	_x = (_x + (_x >> 8));
339*199767f8SToomas Soome 	_x = (_x + (_x >> 16));
340*199767f8SToomas Soome 	_x = (_x + (_x >> 32)) & 0x000000ff;
341*199767f8SToomas Soome 	return (_x);
342*199767f8SToomas Soome }
343*199767f8SToomas Soome 
344*199767f8SToomas Soome #define	__bitcountl(x)	__bitcount64((unsigned long)(x))
345*199767f8SToomas Soome #else
346*199767f8SToomas Soome static __inline __uint64_t
347*199767f8SToomas Soome __bitcount64(__uint64_t _x)
348*199767f8SToomas Soome {
349*199767f8SToomas Soome 
350*199767f8SToomas Soome 	return (__bitcount32(_x >> 32) + __bitcount32(_x));
351*199767f8SToomas Soome }
352*199767f8SToomas Soome 
353*199767f8SToomas Soome #define	__bitcountl(x)	__bitcount32((unsigned long)(x))
354*199767f8SToomas Soome #endif
355*199767f8SToomas Soome #define	__bitcount(x)	__bitcount32((unsigned int)(x))
356*199767f8SToomas Soome #endif
357*199767f8SToomas Soome 
358*199767f8SToomas Soome #if __BSD_VISIBLE
359*199767f8SToomas Soome 
360*199767f8SToomas Soome #include <sys/select.h>
361*199767f8SToomas Soome 
362*199767f8SToomas Soome /*
363*199767f8SToomas Soome  * minor() gives a cookie instead of an index since we don't want to
364*199767f8SToomas Soome  * change the meanings of bits 0-15 or waste time and space shifting
365*199767f8SToomas Soome  * bits 16-31 for devices that don't use them.
366*199767f8SToomas Soome  */
367*199767f8SToomas Soome #define	major(x)	((int)(((u_int)(x) >> 8)&0xff))	/* major number */
368*199767f8SToomas Soome #define	minor(x)	((int)((x)&0xffff00ff))		/* minor number */
369*199767f8SToomas Soome #define	makedev(x,y)	((dev_t)(((x) << 8) | (y)))	/* create dev_t */
370*199767f8SToomas Soome 
371*199767f8SToomas Soome /*
372*199767f8SToomas Soome  * These declarations belong elsewhere, but are repeated here and in
373*199767f8SToomas Soome  * <stdio.h> to give broken programs a better chance of working with
374*199767f8SToomas Soome  * 64-bit off_t's.
375*199767f8SToomas Soome  */
376*199767f8SToomas Soome #ifndef _KERNEL
377*199767f8SToomas Soome __BEGIN_DECLS
378*199767f8SToomas Soome #ifndef _FTRUNCATE_DECLARED
379*199767f8SToomas Soome #define	_FTRUNCATE_DECLARED
380*199767f8SToomas Soome int	 ftruncate(int, off_t);
381*199767f8SToomas Soome #endif
382*199767f8SToomas Soome #ifndef _LSEEK_DECLARED
383*199767f8SToomas Soome #define	_LSEEK_DECLARED
384*199767f8SToomas Soome off_t	 lseek(int, off_t, int);
385*199767f8SToomas Soome #endif
386*199767f8SToomas Soome #ifndef _MMAP_DECLARED
387*199767f8SToomas Soome #define	_MMAP_DECLARED
388*199767f8SToomas Soome void *	 mmap(void *, size_t, int, int, int, off_t);
389*199767f8SToomas Soome #endif
390*199767f8SToomas Soome #ifndef _TRUNCATE_DECLARED
391*199767f8SToomas Soome #define	_TRUNCATE_DECLARED
392*199767f8SToomas Soome int	 truncate(const char *, off_t);
393*199767f8SToomas Soome #endif
394*199767f8SToomas Soome __END_DECLS
395*199767f8SToomas Soome #endif /* !_KERNEL */
396*199767f8SToomas Soome 
397*199767f8SToomas Soome #endif /* __BSD_VISIBLE */
398*199767f8SToomas Soome 
399*199767f8SToomas Soome #endif /* !_SYS_TYPES_H_ */
400