xref: /illumos-gate/usr/src/uts/common/sys/types.h (revision ed093b41)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5ae115bc7Smrj  * Common Development and Distribution License (the "License").
6ae115bc7Smrj  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
22b4203d75SMarcel Telka /*	  All Rights Reserved	*/
237c478bd9Sstevel@tonic-gate 
247c478bd9Sstevel@tonic-gate 
257c478bd9Sstevel@tonic-gate /*
267f0b8309SEdward Pilatowicz  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
277c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
28b819cea2SGordon Ross  *
29b819cea2SGordon Ross  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
301f0c5e61SRobert Mustacchi  * Copyright 2016 Joyent, Inc.
31*ed093b41SRobert Mustacchi  * Copyright 2023 Oxide Computer Company
327c478bd9Sstevel@tonic-gate  */
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate #ifndef _SYS_TYPES_H
357c478bd9Sstevel@tonic-gate #define	_SYS_TYPES_H
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h>
387c478bd9Sstevel@tonic-gate #include <sys/isa_defs.h>
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate /*
417c478bd9Sstevel@tonic-gate  * Machine dependent definitions moved to <sys/machtypes.h>.
427c478bd9Sstevel@tonic-gate  */
437c478bd9Sstevel@tonic-gate #include <sys/machtypes.h>
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate /*
467c478bd9Sstevel@tonic-gate  * Include fixed width type declarations proposed by the ISO/JTC1/SC22/WG14 C
477c478bd9Sstevel@tonic-gate  * committee's working draft for the revision of the current ISO C standard,
487c478bd9Sstevel@tonic-gate  * ISO/IEC 9899:1990 Programming language - C.  These are not currently
497c478bd9Sstevel@tonic-gate  * required by any standard but constitute a useful, general purpose set
507c478bd9Sstevel@tonic-gate  * of type definitions which is namespace clean with respect to all standards.
517c478bd9Sstevel@tonic-gate  */
527c478bd9Sstevel@tonic-gate #ifdef	_KERNEL
537c478bd9Sstevel@tonic-gate #include <sys/inttypes.h>
547c478bd9Sstevel@tonic-gate #else	/* _KERNEL */
557c478bd9Sstevel@tonic-gate #include <sys/int_types.h>
567c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate #if defined(_KERNEL) || defined(_SYSCALL32)
597c478bd9Sstevel@tonic-gate #include <sys/types32.h>
607c478bd9Sstevel@tonic-gate #endif
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
637c478bd9Sstevel@tonic-gate extern "C" {
647c478bd9Sstevel@tonic-gate #endif
657c478bd9Sstevel@tonic-gate 
667c478bd9Sstevel@tonic-gate /*
677c478bd9Sstevel@tonic-gate  * Strictly conforming ANSI C environments prior to the 1999
687c478bd9Sstevel@tonic-gate  * revision of the C Standard (ISO/IEC 9899:1999) do not have
697c478bd9Sstevel@tonic-gate  * the long long data type.
707c478bd9Sstevel@tonic-gate  */
717c478bd9Sstevel@tonic-gate #if defined(_LONGLONG_TYPE)
727c478bd9Sstevel@tonic-gate typedef	long long		longlong_t;
737c478bd9Sstevel@tonic-gate typedef	unsigned long long	u_longlong_t;
747c478bd9Sstevel@tonic-gate #else
757c478bd9Sstevel@tonic-gate /* used to reserve space and generate alignment */
767c478bd9Sstevel@tonic-gate typedef union {
777c478bd9Sstevel@tonic-gate 	double	_d;
787c478bd9Sstevel@tonic-gate 	int32_t	_l[2];
797c478bd9Sstevel@tonic-gate } longlong_t;
807c478bd9Sstevel@tonic-gate typedef union {
817c478bd9Sstevel@tonic-gate 	double		_d;
827c478bd9Sstevel@tonic-gate 	uint32_t	_l[2];
837c478bd9Sstevel@tonic-gate } u_longlong_t;
847c478bd9Sstevel@tonic-gate #endif	/* defined(_LONGLONG_TYPE) */
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate /*
877c478bd9Sstevel@tonic-gate  * These types (t_{u}scalar_t) exist because the XTI/TPI/DLPI standards had
887c478bd9Sstevel@tonic-gate  * to use them instead of int32_t and uint32_t because DEC had
897c478bd9Sstevel@tonic-gate  * shipped 64-bit wide.
907c478bd9Sstevel@tonic-gate  */
917c478bd9Sstevel@tonic-gate #if defined(_LP64) || defined(_I32LPx)
927c478bd9Sstevel@tonic-gate typedef int32_t		t_scalar_t;
937c478bd9Sstevel@tonic-gate typedef uint32_t	t_uscalar_t;
947c478bd9Sstevel@tonic-gate #else
957c478bd9Sstevel@tonic-gate typedef long		t_scalar_t;	/* historical versions */
967c478bd9Sstevel@tonic-gate typedef unsigned long	t_uscalar_t;
977c478bd9Sstevel@tonic-gate #endif	/* defined(_LP64) || defined(_I32LPx) */
987c478bd9Sstevel@tonic-gate 
997c478bd9Sstevel@tonic-gate /*
1007c478bd9Sstevel@tonic-gate  * POSIX Extensions
1017c478bd9Sstevel@tonic-gate  */
1027c478bd9Sstevel@tonic-gate typedef	unsigned char	uchar_t;
1037c478bd9Sstevel@tonic-gate typedef	unsigned short	ushort_t;
1047c478bd9Sstevel@tonic-gate typedef	unsigned int	uint_t;
1057c478bd9Sstevel@tonic-gate typedef	unsigned long	ulong_t;
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate typedef	char		*caddr_t;	/* ?<core address> type */
1087c478bd9Sstevel@tonic-gate typedef	long		daddr_t;	/* <disk address> type */
1097c478bd9Sstevel@tonic-gate typedef	short		cnt_t;		/* ?<count> type */
1107c478bd9Sstevel@tonic-gate 
1117c478bd9Sstevel@tonic-gate #if !defined(_PTRDIFF_T) || __cplusplus >= 199711L
1127c478bd9Sstevel@tonic-gate #define	_PTRDIFF_T
1137c478bd9Sstevel@tonic-gate #if defined(_LP64) || defined(_I32LPx)
1147c478bd9Sstevel@tonic-gate typedef	long	ptrdiff_t;		/* pointer difference */
1157c478bd9Sstevel@tonic-gate #else
1167c478bd9Sstevel@tonic-gate typedef	int	ptrdiff_t;		/* (historical version) */
1177c478bd9Sstevel@tonic-gate #endif
1187c478bd9Sstevel@tonic-gate #endif
1197c478bd9Sstevel@tonic-gate 
1207c478bd9Sstevel@tonic-gate /*
1217c478bd9Sstevel@tonic-gate  * VM-related types
1227c478bd9Sstevel@tonic-gate  */
1237c478bd9Sstevel@tonic-gate typedef	ulong_t		pfn_t;		/* page frame number */
1247c478bd9Sstevel@tonic-gate typedef	ulong_t		pgcnt_t;	/* number of pages */
1257c478bd9Sstevel@tonic-gate typedef	long		spgcnt_t;	/* signed number of pages */
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate typedef	uchar_t		use_t;		/* use count for swap.  */
1287c478bd9Sstevel@tonic-gate typedef	short		sysid_t;
1297c478bd9Sstevel@tonic-gate typedef	short		index_t;
1307c478bd9Sstevel@tonic-gate typedef void		*timeout_id_t;	/* opaque handle from timeout(9F) */
1317c478bd9Sstevel@tonic-gate typedef void		*bufcall_id_t;	/* opaque handle from bufcall(9F) */
1327c478bd9Sstevel@tonic-gate 
1337c478bd9Sstevel@tonic-gate /*
1347c478bd9Sstevel@tonic-gate  * The size of off_t and related types depends on the setting of
1357c478bd9Sstevel@tonic-gate  * _FILE_OFFSET_BITS.  (Note that other system headers define other types
1367c478bd9Sstevel@tonic-gate  * related to those defined here.)
1377c478bd9Sstevel@tonic-gate  *
1387c478bd9Sstevel@tonic-gate  * If _LARGEFILE64_SOURCE is defined, variants of these types that are
1397c478bd9Sstevel@tonic-gate  * explicitly 64 bits wide become available.
1407c478bd9Sstevel@tonic-gate  */
1417c478bd9Sstevel@tonic-gate #ifndef _OFF_T
1427c478bd9Sstevel@tonic-gate #define	_OFF_T
1437c478bd9Sstevel@tonic-gate 
1447c478bd9Sstevel@tonic-gate #if defined(_LP64) || _FILE_OFFSET_BITS == 32
1457c478bd9Sstevel@tonic-gate typedef long		off_t;		/* offsets within files */
1467c478bd9Sstevel@tonic-gate #elif _FILE_OFFSET_BITS == 64
1477c478bd9Sstevel@tonic-gate typedef longlong_t	off_t;		/* offsets within files */
1487c478bd9Sstevel@tonic-gate #endif
1497c478bd9Sstevel@tonic-gate 
1507c478bd9Sstevel@tonic-gate #if defined(_LARGEFILE64_SOURCE)
1517c478bd9Sstevel@tonic-gate #ifdef _LP64
1527c478bd9Sstevel@tonic-gate typedef	off_t		off64_t;	/* offsets within files */
1537c478bd9Sstevel@tonic-gate #else
1547c478bd9Sstevel@tonic-gate typedef longlong_t	off64_t;	/* offsets within files */
1557c478bd9Sstevel@tonic-gate #endif
1567c478bd9Sstevel@tonic-gate #endif	/* _LARGEFILE64_SOURCE */
1577c478bd9Sstevel@tonic-gate 
1587c478bd9Sstevel@tonic-gate #endif /* _OFF_T */
1597c478bd9Sstevel@tonic-gate 
1607c478bd9Sstevel@tonic-gate #if defined(_LP64) || _FILE_OFFSET_BITS == 32
1617c478bd9Sstevel@tonic-gate typedef ulong_t		ino_t;		/* expanded inode type	*/
1627c478bd9Sstevel@tonic-gate typedef long		blkcnt_t;	/* count of file blocks */
1637c478bd9Sstevel@tonic-gate typedef ulong_t		fsblkcnt_t;	/* count of file system blocks */
1647c478bd9Sstevel@tonic-gate typedef ulong_t		fsfilcnt_t;	/* count of files */
1657c478bd9Sstevel@tonic-gate #elif _FILE_OFFSET_BITS == 64
1667c478bd9Sstevel@tonic-gate typedef u_longlong_t	ino_t;		/* expanded inode type	*/
1677c478bd9Sstevel@tonic-gate typedef longlong_t	blkcnt_t;	/* count of file blocks */
1687c478bd9Sstevel@tonic-gate typedef u_longlong_t	fsblkcnt_t;	/* count of file system blocks */
1697c478bd9Sstevel@tonic-gate typedef u_longlong_t	fsfilcnt_t;	/* count of files */
1707c478bd9Sstevel@tonic-gate #endif
1717c478bd9Sstevel@tonic-gate 
1727c478bd9Sstevel@tonic-gate #if defined(_LARGEFILE64_SOURCE)
1737c478bd9Sstevel@tonic-gate #ifdef _LP64
1747c478bd9Sstevel@tonic-gate typedef	ino_t		ino64_t;	/* expanded inode type */
1757c478bd9Sstevel@tonic-gate typedef	blkcnt_t	blkcnt64_t;	/* count of file blocks */
1767c478bd9Sstevel@tonic-gate typedef	fsblkcnt_t	fsblkcnt64_t;	/* count of file system blocks */
1777c478bd9Sstevel@tonic-gate typedef	fsfilcnt_t	fsfilcnt64_t;	/* count of files */
1787c478bd9Sstevel@tonic-gate #else
1797c478bd9Sstevel@tonic-gate typedef u_longlong_t	ino64_t;	/* expanded inode type	*/
1807c478bd9Sstevel@tonic-gate typedef longlong_t	blkcnt64_t;	/* count of file blocks */
1817c478bd9Sstevel@tonic-gate typedef u_longlong_t	fsblkcnt64_t;	/* count of file system blocks */
1827c478bd9Sstevel@tonic-gate typedef u_longlong_t	fsfilcnt64_t;	/* count of files */
1837c478bd9Sstevel@tonic-gate #endif
1847c478bd9Sstevel@tonic-gate #endif	/* _LARGEFILE64_SOURCE */
1857c478bd9Sstevel@tonic-gate 
1867c478bd9Sstevel@tonic-gate #ifdef _LP64
1877c478bd9Sstevel@tonic-gate typedef	int		blksize_t;	/* used for block sizes */
1887c478bd9Sstevel@tonic-gate #else
1897c478bd9Sstevel@tonic-gate typedef	long		blksize_t;	/* used for block sizes */
1907c478bd9Sstevel@tonic-gate #endif
1917c478bd9Sstevel@tonic-gate 
192eb96f8f7SRobert Mustacchi /*
193eb96f8f7SRobert Mustacchi  * The boolean_t type has had a varied amount of exposure over the years in
194eb96f8f7SRobert Mustacchi  * terms of how its enumeration constants have been exposed. In particular, it
195eb96f8f7SRobert Mustacchi  * originally used the __XOPEN_OR_POSIX macro to determine whether to prefix the
196eb96f8f7SRobert Mustacchi  * B_TRUE and B_FALSE with an underscore. This check never included the
197eb96f8f7SRobert Mustacchi  * question of if we were in a strict ANSI C environment or whether extensions
198eb96f8f7SRobert Mustacchi  * were defined.
199eb96f8f7SRobert Mustacchi  *
200eb96f8f7SRobert Mustacchi  * Compilers such as clang started defaulting to always including an
201eb96f8f7SRobert Mustacchi  * XOPEN_SOURCE declaration on behalf of users, but also noted __EXTENSIONS__.
202eb96f8f7SRobert Mustacchi  * This would lead most software that had used the non-underscore versions to
203eb96f8f7SRobert Mustacchi  * need it. As such, we have adjusted the non-strict XOPEN environment to retain
204eb96f8f7SRobert Mustacchi  * its old behavior so as to minimize namespace pollution; however, we instead
205eb96f8f7SRobert Mustacchi  * include both variants of the definitions in the generally visible version
206eb96f8f7SRobert Mustacchi  * allowing software written in either world to hopefully end up in a good
207eb96f8f7SRobert Mustacchi  * place.
208eb96f8f7SRobert Mustacchi  *
209eb96f8f7SRobert Mustacchi  * This isn't perfect, but should hopefully minimize the pain for folks actually
210eb96f8f7SRobert Mustacchi  * trying to build software.
211eb96f8f7SRobert Mustacchi  */
212eb96f8f7SRobert Mustacchi #if defined(__XOPEN_OR_POSIX) && !defined(__EXTENSIONS__)
2137c478bd9Sstevel@tonic-gate typedef enum { _B_FALSE, _B_TRUE } boolean_t;
2147c478bd9Sstevel@tonic-gate #else
215eb96f8f7SRobert Mustacchi typedef enum { B_FALSE = 0, B_TRUE = 1, _B_FALSE = 0, _B_TRUE = 1 } boolean_t;
216eb96f8f7SRobert Mustacchi #endif /* __XOPEN_OR_POSIX && !__EXTENSIONS__ */
217eb96f8f7SRobert Mustacchi 
2187f0b8309SEdward Pilatowicz #ifdef _KERNEL
2197f0b8309SEdward Pilatowicz #define	VALID_BOOLEAN(x)	(((x) == B_FALSE) || ((x) == B_TRUE))
2207f0b8309SEdward Pilatowicz #define	VOID2BOOLEAN(x)		(((uintptr_t)(x) == 0) ? B_FALSE : B_TRUE)
2217f0b8309SEdward Pilatowicz #endif /* _KERNEL */
2227c478bd9Sstevel@tonic-gate 
2237f0b8309SEdward Pilatowicz #ifdef _KERNEL
2247f0b8309SEdward Pilatowicz #define	BOOLEAN2VOID(x)		((x) ? 1 : 0)
2257f0b8309SEdward Pilatowicz #endif /* _KERNEL */
2267f0b8309SEdward Pilatowicz 
2277c478bd9Sstevel@tonic-gate /*
2287c478bd9Sstevel@tonic-gate  * The {u,}pad64_t types can be used in structures such that those structures
2297c478bd9Sstevel@tonic-gate  * may be accessed by code produced by compilation environments which don't
2307c478bd9Sstevel@tonic-gate  * support a 64 bit integral datatype.  The intention is not to allow
2317c478bd9Sstevel@tonic-gate  * use of these fields in such environments, but to maintain the alignment
2327c478bd9Sstevel@tonic-gate  * and offsets of the structure.
2337c478bd9Sstevel@tonic-gate  *
2347c478bd9Sstevel@tonic-gate  * Similar comments for {u,}pad128_t.
2357c478bd9Sstevel@tonic-gate  *
2367c478bd9Sstevel@tonic-gate  * Note that these types do NOT generate any stronger alignment constraints
2377c478bd9Sstevel@tonic-gate  * than those available in the underlying ABI.  See <sys/isa_defs.h>
2387c478bd9Sstevel@tonic-gate  */
2397c478bd9Sstevel@tonic-gate #if defined(_INT64_TYPE)
2407c478bd9Sstevel@tonic-gate typedef int64_t		pad64_t;
2417c478bd9Sstevel@tonic-gate typedef	uint64_t	upad64_t;
2427c478bd9Sstevel@tonic-gate #else
2437c478bd9Sstevel@tonic-gate typedef union {
2447c478bd9Sstevel@tonic-gate 	double   _d;
2457c478bd9Sstevel@tonic-gate 	int32_t  _l[2];
2467c478bd9Sstevel@tonic-gate } pad64_t;
2477c478bd9Sstevel@tonic-gate 
2487c478bd9Sstevel@tonic-gate typedef union {
2497c478bd9Sstevel@tonic-gate 	double   _d;
2507c478bd9Sstevel@tonic-gate 	uint32_t _l[2];
2517c478bd9Sstevel@tonic-gate } upad64_t;
2527c478bd9Sstevel@tonic-gate #endif
2537c478bd9Sstevel@tonic-gate 
2547c478bd9Sstevel@tonic-gate typedef union {
2557c478bd9Sstevel@tonic-gate 	long double	_q;
2567c478bd9Sstevel@tonic-gate 	int32_t		_l[4];
2577c478bd9Sstevel@tonic-gate } pad128_t;
2587c478bd9Sstevel@tonic-gate 
2597c478bd9Sstevel@tonic-gate typedef union {
2607c478bd9Sstevel@tonic-gate 	long double	_q;
2617c478bd9Sstevel@tonic-gate 	uint32_t	_l[4];
2627c478bd9Sstevel@tonic-gate } upad128_t;
2637c478bd9Sstevel@tonic-gate 
264*ed093b41SRobert Mustacchi typedef union {
265*ed093b41SRobert Mustacchi 	long double	_q[2];
266*ed093b41SRobert Mustacchi 	uint32_t	_l[8];
267*ed093b41SRobert Mustacchi } upad256_t;
268*ed093b41SRobert Mustacchi 
269*ed093b41SRobert Mustacchi typedef union {
270*ed093b41SRobert Mustacchi 	long double	_q[4];
271*ed093b41SRobert Mustacchi 	uint32_t	_l[16];
272*ed093b41SRobert Mustacchi } upad512_t;
273*ed093b41SRobert Mustacchi 
2747c478bd9Sstevel@tonic-gate typedef	longlong_t	offset_t;
2757c478bd9Sstevel@tonic-gate typedef	u_longlong_t	u_offset_t;
2767c478bd9Sstevel@tonic-gate typedef u_longlong_t	len_t;
2777c478bd9Sstevel@tonic-gate typedef	u_longlong_t	diskaddr_t;
278ae115bc7Smrj #if (defined(_KERNEL) || defined(_KMEMUSER) || defined(_BOOT))
2797c478bd9Sstevel@tonic-gate typedef	uint64_t	paddr_t;
2807c478bd9Sstevel@tonic-gate #endif
2817c478bd9Sstevel@tonic-gate 
2827c478bd9Sstevel@tonic-gate /*
2837c478bd9Sstevel@tonic-gate  * Definitions remaining from previous partial support for 64-bit file
2847c478bd9Sstevel@tonic-gate  * offsets.  This partial support for devices greater than 2gb requires
2857c478bd9Sstevel@tonic-gate  * compiler support for long long.
2867c478bd9Sstevel@tonic-gate  */
2877c478bd9Sstevel@tonic-gate #ifdef _LONG_LONG_LTOH
2887c478bd9Sstevel@tonic-gate typedef union {
2897c478bd9Sstevel@tonic-gate 	offset_t	_f;	/* Full 64 bit offset value */
2907c478bd9Sstevel@tonic-gate 	struct {
2917c478bd9Sstevel@tonic-gate 		int32_t	_l;	/* lower 32 bits of offset value */
2927c478bd9Sstevel@tonic-gate 		int32_t	_u;	/* upper 32 bits of offset value */
2937c478bd9Sstevel@tonic-gate 	} _p;
2947c478bd9Sstevel@tonic-gate } lloff_t;
2957c478bd9Sstevel@tonic-gate #endif
2967c478bd9Sstevel@tonic-gate 
2977c478bd9Sstevel@tonic-gate #ifdef _LONG_LONG_HTOL
2987c478bd9Sstevel@tonic-gate typedef union {
2997c478bd9Sstevel@tonic-gate 	offset_t	_f;	/* Full 64 bit offset value */
3007c478bd9Sstevel@tonic-gate 	struct {
3017c478bd9Sstevel@tonic-gate 		int32_t	_u;	/* upper 32 bits of offset value */
3027c478bd9Sstevel@tonic-gate 		int32_t	_l;	/* lower 32 bits of offset value */
3037c478bd9Sstevel@tonic-gate 	} _p;
3047c478bd9Sstevel@tonic-gate } lloff_t;
3057c478bd9Sstevel@tonic-gate #endif
3067c478bd9Sstevel@tonic-gate 
3077c478bd9Sstevel@tonic-gate #ifdef _LONG_LONG_LTOH
3087c478bd9Sstevel@tonic-gate typedef union {
3097c478bd9Sstevel@tonic-gate 	longlong_t	_f;	/* Full 64 bit disk address value */
3107c478bd9Sstevel@tonic-gate 	struct {
3117c478bd9Sstevel@tonic-gate 		int32_t	_l;	/* lower 32 bits of disk address value */
3127c478bd9Sstevel@tonic-gate 		int32_t	_u;	/* upper 32 bits of disk address value */
3137c478bd9Sstevel@tonic-gate 	} _p;
3147c478bd9Sstevel@tonic-gate } lldaddr_t;
3157c478bd9Sstevel@tonic-gate #endif
3167c478bd9Sstevel@tonic-gate 
3177c478bd9Sstevel@tonic-gate #ifdef _LONG_LONG_HTOL
3187c478bd9Sstevel@tonic-gate typedef union {
3197c478bd9Sstevel@tonic-gate 	longlong_t	_f;	/* Full 64 bit disk address value */
3207c478bd9Sstevel@tonic-gate 	struct {
3217c478bd9Sstevel@tonic-gate 		int32_t	_u;	/* upper 32 bits of disk address value */
3227c478bd9Sstevel@tonic-gate 		int32_t	_l;	/* lower 32 bits of disk address value */
3237c478bd9Sstevel@tonic-gate 	} _p;
3247c478bd9Sstevel@tonic-gate } lldaddr_t;
3257c478bd9Sstevel@tonic-gate #endif
3267c478bd9Sstevel@tonic-gate 
3277c478bd9Sstevel@tonic-gate typedef uint_t k_fltset_t;	/* kernel fault set type */
3287c478bd9Sstevel@tonic-gate 
3297c478bd9Sstevel@tonic-gate /*
3307c478bd9Sstevel@tonic-gate  * The following type is for various kinds of identifiers.  The
3317c478bd9Sstevel@tonic-gate  * actual type must be the same for all since some system calls
3327c478bd9Sstevel@tonic-gate  * (such as sigsend) take arguments that may be any of these
3337c478bd9Sstevel@tonic-gate  * types.  The enumeration type idtype_t defined in sys/procset.h
3347c478bd9Sstevel@tonic-gate  * is used to indicate what type of id is being specified --
3357c478bd9Sstevel@tonic-gate  * a process id, process group id, session id, scheduling class id,
3367c478bd9Sstevel@tonic-gate  * user id, group id, project id, task id or zone id.
3377c478bd9Sstevel@tonic-gate  */
3387c478bd9Sstevel@tonic-gate #if defined(_LP64) || defined(_I32LPx)
3397c478bd9Sstevel@tonic-gate typedef int		id_t;
3407c478bd9Sstevel@tonic-gate #else
3417c478bd9Sstevel@tonic-gate typedef	long		id_t;		/* (historical version) */
3427c478bd9Sstevel@tonic-gate #endif
3437c478bd9Sstevel@tonic-gate 
3442cb27123Saguzovsk typedef id_t		lgrp_id_t;	/* lgroup ID */
3452cb27123Saguzovsk 
3467c478bd9Sstevel@tonic-gate /*
3477c478bd9Sstevel@tonic-gate  * Type useconds_t is an unsigned integral type capable of storing
3487c478bd9Sstevel@tonic-gate  * values at least in the range of zero to 1,000,000.
3497c478bd9Sstevel@tonic-gate  */
3507c478bd9Sstevel@tonic-gate typedef uint_t		useconds_t;	/* Time, in microseconds */
3517c478bd9Sstevel@tonic-gate 
3527c478bd9Sstevel@tonic-gate #ifndef	_SUSECONDS_T
3537c478bd9Sstevel@tonic-gate #define	_SUSECONDS_T
3547c478bd9Sstevel@tonic-gate typedef long	suseconds_t;	/* signed # of microseconds */
3557c478bd9Sstevel@tonic-gate #endif	/* _SUSECONDS_T */
3567c478bd9Sstevel@tonic-gate 
3577c478bd9Sstevel@tonic-gate /*
3587c478bd9Sstevel@tonic-gate  * Typedefs for dev_t components.
3597c478bd9Sstevel@tonic-gate  */
3607c478bd9Sstevel@tonic-gate #if defined(_LP64) || defined(_I32LPx)
3617c478bd9Sstevel@tonic-gate typedef uint_t	major_t;	/* major part of device number */
3627c478bd9Sstevel@tonic-gate typedef uint_t	minor_t;	/* minor part of device number */
3637c478bd9Sstevel@tonic-gate #else
3647c478bd9Sstevel@tonic-gate typedef ulong_t	major_t;	/* (historical version) */
3657c478bd9Sstevel@tonic-gate typedef ulong_t	minor_t;	/* (historical version) */
3667c478bd9Sstevel@tonic-gate #endif
3677c478bd9Sstevel@tonic-gate 
3687c478bd9Sstevel@tonic-gate /*
3697c478bd9Sstevel@tonic-gate  * The data type of a thread priority.
3707c478bd9Sstevel@tonic-gate  */
3717c478bd9Sstevel@tonic-gate typedef short	pri_t;
3727c478bd9Sstevel@tonic-gate 
3737c478bd9Sstevel@tonic-gate /*
3747c478bd9Sstevel@tonic-gate  * The data type for a CPU flags field.  (Can be extended to larger unsigned
3757c478bd9Sstevel@tonic-gate  * types, if needed, limited by ability to update atomically.)
3767c478bd9Sstevel@tonic-gate  */
3777c478bd9Sstevel@tonic-gate typedef ushort_t	cpu_flag_t;
3787c478bd9Sstevel@tonic-gate 
3797c478bd9Sstevel@tonic-gate /*
3807c478bd9Sstevel@tonic-gate  * For compatibility reasons the following typedefs (prefixed o_)
3817c478bd9Sstevel@tonic-gate  * can't grow regardless of the EFT definition. Although,
3827c478bd9Sstevel@tonic-gate  * applications should not explicitly use these typedefs
3837c478bd9Sstevel@tonic-gate  * they may be included via a system header definition.
3847c478bd9Sstevel@tonic-gate  * WARNING: These typedefs may be removed in a future
3857c478bd9Sstevel@tonic-gate  * release.
3867c478bd9Sstevel@tonic-gate  *		ex. the definitions in s5inode.h (now obsoleted)
3877c478bd9Sstevel@tonic-gate  *			remained small to preserve compatibility
3887c478bd9Sstevel@tonic-gate  *			in the S5 file system type.
3897c478bd9Sstevel@tonic-gate  */
3907c478bd9Sstevel@tonic-gate typedef	ushort_t o_mode_t;		/* old file attribute type */
3917c478bd9Sstevel@tonic-gate typedef short	o_dev_t;		/* old device type	*/
3927c478bd9Sstevel@tonic-gate typedef	ushort_t o_uid_t;		/* old UID type		*/
3937c478bd9Sstevel@tonic-gate typedef	o_uid_t	o_gid_t;		/* old GID type		*/
3947c478bd9Sstevel@tonic-gate typedef	short	o_nlink_t;		/* old file link type	*/
3957c478bd9Sstevel@tonic-gate typedef short	o_pid_t;		/* old process id type	*/
3967c478bd9Sstevel@tonic-gate typedef ushort_t o_ino_t;		/* old inode type	*/
3977c478bd9Sstevel@tonic-gate 
3987c478bd9Sstevel@tonic-gate 
3997c478bd9Sstevel@tonic-gate /*
4007c478bd9Sstevel@tonic-gate  * POSIX and XOPEN Declarations
4017c478bd9Sstevel@tonic-gate  */
4027c478bd9Sstevel@tonic-gate typedef	int	key_t;			/* IPC key type		*/
4037c478bd9Sstevel@tonic-gate #if defined(_LP64) || defined(_I32LPx)
4047c478bd9Sstevel@tonic-gate typedef	uint_t	mode_t;			/* file attribute type	*/
4057c478bd9Sstevel@tonic-gate #else
4067c478bd9Sstevel@tonic-gate typedef	ulong_t	mode_t;			/* (historical version) */
4077c478bd9Sstevel@tonic-gate #endif
4087c478bd9Sstevel@tonic-gate 
4097c478bd9Sstevel@tonic-gate #ifndef	_UID_T
4107c478bd9Sstevel@tonic-gate #define	_UID_T
411f48205beScasper typedef	unsigned int uid_t;		/* UID type		*/
4127c478bd9Sstevel@tonic-gate #endif	/* _UID_T */
4137c478bd9Sstevel@tonic-gate 
4147c478bd9Sstevel@tonic-gate typedef	uid_t	gid_t;			/* GID type		*/
4157c478bd9Sstevel@tonic-gate 
416b6b50fcfSNitin Hande typedef uint32_t	datalink_id_t;
4171cb875aeSCathy Zhou typedef	uint32_t	vrid_t;
418b6b50fcfSNitin Hande 
4197c478bd9Sstevel@tonic-gate typedef id_t    taskid_t;
4207c478bd9Sstevel@tonic-gate typedef id_t    projid_t;
4217c478bd9Sstevel@tonic-gate typedef	id_t	poolid_t;
4227c478bd9Sstevel@tonic-gate typedef id_t	zoneid_t;
4237c478bd9Sstevel@tonic-gate typedef id_t	ctid_t;
4247c478bd9Sstevel@tonic-gate 
4257c478bd9Sstevel@tonic-gate /*
4267c478bd9Sstevel@tonic-gate  * POSIX definitions are same as defined in thread.h and synch.h.
4277c478bd9Sstevel@tonic-gate  * Any changes made to here should be reflected in corresponding
4287c478bd9Sstevel@tonic-gate  * files as described in comments.
4297c478bd9Sstevel@tonic-gate  */
4307c478bd9Sstevel@tonic-gate typedef	uint_t	pthread_t;	/* = thread_t in thread.h */
4317c478bd9Sstevel@tonic-gate typedef	uint_t	pthread_key_t;	/* = thread_key_t in thread.h */
4327c478bd9Sstevel@tonic-gate 
4337c478bd9Sstevel@tonic-gate /* "Magic numbers" tagging synchronization object types */
4347c478bd9Sstevel@tonic-gate #define	_MUTEX_MAGIC	0x4d58		/* "MX" */
4357c478bd9Sstevel@tonic-gate #define	_SEMA_MAGIC	0x534d		/* "SM" */
4367c478bd9Sstevel@tonic-gate #define	_COND_MAGIC	0x4356		/* "CV" */
4377c478bd9Sstevel@tonic-gate #define	_RWL_MAGIC	0x5257		/* "RW" */
4387c478bd9Sstevel@tonic-gate 
4397c478bd9Sstevel@tonic-gate typedef	struct _pthread_mutex {		/* = mutex_t in synch.h */
4407c478bd9Sstevel@tonic-gate 	struct {
4417c478bd9Sstevel@tonic-gate 		uint16_t	__pthread_mutex_flag1;
4427c478bd9Sstevel@tonic-gate 		uint8_t		__pthread_mutex_flag2;
4437c478bd9Sstevel@tonic-gate 		uint8_t		__pthread_mutex_ceiling;
444eb96f8f7SRobert Mustacchi 		uint16_t	__pthread_mutex_type;
445eb96f8f7SRobert Mustacchi 		uint16_t	__pthread_mutex_magic;
4467c478bd9Sstevel@tonic-gate 	} __pthread_mutex_flags;
4477c478bd9Sstevel@tonic-gate 	union {
4487c478bd9Sstevel@tonic-gate 		struct {
4497c478bd9Sstevel@tonic-gate 			uint8_t	__pthread_mutex_pad[8];
4507c478bd9Sstevel@tonic-gate 		} __pthread_mutex_lock64;
4517c478bd9Sstevel@tonic-gate 		struct {
4527c478bd9Sstevel@tonic-gate 			uint32_t __pthread_ownerpid;
4537c478bd9Sstevel@tonic-gate 			uint32_t __pthread_lockword;
4547c478bd9Sstevel@tonic-gate 		} __pthread_mutex_lock32;
4557c478bd9Sstevel@tonic-gate 		upad64_t __pthread_mutex_owner64;
4567c478bd9Sstevel@tonic-gate 	} __pthread_mutex_lock;
4577c478bd9Sstevel@tonic-gate 	upad64_t __pthread_mutex_data;
4587c478bd9Sstevel@tonic-gate } pthread_mutex_t;
4597c478bd9Sstevel@tonic-gate 
4607c478bd9Sstevel@tonic-gate typedef	struct _pthread_cond {		/* = cond_t in synch.h */
4617c478bd9Sstevel@tonic-gate 	struct {
4627c478bd9Sstevel@tonic-gate 		uint8_t		__pthread_cond_flag[4];
463eb96f8f7SRobert Mustacchi 		uint16_t	__pthread_cond_type;
464eb96f8f7SRobert Mustacchi 		uint16_t	__pthread_cond_magic;
4657c478bd9Sstevel@tonic-gate 	} __pthread_cond_flags;
4667c478bd9Sstevel@tonic-gate 	upad64_t __pthread_cond_data;
4677c478bd9Sstevel@tonic-gate } pthread_cond_t;
4687c478bd9Sstevel@tonic-gate 
4697c478bd9Sstevel@tonic-gate /*
4707c478bd9Sstevel@tonic-gate  * UNIX 98 Extension
4717c478bd9Sstevel@tonic-gate  */
4727c478bd9Sstevel@tonic-gate typedef	struct _pthread_rwlock {	/* = rwlock_t in synch.h */
4737c478bd9Sstevel@tonic-gate 	int32_t		__pthread_rwlock_readers;
4747c478bd9Sstevel@tonic-gate 	uint16_t	__pthread_rwlock_type;
4757c478bd9Sstevel@tonic-gate 	uint16_t	__pthread_rwlock_magic;
4767c478bd9Sstevel@tonic-gate 	pthread_mutex_t	__pthread_rwlock_mutex;
4777c478bd9Sstevel@tonic-gate 	pthread_cond_t	__pthread_rwlock_readercv;
4787c478bd9Sstevel@tonic-gate 	pthread_cond_t	__pthread_rwlock_writercv;
4797c478bd9Sstevel@tonic-gate } pthread_rwlock_t;
4807c478bd9Sstevel@tonic-gate 
4817c478bd9Sstevel@tonic-gate /*
4827c478bd9Sstevel@tonic-gate  * SUSV3
4837c478bd9Sstevel@tonic-gate  */
4847c478bd9Sstevel@tonic-gate typedef struct {
4857c478bd9Sstevel@tonic-gate 	uint32_t	__pthread_barrier_count;
4867c478bd9Sstevel@tonic-gate 	uint32_t	__pthread_barrier_current;
4877c478bd9Sstevel@tonic-gate 	upad64_t	__pthread_barrier_cycle;
4887c478bd9Sstevel@tonic-gate 	upad64_t	__pthread_barrier_reserved;
4897c478bd9Sstevel@tonic-gate 	pthread_mutex_t	__pthread_barrier_lock;
4907c478bd9Sstevel@tonic-gate 	pthread_cond_t	__pthread_barrier_cond;
4917c478bd9Sstevel@tonic-gate } pthread_barrier_t;
4927c478bd9Sstevel@tonic-gate 
4937c478bd9Sstevel@tonic-gate typedef	pthread_mutex_t	pthread_spinlock_t;
4947c478bd9Sstevel@tonic-gate 
4957c478bd9Sstevel@tonic-gate /*
4967c478bd9Sstevel@tonic-gate  * attributes for threads, dynamically allocated by library
4977c478bd9Sstevel@tonic-gate  */
4987c478bd9Sstevel@tonic-gate typedef struct _pthread_attr {
4997c478bd9Sstevel@tonic-gate 	void	*__pthread_attrp;
5007c478bd9Sstevel@tonic-gate } pthread_attr_t;
5017c478bd9Sstevel@tonic-gate 
5027c478bd9Sstevel@tonic-gate /*
5037c478bd9Sstevel@tonic-gate  * attributes for mutex, dynamically allocated by library
5047c478bd9Sstevel@tonic-gate  */
5057c478bd9Sstevel@tonic-gate typedef struct _pthread_mutexattr {
5067c478bd9Sstevel@tonic-gate 	void	*__pthread_mutexattrp;
5077c478bd9Sstevel@tonic-gate } pthread_mutexattr_t;
5087c478bd9Sstevel@tonic-gate 
5097c478bd9Sstevel@tonic-gate /*
5107c478bd9Sstevel@tonic-gate  * attributes for cond, dynamically allocated by library
5117c478bd9Sstevel@tonic-gate  */
5127c478bd9Sstevel@tonic-gate typedef struct _pthread_condattr {
5137c478bd9Sstevel@tonic-gate 	void	*__pthread_condattrp;
5147c478bd9Sstevel@tonic-gate } pthread_condattr_t;
5157c478bd9Sstevel@tonic-gate 
5167c478bd9Sstevel@tonic-gate /*
5177c478bd9Sstevel@tonic-gate  * pthread_once
5187c478bd9Sstevel@tonic-gate  */
5197c478bd9Sstevel@tonic-gate typedef	struct _once {
5207c478bd9Sstevel@tonic-gate 	upad64_t	__pthread_once_pad[4];
5217c478bd9Sstevel@tonic-gate } pthread_once_t;
5227c478bd9Sstevel@tonic-gate 
5237c478bd9Sstevel@tonic-gate /*
5247c478bd9Sstevel@tonic-gate  * UNIX 98 Extensions
5257c478bd9Sstevel@tonic-gate  * attributes for rwlock, dynamically allocated by library
5267c478bd9Sstevel@tonic-gate  */
5277c478bd9Sstevel@tonic-gate typedef struct _pthread_rwlockattr {
5287c478bd9Sstevel@tonic-gate 	void	*__pthread_rwlockattrp;
5297c478bd9Sstevel@tonic-gate } pthread_rwlockattr_t;
5307c478bd9Sstevel@tonic-gate 
5317c478bd9Sstevel@tonic-gate /*
5327c478bd9Sstevel@tonic-gate  * SUSV3
5337c478bd9Sstevel@tonic-gate  * attributes for pthread_barrier_t, dynamically allocated by library
5347c478bd9Sstevel@tonic-gate  */
5357c478bd9Sstevel@tonic-gate typedef struct {
5367c478bd9Sstevel@tonic-gate 	void	*__pthread_barrierattrp;
5377c478bd9Sstevel@tonic-gate } pthread_barrierattr_t;
5387c478bd9Sstevel@tonic-gate 
5397c478bd9Sstevel@tonic-gate typedef ulong_t	dev_t;			/* expanded device type */
5407c478bd9Sstevel@tonic-gate 
5417c478bd9Sstevel@tonic-gate #if defined(_LP64) || defined(_I32LPx)
5427c478bd9Sstevel@tonic-gate typedef	uint_t nlink_t;			/* file link type	*/
5437c478bd9Sstevel@tonic-gate typedef int	pid_t;			/* process id type	*/
5447c478bd9Sstevel@tonic-gate #else
5457c478bd9Sstevel@tonic-gate typedef	ulong_t	nlink_t;		/* (historical version) */
5467c478bd9Sstevel@tonic-gate typedef	long	pid_t;			/* (historical version) */
5477c478bd9Sstevel@tonic-gate #endif
5487c478bd9Sstevel@tonic-gate 
5497c478bd9Sstevel@tonic-gate #if !defined(_SIZE_T) || __cplusplus >= 199711L
5507c478bd9Sstevel@tonic-gate #define	_SIZE_T
5517c478bd9Sstevel@tonic-gate #if defined(_LP64) || defined(_I32LPx)
5527c478bd9Sstevel@tonic-gate typedef	ulong_t	size_t;		/* size of something in bytes */
5537c478bd9Sstevel@tonic-gate #else
5547c478bd9Sstevel@tonic-gate typedef	uint_t	size_t;		/* (historical version) */
5557c478bd9Sstevel@tonic-gate #endif
5567c478bd9Sstevel@tonic-gate #endif	/* _SIZE_T */
5577c478bd9Sstevel@tonic-gate 
5587c478bd9Sstevel@tonic-gate #ifndef _SSIZE_T
5597c478bd9Sstevel@tonic-gate #define	_SSIZE_T
5607c478bd9Sstevel@tonic-gate #if defined(_LP64) || defined(_I32LPx)
5617c478bd9Sstevel@tonic-gate typedef long	ssize_t;	/* size of something in bytes or -1 */
5627c478bd9Sstevel@tonic-gate #else
5637c478bd9Sstevel@tonic-gate typedef int	ssize_t;	/* (historical version) */
5647c478bd9Sstevel@tonic-gate #endif
5657c478bd9Sstevel@tonic-gate #endif	/* _SSIZE_T */
5667c478bd9Sstevel@tonic-gate 
5677c478bd9Sstevel@tonic-gate #if !defined(_TIME_T) || __cplusplus >= 199711L
5687c478bd9Sstevel@tonic-gate #define	_TIME_T
5697c478bd9Sstevel@tonic-gate typedef	long		time_t;	/* time of day in seconds */
5707c478bd9Sstevel@tonic-gate #endif	/* _TIME_T */
5717c478bd9Sstevel@tonic-gate 
5727c478bd9Sstevel@tonic-gate #if !defined(_CLOCK_T) || __cplusplus >= 199711L
5737c478bd9Sstevel@tonic-gate #define	_CLOCK_T
5747c478bd9Sstevel@tonic-gate typedef	long		clock_t; /* relative time in a specified resolution */
5757c478bd9Sstevel@tonic-gate #endif	/* ifndef _CLOCK_T */
5767c478bd9Sstevel@tonic-gate 
5777c478bd9Sstevel@tonic-gate #ifndef _CLOCKID_T
5787c478bd9Sstevel@tonic-gate #define	_CLOCKID_T
5797c478bd9Sstevel@tonic-gate typedef	int	clockid_t;	/* clock identifier type */
5807c478bd9Sstevel@tonic-gate #endif	/* ifndef _CLOCKID_T */
5817c478bd9Sstevel@tonic-gate 
5827c478bd9Sstevel@tonic-gate #ifndef _TIMER_T
5837c478bd9Sstevel@tonic-gate #define	_TIMER_T
5847c478bd9Sstevel@tonic-gate typedef	int	timer_t;	/* timer identifier type */
5857c478bd9Sstevel@tonic-gate #endif	/* ifndef _TIMER_T */
5867c478bd9Sstevel@tonic-gate 
5877c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
5887c478bd9Sstevel@tonic-gate 
5897c478bd9Sstevel@tonic-gate /* BEGIN CSTYLED */
5907c478bd9Sstevel@tonic-gate typedef	unsigned char	unchar;
5917c478bd9Sstevel@tonic-gate typedef	unsigned short	ushort;
5927c478bd9Sstevel@tonic-gate typedef	unsigned int	uint;
5937c478bd9Sstevel@tonic-gate typedef	unsigned long	ulong;
5947c478bd9Sstevel@tonic-gate /* END CSTYLED */
5957c478bd9Sstevel@tonic-gate 
596b819cea2SGordon Ross #if defined(_KERNEL) || defined(_FAKE_KERNEL)
5977c478bd9Sstevel@tonic-gate 
5987c478bd9Sstevel@tonic-gate #define	SHRT_MIN	(-32768)	/* min value of a "short int" */
5997c478bd9Sstevel@tonic-gate #define	SHRT_MAX	32767		/* max value of a "short int" */
6007c478bd9Sstevel@tonic-gate #define	USHRT_MAX	65535		/* max of "unsigned short int" */
6017c478bd9Sstevel@tonic-gate #define	INT_MIN		(-2147483647-1) /* min value of an "int" */
6027c478bd9Sstevel@tonic-gate #define	INT_MAX		2147483647	/* max value of an "int" */
6037c478bd9Sstevel@tonic-gate #define	UINT_MAX	4294967295U	/* max value of an "unsigned int" */
6047c478bd9Sstevel@tonic-gate #if defined(_LP64)
6057c478bd9Sstevel@tonic-gate #define	LONG_MIN	(-9223372036854775807L-1L)
6067c478bd9Sstevel@tonic-gate 					/* min value of a "long int" */
6077c478bd9Sstevel@tonic-gate #define	LONG_MAX	9223372036854775807L
6087c478bd9Sstevel@tonic-gate 					/* max value of a "long int" */
6097c478bd9Sstevel@tonic-gate #define	ULONG_MAX	18446744073709551615UL
6107c478bd9Sstevel@tonic-gate 					/* max of "unsigned long int" */
6117c478bd9Sstevel@tonic-gate #else /* _ILP32 */
6127c478bd9Sstevel@tonic-gate #define	LONG_MIN	(-2147483647L-1L)
6137c478bd9Sstevel@tonic-gate 					/* min value of a "long int" */
6147c478bd9Sstevel@tonic-gate #define	LONG_MAX	2147483647L	/* max value of a "long int" */
6157c478bd9Sstevel@tonic-gate #define	ULONG_MAX	4294967295UL	/* max of "unsigned long int" */
6167c478bd9Sstevel@tonic-gate #endif
6177c478bd9Sstevel@tonic-gate 
6182ef9abdcSjv #define	LLONG_MIN	(-9223372036854775807LL-1LL)
6192ef9abdcSjv 					/* min of "long long int" */
6202ef9abdcSjv #define	LLONG_MAX	9223372036854775807LL
6212ef9abdcSjv 					/* max of "long long int" */
6222ef9abdcSjv #define	ULLONG_MAX	18446744073709551615ULL
6232ef9abdcSjv 					/* max of "unsigned long long int" */
6242ef9abdcSjv 
6251f0c5e61SRobert Mustacchi #if defined(_LP64) || _FILE_OFFSET_BITS == 32
6261f0c5e61SRobert Mustacchi #define	OFF_MIN		LONG_MIN
6271f0c5e61SRobert Mustacchi #define	OFF_MAX		LONG_MAX
6281f0c5e61SRobert Mustacchi #elif _FILE_OFFSET_BITS == 64
6291f0c5e61SRobert Mustacchi #define	OFF_MIN		LLONG_MIN
6301f0c5e61SRobert Mustacchi #define	OFF_MAX		LLONG_MAX
6311f0c5e61SRobert Mustacchi #endif	/* _LP64 || _FILE_OFFSET_BITS == 32 */
6321f0c5e61SRobert Mustacchi 
6337c478bd9Sstevel@tonic-gate #endif	/* defined(_KERNEL) */
6347c478bd9Sstevel@tonic-gate 
6357c478bd9Sstevel@tonic-gate #define	P_MYPID	((pid_t)0)
6367c478bd9Sstevel@tonic-gate 
6377c478bd9Sstevel@tonic-gate /*
6387c478bd9Sstevel@tonic-gate  * The following is the value of type id_t to use to indicate the
6397c478bd9Sstevel@tonic-gate  * caller's current id.  See procset.h for the type idtype_t
6407c478bd9Sstevel@tonic-gate  * which defines which kind of id is being specified.
6417c478bd9Sstevel@tonic-gate  */
6427c478bd9Sstevel@tonic-gate #define	P_MYID	(-1)
6437c478bd9Sstevel@tonic-gate #define	NOPID (pid_t)(-1)
6447c478bd9Sstevel@tonic-gate 
6457c478bd9Sstevel@tonic-gate #ifndef NODEV
6467c478bd9Sstevel@tonic-gate #define	NODEV	(dev_t)(-1l)
6477c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32
6487c478bd9Sstevel@tonic-gate #define	NODEV32	(dev32_t)(-1)
6497c478bd9Sstevel@tonic-gate #endif	/* _SYSCALL32 */
6507c478bd9Sstevel@tonic-gate #endif	/* NODEV */
6517c478bd9Sstevel@tonic-gate 
6527c478bd9Sstevel@tonic-gate /*
6537c478bd9Sstevel@tonic-gate  * The following value of type pfn_t is used to indicate
6547c478bd9Sstevel@tonic-gate  * invalid page frame number.
6557c478bd9Sstevel@tonic-gate  */
6567c478bd9Sstevel@tonic-gate #define	PFN_INVALID	((pfn_t)-1)
6577c478bd9Sstevel@tonic-gate #define	PFN_SUSPENDED	((pfn_t)-2)
6587c478bd9Sstevel@tonic-gate 
6597c478bd9Sstevel@tonic-gate /* BEGIN CSTYLED */
6607c478bd9Sstevel@tonic-gate typedef unsigned char	u_char;
6617c478bd9Sstevel@tonic-gate typedef unsigned short	u_short;
6627c478bd9Sstevel@tonic-gate typedef unsigned int	u_int;
6637c478bd9Sstevel@tonic-gate typedef unsigned long	u_long;
6647c478bd9Sstevel@tonic-gate typedef struct _quad { int val[2]; } quad_t;	/* used by UFS */
6657c478bd9Sstevel@tonic-gate typedef quad_t		quad;			/* used by UFS */
6667c478bd9Sstevel@tonic-gate /* END CSTYLED */
6677c478bd9Sstevel@tonic-gate 
6687c478bd9Sstevel@tonic-gate /*
6697c478bd9Sstevel@tonic-gate  * Nested include for BSD/sockets source compatibility.
6707c478bd9Sstevel@tonic-gate  * (The select macros used to be defined here).
6717c478bd9Sstevel@tonic-gate  */
6727c478bd9Sstevel@tonic-gate #include <sys/select.h>
6737c478bd9Sstevel@tonic-gate 
6747c478bd9Sstevel@tonic-gate #endif	/* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
6757c478bd9Sstevel@tonic-gate 
6767c478bd9Sstevel@tonic-gate /*
6777c478bd9Sstevel@tonic-gate  * _VOID was defined to be either void or char but this is not
6787c478bd9Sstevel@tonic-gate  * required because previous SunOS compilers have accepted the void
6797c478bd9Sstevel@tonic-gate  * type. However, because many system header and source files use the
6807c478bd9Sstevel@tonic-gate  * void keyword, the volatile keyword, and ANSI C function prototypes,
6817c478bd9Sstevel@tonic-gate  * non-ANSI compilers cannot compile the system anyway. The _VOID macro
6827c478bd9Sstevel@tonic-gate  * should therefore not be used and remains for source compatibility
6837c478bd9Sstevel@tonic-gate  * only.
6847c478bd9Sstevel@tonic-gate  */
6857c478bd9Sstevel@tonic-gate /* CSTYLED */
6867c478bd9Sstevel@tonic-gate #define	_VOID	void
6877c478bd9Sstevel@tonic-gate 
6887c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
6897c478bd9Sstevel@tonic-gate }
6907c478bd9Sstevel@tonic-gate #endif
6917c478bd9Sstevel@tonic-gate 
6927c478bd9Sstevel@tonic-gate #endif	/* _SYS_TYPES_H */
693