xref: /illumos-gate/usr/src/boot/sys/sys/types.h (revision 4a04e8db7f069cc2eb910470e630778f35ef3c44)
1199767f8SToomas Soome /*-
2199767f8SToomas Soome  * Copyright (c) 1982, 1986, 1991, 1993, 1994
3199767f8SToomas Soome  *	The Regents of the University of California.  All rights reserved.
4199767f8SToomas Soome  * (c) UNIX System Laboratories, Inc.
5199767f8SToomas Soome  * All or some portions of this file are derived from material licensed
6199767f8SToomas Soome  * to the University of California by American Telephone and Telegraph
7199767f8SToomas Soome  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8199767f8SToomas Soome  * the permission of UNIX System Laboratories, Inc.
9199767f8SToomas Soome  *
10199767f8SToomas Soome  * Redistribution and use in source and binary forms, with or without
11199767f8SToomas Soome  * modification, are permitted provided that the following conditions
12199767f8SToomas Soome  * are met:
13199767f8SToomas Soome  * 1. Redistributions of source code must retain the above copyright
14199767f8SToomas Soome  *    notice, this list of conditions and the following disclaimer.
15199767f8SToomas Soome  * 2. Redistributions in binary form must reproduce the above copyright
16199767f8SToomas Soome  *    notice, this list of conditions and the following disclaimer in the
17199767f8SToomas Soome  *    documentation and/or other materials provided with the distribution.
18199767f8SToomas Soome  * 4. Neither the name of the University nor the names of its contributors
19199767f8SToomas Soome  *    may be used to endorse or promote products derived from this software
20199767f8SToomas Soome  *    without specific prior written permission.
21199767f8SToomas Soome  *
22199767f8SToomas Soome  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23199767f8SToomas Soome  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24199767f8SToomas Soome  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25199767f8SToomas Soome  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26199767f8SToomas Soome  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27199767f8SToomas Soome  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28199767f8SToomas Soome  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29199767f8SToomas Soome  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30199767f8SToomas Soome  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31199767f8SToomas Soome  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32199767f8SToomas Soome  * SUCH DAMAGE.
33199767f8SToomas Soome  *
34199767f8SToomas Soome  *	@(#)types.h	8.6 (Berkeley) 2/19/95
35199767f8SToomas Soome  * $FreeBSD$
36199767f8SToomas Soome  */
37199767f8SToomas Soome 
38199767f8SToomas Soome #ifndef _SYS_TYPES_H_
39199767f8SToomas Soome #define	_SYS_TYPES_H_
40199767f8SToomas Soome 
41199767f8SToomas Soome #include <sys/cdefs.h>
42199767f8SToomas Soome 
43199767f8SToomas Soome /* Machine type dependent parameters. */
44199767f8SToomas Soome #include <machine/endian.h>
45199767f8SToomas Soome #include <sys/_types.h>
46199767f8SToomas Soome 
47199767f8SToomas Soome #include <sys/_pthreadtypes.h>
48199767f8SToomas Soome 
49199767f8SToomas Soome #if __BSD_VISIBLE
50199767f8SToomas Soome typedef	unsigned char	u_char;
51199767f8SToomas Soome typedef	unsigned short	u_short;
52199767f8SToomas Soome typedef	unsigned int	u_int;
53199767f8SToomas Soome typedef	unsigned long	u_long;
54199767f8SToomas Soome #ifndef _KERNEL
55199767f8SToomas Soome typedef	unsigned short	ushort;		/* Sys V compatibility */
56199767f8SToomas Soome typedef	unsigned int	uint;		/* Sys V compatibility */
57199767f8SToomas Soome #endif
58199767f8SToomas Soome #endif
59199767f8SToomas Soome 
60*4a04e8dbSToomas Soome /*
61*4a04e8dbSToomas Soome  * POSIX Extensions
62*4a04e8dbSToomas Soome  */
63*4a04e8dbSToomas Soome typedef	unsigned int	uint_t;
64*4a04e8dbSToomas Soome 
65199767f8SToomas Soome /*
66199767f8SToomas Soome  * XXX POSIX sized integrals that should appear only in <sys/stdint.h>.
67199767f8SToomas Soome  */
68199767f8SToomas Soome #include <sys/_stdint.h>
69199767f8SToomas Soome 
70199767f8SToomas Soome typedef __uint8_t	u_int8_t;	/* unsigned integrals (deprecated) */
71199767f8SToomas Soome typedef __uint16_t	u_int16_t;
72199767f8SToomas Soome typedef __uint32_t	u_int32_t;
73199767f8SToomas Soome typedef __uint64_t	u_int64_t;
74199767f8SToomas Soome 
75199767f8SToomas Soome typedef	__uint64_t	u_quad_t;	/* quads (deprecated) */
76199767f8SToomas Soome typedef	__int64_t	quad_t;
77199767f8SToomas Soome typedef	quad_t *	qaddr_t;
78199767f8SToomas Soome 
79199767f8SToomas Soome typedef	char *		caddr_t;	/* core address */
80199767f8SToomas Soome typedef	const char *	c_caddr_t;	/* core address, pointer to const */
81199767f8SToomas Soome 
82199767f8SToomas Soome #ifndef _BLKSIZE_T_DECLARED
83199767f8SToomas Soome typedef	__blksize_t	blksize_t;
84199767f8SToomas Soome #define	_BLKSIZE_T_DECLARED
85199767f8SToomas Soome #endif
86199767f8SToomas Soome 
87199767f8SToomas Soome typedef	__cpuwhich_t	cpuwhich_t;
88199767f8SToomas Soome typedef	__cpulevel_t	cpulevel_t;
89199767f8SToomas Soome typedef	__cpusetid_t	cpusetid_t;
90199767f8SToomas Soome 
91199767f8SToomas Soome #ifndef _BLKCNT_T_DECLARED
92199767f8SToomas Soome typedef	__blkcnt_t	blkcnt_t;
93199767f8SToomas Soome #define	_BLKCNT_T_DECLARED
94199767f8SToomas Soome #endif
95199767f8SToomas Soome 
96199767f8SToomas Soome #ifndef _CLOCK_T_DECLARED
97199767f8SToomas Soome typedef	__clock_t	clock_t;
98199767f8SToomas Soome #define	_CLOCK_T_DECLARED
99199767f8SToomas Soome #endif
100199767f8SToomas Soome 
101199767f8SToomas Soome #ifndef _CLOCKID_T_DECLARED
102199767f8SToomas Soome typedef	__clockid_t	clockid_t;
103199767f8SToomas Soome #define	_CLOCKID_T_DECLARED
104199767f8SToomas Soome #endif
105199767f8SToomas Soome 
106199767f8SToomas Soome typedef	__critical_t	critical_t;	/* Critical section value */
107199767f8SToomas Soome typedef	__int64_t	daddr_t;	/* disk address */
108199767f8SToomas Soome 
109199767f8SToomas Soome #ifndef _DEV_T_DECLARED
110199767f8SToomas Soome typedef	__dev_t		dev_t;		/* device number or struct cdev */
111199767f8SToomas Soome #define	_DEV_T_DECLARED
112199767f8SToomas Soome #endif
113199767f8SToomas Soome 
114199767f8SToomas Soome #ifndef _FFLAGS_T_DECLARED
115199767f8SToomas Soome typedef	__fflags_t	fflags_t;	/* file flags */
116199767f8SToomas Soome #define	_FFLAGS_T_DECLARED
117199767f8SToomas Soome #endif
118199767f8SToomas Soome 
119199767f8SToomas Soome typedef	__fixpt_t	fixpt_t;	/* fixed point number */
120199767f8SToomas Soome 
121199767f8SToomas Soome #ifndef _FSBLKCNT_T_DECLARED		/* for statvfs() */
122199767f8SToomas Soome typedef	__fsblkcnt_t	fsblkcnt_t;
123199767f8SToomas Soome typedef	__fsfilcnt_t	fsfilcnt_t;
124199767f8SToomas Soome #define	_FSBLKCNT_T_DECLARED
125199767f8SToomas Soome #endif
126199767f8SToomas Soome 
127199767f8SToomas Soome #ifndef _GID_T_DECLARED
128199767f8SToomas Soome typedef	__gid_t		gid_t;		/* group id */
129199767f8SToomas Soome #define	_GID_T_DECLARED
130199767f8SToomas Soome #endif
131199767f8SToomas Soome 
132199767f8SToomas Soome #ifndef _IN_ADDR_T_DECLARED
133199767f8SToomas Soome typedef	__uint32_t	in_addr_t;	/* base type for internet address */
134199767f8SToomas Soome #define	_IN_ADDR_T_DECLARED
135199767f8SToomas Soome #endif
136199767f8SToomas Soome 
137199767f8SToomas Soome #ifndef _IN_PORT_T_DECLARED
138199767f8SToomas Soome typedef	__uint16_t	in_port_t;
139199767f8SToomas Soome #define	_IN_PORT_T_DECLARED
140199767f8SToomas Soome #endif
141199767f8SToomas Soome 
142199767f8SToomas Soome #ifndef _ID_T_DECLARED
143199767f8SToomas Soome typedef	__id_t		id_t;		/* can hold a uid_t or pid_t */
144199767f8SToomas Soome #define	_ID_T_DECLARED
145199767f8SToomas Soome #endif
146199767f8SToomas Soome 
147199767f8SToomas Soome #ifndef _INO_T_DECLARED
148199767f8SToomas Soome typedef	__ino_t		ino_t;		/* inode number */
149199767f8SToomas Soome #define	_INO_T_DECLARED
150199767f8SToomas Soome #endif
151199767f8SToomas Soome 
152199767f8SToomas Soome #ifndef _KEY_T_DECLARED
153199767f8SToomas Soome typedef	__key_t		key_t;		/* IPC key (for Sys V IPC) */
154199767f8SToomas Soome #define	_KEY_T_DECLARED
155199767f8SToomas Soome #endif
156199767f8SToomas Soome 
157199767f8SToomas Soome #ifndef _LWPID_T_DECLARED
158199767f8SToomas Soome typedef	__lwpid_t	lwpid_t;	/* Thread ID (a.k.a. LWP) */
159199767f8SToomas Soome #define	_LWPID_T_DECLARED
160199767f8SToomas Soome #endif
161199767f8SToomas Soome 
162199767f8SToomas Soome #ifndef _MODE_T_DECLARED
163199767f8SToomas Soome typedef	__mode_t	mode_t;		/* permissions */
164199767f8SToomas Soome #define	_MODE_T_DECLARED
165199767f8SToomas Soome #endif
166199767f8SToomas Soome 
167199767f8SToomas Soome #ifndef _ACCMODE_T_DECLARED
168199767f8SToomas Soome typedef	__accmode_t	accmode_t;	/* access permissions */
169199767f8SToomas Soome #define	_ACCMODE_T_DECLARED
170199767f8SToomas Soome #endif
171199767f8SToomas Soome 
172199767f8SToomas Soome #ifndef _NLINK_T_DECLARED
173199767f8SToomas Soome typedef	__nlink_t	nlink_t;	/* link count */
174199767f8SToomas Soome #define	_NLINK_T_DECLARED
175199767f8SToomas Soome #endif
176199767f8SToomas Soome 
177199767f8SToomas Soome #ifndef _OFF_T_DECLARED
178199767f8SToomas Soome typedef	__off_t		off_t;		/* file offset */
179199767f8SToomas Soome #define	_OFF_T_DECLARED
180199767f8SToomas Soome #endif
181199767f8SToomas Soome 
182199767f8SToomas Soome #ifndef _PID_T_DECLARED
183199767f8SToomas Soome typedef	__pid_t		pid_t;		/* process id */
184199767f8SToomas Soome #define	_PID_T_DECLARED
185199767f8SToomas Soome #endif
186199767f8SToomas Soome 
187199767f8SToomas Soome typedef	__register_t	register_t;
188199767f8SToomas Soome 
189199767f8SToomas Soome #ifndef _RLIM_T_DECLARED
190199767f8SToomas Soome typedef	__rlim_t	rlim_t;		/* resource limit */
191199767f8SToomas Soome #define	_RLIM_T_DECLARED
192199767f8SToomas Soome #endif
193199767f8SToomas Soome 
194199767f8SToomas Soome typedef	__int64_t	sbintime_t;
195199767f8SToomas Soome 
196199767f8SToomas Soome typedef	__segsz_t	segsz_t;	/* segment size (in pages) */
197199767f8SToomas Soome 
198199767f8SToomas Soome #ifndef _SIZE_T_DECLARED
199199767f8SToomas Soome typedef	__size_t	size_t;
200199767f8SToomas Soome #define	_SIZE_T_DECLARED
201199767f8SToomas Soome #endif
202199767f8SToomas Soome 
203199767f8SToomas Soome #ifndef _SSIZE_T_DECLARED
204199767f8SToomas Soome typedef	__ssize_t	ssize_t;
205199767f8SToomas Soome #define	_SSIZE_T_DECLARED
206199767f8SToomas Soome #endif
207199767f8SToomas Soome 
208199767f8SToomas Soome #ifndef _SUSECONDS_T_DECLARED
209199767f8SToomas Soome typedef	__suseconds_t	suseconds_t;	/* microseconds (signed) */
210199767f8SToomas Soome #define	_SUSECONDS_T_DECLARED
211199767f8SToomas Soome #endif
212199767f8SToomas Soome 
213199767f8SToomas Soome #ifndef _TIME_T_DECLARED
214199767f8SToomas Soome typedef	__time_t	time_t;
215199767f8SToomas Soome #define	_TIME_T_DECLARED
216199767f8SToomas Soome #endif
217199767f8SToomas Soome 
218199767f8SToomas Soome #ifndef _TIMER_T_DECLARED
219199767f8SToomas Soome typedef	__timer_t	timer_t;
220199767f8SToomas Soome #define	_TIMER_T_DECLARED
221199767f8SToomas Soome #endif
222199767f8SToomas Soome 
223199767f8SToomas Soome #ifndef _MQD_T_DECLARED
224199767f8SToomas Soome typedef	__mqd_t	mqd_t;
225199767f8SToomas Soome #define	_MQD_T_DECLARED
226199767f8SToomas Soome #endif
227199767f8SToomas Soome 
228199767f8SToomas Soome typedef	__u_register_t	u_register_t;
229199767f8SToomas Soome 
230199767f8SToomas Soome #ifndef _UID_T_DECLARED
231199767f8SToomas Soome typedef	__uid_t		uid_t;		/* user id */
232199767f8SToomas Soome #define	_UID_T_DECLARED
233199767f8SToomas Soome #endif
234199767f8SToomas Soome 
235199767f8SToomas Soome #ifndef _USECONDS_T_DECLARED
236199767f8SToomas Soome typedef	__useconds_t	useconds_t;	/* microseconds (unsigned) */
237199767f8SToomas Soome #define	_USECONDS_T_DECLARED
238199767f8SToomas Soome #endif
239199767f8SToomas Soome 
240199767f8SToomas Soome #ifndef _CAP_IOCTL_T_DECLARED
241199767f8SToomas Soome #define	_CAP_IOCTL_T_DECLARED
242199767f8SToomas Soome typedef	unsigned long	cap_ioctl_t;
243199767f8SToomas Soome #endif
244199767f8SToomas Soome 
245199767f8SToomas Soome #ifndef _CAP_RIGHTS_T_DECLARED
246199767f8SToomas Soome #define	_CAP_RIGHTS_T_DECLARED
247199767f8SToomas Soome struct cap_rights;
248199767f8SToomas Soome 
249199767f8SToomas Soome typedef	struct cap_rights	cap_rights_t;
250199767f8SToomas Soome #endif
251199767f8SToomas Soome 
252199767f8SToomas Soome typedef	__vm_offset_t	vm_offset_t;
253199767f8SToomas Soome typedef	__vm_ooffset_t	vm_ooffset_t;
254199767f8SToomas Soome typedef	__vm_paddr_t	vm_paddr_t;
255199767f8SToomas Soome typedef	__vm_pindex_t	vm_pindex_t;
256199767f8SToomas Soome typedef	__vm_size_t	vm_size_t;
257199767f8SToomas Soome 
258199767f8SToomas Soome typedef __rman_res_t    rman_res_t;
259199767f8SToomas Soome 
260199767f8SToomas Soome #ifdef _KERNEL
261199767f8SToomas Soome typedef	int		boolean_t;
262199767f8SToomas Soome typedef	struct device	*device_t;
263199767f8SToomas Soome typedef	__intfptr_t	intfptr_t;
264199767f8SToomas Soome 
265199767f8SToomas Soome /*
266199767f8SToomas Soome  * XXX this is fixed width for historical reasons.  It should have had type
267199767f8SToomas Soome  * __int_fast32_t.  Fixed-width types should not be used unless binary
268199767f8SToomas Soome  * compatibility is essential.  Least-width types should be used even less
269199767f8SToomas Soome  * since they provide smaller benefits.
270199767f8SToomas Soome  *
271199767f8SToomas Soome  * XXX should be MD.
272199767f8SToomas Soome  *
273199767f8SToomas Soome  * XXX this is bogus in -current, but still used for spl*().
274199767f8SToomas Soome  */
275199767f8SToomas Soome typedef	__uint32_t	intrmask_t;	/* Interrupt mask (spl, xxx_imask...) */
276199767f8SToomas Soome 
277199767f8SToomas Soome typedef	__uintfptr_t	uintfptr_t;
278199767f8SToomas Soome typedef	__uint64_t	uoff_t;
279199767f8SToomas Soome typedef	char		vm_memattr_t;	/* memory attribute codes */
280199767f8SToomas Soome typedef	struct vm_page	*vm_page_t;
281199767f8SToomas Soome 
282199767f8SToomas Soome #if !defined(__bool_true_false_are_defined) && !defined(__cplusplus)
283199767f8SToomas Soome #define	__bool_true_false_are_defined	1
284199767f8SToomas Soome #define	false	0
285199767f8SToomas Soome #define	true	1
286199767f8SToomas Soome #if __STDC_VERSION__ < 199901L && __GNUC__ < 3 && !defined(__INTEL_COMPILER)
287199767f8SToomas Soome typedef	int	_Bool;
288199767f8SToomas Soome #endif
289199767f8SToomas Soome typedef	_Bool	bool;
290199767f8SToomas Soome #endif /* !__bool_true_false_are_defined && !__cplusplus */
291199767f8SToomas Soome 
292199767f8SToomas Soome #define offsetof(type, field) __offsetof(type, field)
293199767f8SToomas Soome 
294199767f8SToomas Soome #endif /* !_KERNEL */
295199767f8SToomas Soome 
296199767f8SToomas Soome /*
297199767f8SToomas Soome  * The following are all things that really shouldn't exist in this header,
298199767f8SToomas Soome  * since its purpose is to provide typedefs, not miscellaneous doodads.
299199767f8SToomas Soome  */
300199767f8SToomas Soome 
301199767f8SToomas Soome #ifdef __POPCNT__
302199767f8SToomas Soome #define	__bitcount64(x)	__builtin_popcountll((__uint64_t)(x))
303199767f8SToomas Soome #define	__bitcount32(x)	__builtin_popcount((__uint32_t)(x))
304199767f8SToomas Soome #define	__bitcount16(x)	__builtin_popcount((__uint16_t)(x))
305199767f8SToomas Soome #define	__bitcountl(x)	__builtin_popcountl((unsigned long)(x))
306199767f8SToomas Soome #define	__bitcount(x)	__builtin_popcount((unsigned int)(x))
307199767f8SToomas Soome #else
308199767f8SToomas Soome /*
309199767f8SToomas Soome  * Population count algorithm using SWAR approach
310199767f8SToomas Soome  * - "SIMD Within A Register".
311199767f8SToomas Soome  */
312199767f8SToomas Soome static __inline __uint16_t
313199767f8SToomas Soome __bitcount16(__uint16_t _x)
314199767f8SToomas Soome {
315199767f8SToomas Soome 
316199767f8SToomas Soome 	_x = (_x & 0x5555) + ((_x & 0xaaaa) >> 1);
317199767f8SToomas Soome 	_x = (_x & 0x3333) + ((_x & 0xcccc) >> 2);
318199767f8SToomas Soome 	_x = (_x + (_x >> 4)) & 0x0f0f;
319199767f8SToomas Soome 	_x = (_x + (_x >> 8)) & 0x00ff;
320199767f8SToomas Soome 	return (_x);
321199767f8SToomas Soome }
322199767f8SToomas Soome 
323199767f8SToomas Soome static __inline __uint32_t
324199767f8SToomas Soome __bitcount32(__uint32_t _x)
325199767f8SToomas Soome {
326199767f8SToomas Soome 
327199767f8SToomas Soome 	_x = (_x & 0x55555555) + ((_x & 0xaaaaaaaa) >> 1);
328199767f8SToomas Soome 	_x = (_x & 0x33333333) + ((_x & 0xcccccccc) >> 2);
329199767f8SToomas Soome 	_x = (_x + (_x >> 4)) & 0x0f0f0f0f;
330199767f8SToomas Soome 	_x = (_x + (_x >> 8));
331199767f8SToomas Soome 	_x = (_x + (_x >> 16)) & 0x000000ff;
332199767f8SToomas Soome 	return (_x);
333199767f8SToomas Soome }
334199767f8SToomas Soome 
335199767f8SToomas Soome #ifdef __LP64__
336199767f8SToomas Soome static __inline __uint64_t
337199767f8SToomas Soome __bitcount64(__uint64_t _x)
338199767f8SToomas Soome {
339199767f8SToomas Soome 
340199767f8SToomas Soome 	_x = (_x & 0x5555555555555555) + ((_x & 0xaaaaaaaaaaaaaaaa) >> 1);
341199767f8SToomas Soome 	_x = (_x & 0x3333333333333333) + ((_x & 0xcccccccccccccccc) >> 2);
342199767f8SToomas Soome 	_x = (_x + (_x >> 4)) & 0x0f0f0f0f0f0f0f0f;
343199767f8SToomas Soome 	_x = (_x + (_x >> 8));
344199767f8SToomas Soome 	_x = (_x + (_x >> 16));
345199767f8SToomas Soome 	_x = (_x + (_x >> 32)) & 0x000000ff;
346199767f8SToomas Soome 	return (_x);
347199767f8SToomas Soome }
348199767f8SToomas Soome 
349199767f8SToomas Soome #define	__bitcountl(x)	__bitcount64((unsigned long)(x))
350199767f8SToomas Soome #else
351199767f8SToomas Soome static __inline __uint64_t
352199767f8SToomas Soome __bitcount64(__uint64_t _x)
353199767f8SToomas Soome {
354199767f8SToomas Soome 
355199767f8SToomas Soome 	return (__bitcount32(_x >> 32) + __bitcount32(_x));
356199767f8SToomas Soome }
357199767f8SToomas Soome 
358199767f8SToomas Soome #define	__bitcountl(x)	__bitcount32((unsigned long)(x))
359199767f8SToomas Soome #endif
360199767f8SToomas Soome #define	__bitcount(x)	__bitcount32((unsigned int)(x))
361199767f8SToomas Soome #endif
362199767f8SToomas Soome 
363199767f8SToomas Soome #if __BSD_VISIBLE
364199767f8SToomas Soome 
365199767f8SToomas Soome #include <sys/select.h>
366199767f8SToomas Soome 
367199767f8SToomas Soome /*
368199767f8SToomas Soome  * minor() gives a cookie instead of an index since we don't want to
369199767f8SToomas Soome  * change the meanings of bits 0-15 or waste time and space shifting
370199767f8SToomas Soome  * bits 16-31 for devices that don't use them.
371199767f8SToomas Soome  */
372199767f8SToomas Soome #define	major(x)	((int)(((u_int)(x) >> 8)&0xff))	/* major number */
373199767f8SToomas Soome #define	minor(x)	((int)((x)&0xffff00ff))		/* minor number */
374199767f8SToomas Soome #define	makedev(x,y)	((dev_t)(((x) << 8) | (y)))	/* create dev_t */
375199767f8SToomas Soome 
376199767f8SToomas Soome /*
377199767f8SToomas Soome  * These declarations belong elsewhere, but are repeated here and in
378199767f8SToomas Soome  * <stdio.h> to give broken programs a better chance of working with
379199767f8SToomas Soome  * 64-bit off_t's.
380199767f8SToomas Soome  */
381199767f8SToomas Soome #ifndef _KERNEL
382199767f8SToomas Soome __BEGIN_DECLS
383199767f8SToomas Soome #ifndef _FTRUNCATE_DECLARED
384199767f8SToomas Soome #define	_FTRUNCATE_DECLARED
385199767f8SToomas Soome int	 ftruncate(int, off_t);
386199767f8SToomas Soome #endif
387199767f8SToomas Soome #ifndef _LSEEK_DECLARED
388199767f8SToomas Soome #define	_LSEEK_DECLARED
389199767f8SToomas Soome off_t	 lseek(int, off_t, int);
390199767f8SToomas Soome #endif
391199767f8SToomas Soome #ifndef _MMAP_DECLARED
392199767f8SToomas Soome #define	_MMAP_DECLARED
393199767f8SToomas Soome void *	 mmap(void *, size_t, int, int, int, off_t);
394199767f8SToomas Soome #endif
395199767f8SToomas Soome #ifndef _TRUNCATE_DECLARED
396199767f8SToomas Soome #define	_TRUNCATE_DECLARED
397199767f8SToomas Soome int	 truncate(const char *, off_t);
398199767f8SToomas Soome #endif
399199767f8SToomas Soome __END_DECLS
400199767f8SToomas Soome #endif /* !_KERNEL */
401199767f8SToomas Soome 
402199767f8SToomas Soome #endif /* __BSD_VISIBLE */
403199767f8SToomas Soome 
404199767f8SToomas Soome #endif /* !_SYS_TYPES_H_ */
405