xref: /illumos-gate/usr/src/uts/common/sys/types.h (revision ed093b41)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
22 /*	  All Rights Reserved	*/
23 
24 
25 /*
26  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
27  * Use is subject to license terms.
28  *
29  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
30  * Copyright 2016 Joyent, Inc.
31  * Copyright 2023 Oxide Computer Company
32  */
33 
34 #ifndef _SYS_TYPES_H
35 #define	_SYS_TYPES_H
36 
37 #include <sys/feature_tests.h>
38 #include <sys/isa_defs.h>
39 
40 /*
41  * Machine dependent definitions moved to <sys/machtypes.h>.
42  */
43 #include <sys/machtypes.h>
44 
45 /*
46  * Include fixed width type declarations proposed by the ISO/JTC1/SC22/WG14 C
47  * committee's working draft for the revision of the current ISO C standard,
48  * ISO/IEC 9899:1990 Programming language - C.  These are not currently
49  * required by any standard but constitute a useful, general purpose set
50  * of type definitions which is namespace clean with respect to all standards.
51  */
52 #ifdef	_KERNEL
53 #include <sys/inttypes.h>
54 #else	/* _KERNEL */
55 #include <sys/int_types.h>
56 #endif	/* _KERNEL */
57 
58 #if defined(_KERNEL) || defined(_SYSCALL32)
59 #include <sys/types32.h>
60 #endif
61 
62 #ifdef	__cplusplus
63 extern "C" {
64 #endif
65 
66 /*
67  * Strictly conforming ANSI C environments prior to the 1999
68  * revision of the C Standard (ISO/IEC 9899:1999) do not have
69  * the long long data type.
70  */
71 #if defined(_LONGLONG_TYPE)
72 typedef	long long		longlong_t;
73 typedef	unsigned long long	u_longlong_t;
74 #else
75 /* used to reserve space and generate alignment */
76 typedef union {
77 	double	_d;
78 	int32_t	_l[2];
79 } longlong_t;
80 typedef union {
81 	double		_d;
82 	uint32_t	_l[2];
83 } u_longlong_t;
84 #endif	/* defined(_LONGLONG_TYPE) */
85 
86 /*
87  * These types (t_{u}scalar_t) exist because the XTI/TPI/DLPI standards had
88  * to use them instead of int32_t and uint32_t because DEC had
89  * shipped 64-bit wide.
90  */
91 #if defined(_LP64) || defined(_I32LPx)
92 typedef int32_t		t_scalar_t;
93 typedef uint32_t	t_uscalar_t;
94 #else
95 typedef long		t_scalar_t;	/* historical versions */
96 typedef unsigned long	t_uscalar_t;
97 #endif	/* defined(_LP64) || defined(_I32LPx) */
98 
99 /*
100  * POSIX Extensions
101  */
102 typedef	unsigned char	uchar_t;
103 typedef	unsigned short	ushort_t;
104 typedef	unsigned int	uint_t;
105 typedef	unsigned long	ulong_t;
106 
107 typedef	char		*caddr_t;	/* ?<core address> type */
108 typedef	long		daddr_t;	/* <disk address> type */
109 typedef	short		cnt_t;		/* ?<count> type */
110 
111 #if !defined(_PTRDIFF_T) || __cplusplus >= 199711L
112 #define	_PTRDIFF_T
113 #if defined(_LP64) || defined(_I32LPx)
114 typedef	long	ptrdiff_t;		/* pointer difference */
115 #else
116 typedef	int	ptrdiff_t;		/* (historical version) */
117 #endif
118 #endif
119 
120 /*
121  * VM-related types
122  */
123 typedef	ulong_t		pfn_t;		/* page frame number */
124 typedef	ulong_t		pgcnt_t;	/* number of pages */
125 typedef	long		spgcnt_t;	/* signed number of pages */
126 
127 typedef	uchar_t		use_t;		/* use count for swap.  */
128 typedef	short		sysid_t;
129 typedef	short		index_t;
130 typedef void		*timeout_id_t;	/* opaque handle from timeout(9F) */
131 typedef void		*bufcall_id_t;	/* opaque handle from bufcall(9F) */
132 
133 /*
134  * The size of off_t and related types depends on the setting of
135  * _FILE_OFFSET_BITS.  (Note that other system headers define other types
136  * related to those defined here.)
137  *
138  * If _LARGEFILE64_SOURCE is defined, variants of these types that are
139  * explicitly 64 bits wide become available.
140  */
141 #ifndef _OFF_T
142 #define	_OFF_T
143 
144 #if defined(_LP64) || _FILE_OFFSET_BITS == 32
145 typedef long		off_t;		/* offsets within files */
146 #elif _FILE_OFFSET_BITS == 64
147 typedef longlong_t	off_t;		/* offsets within files */
148 #endif
149 
150 #if defined(_LARGEFILE64_SOURCE)
151 #ifdef _LP64
152 typedef	off_t		off64_t;	/* offsets within files */
153 #else
154 typedef longlong_t	off64_t;	/* offsets within files */
155 #endif
156 #endif	/* _LARGEFILE64_SOURCE */
157 
158 #endif /* _OFF_T */
159 
160 #if defined(_LP64) || _FILE_OFFSET_BITS == 32
161 typedef ulong_t		ino_t;		/* expanded inode type	*/
162 typedef long		blkcnt_t;	/* count of file blocks */
163 typedef ulong_t		fsblkcnt_t;	/* count of file system blocks */
164 typedef ulong_t		fsfilcnt_t;	/* count of files */
165 #elif _FILE_OFFSET_BITS == 64
166 typedef u_longlong_t	ino_t;		/* expanded inode type	*/
167 typedef longlong_t	blkcnt_t;	/* count of file blocks */
168 typedef u_longlong_t	fsblkcnt_t;	/* count of file system blocks */
169 typedef u_longlong_t	fsfilcnt_t;	/* count of files */
170 #endif
171 
172 #if defined(_LARGEFILE64_SOURCE)
173 #ifdef _LP64
174 typedef	ino_t		ino64_t;	/* expanded inode type */
175 typedef	blkcnt_t	blkcnt64_t;	/* count of file blocks */
176 typedef	fsblkcnt_t	fsblkcnt64_t;	/* count of file system blocks */
177 typedef	fsfilcnt_t	fsfilcnt64_t;	/* count of files */
178 #else
179 typedef u_longlong_t	ino64_t;	/* expanded inode type	*/
180 typedef longlong_t	blkcnt64_t;	/* count of file blocks */
181 typedef u_longlong_t	fsblkcnt64_t;	/* count of file system blocks */
182 typedef u_longlong_t	fsfilcnt64_t;	/* count of files */
183 #endif
184 #endif	/* _LARGEFILE64_SOURCE */
185 
186 #ifdef _LP64
187 typedef	int		blksize_t;	/* used for block sizes */
188 #else
189 typedef	long		blksize_t;	/* used for block sizes */
190 #endif
191 
192 /*
193  * The boolean_t type has had a varied amount of exposure over the years in
194  * terms of how its enumeration constants have been exposed. In particular, it
195  * originally used the __XOPEN_OR_POSIX macro to determine whether to prefix the
196  * B_TRUE and B_FALSE with an underscore. This check never included the
197  * question of if we were in a strict ANSI C environment or whether extensions
198  * were defined.
199  *
200  * Compilers such as clang started defaulting to always including an
201  * XOPEN_SOURCE declaration on behalf of users, but also noted __EXTENSIONS__.
202  * This would lead most software that had used the non-underscore versions to
203  * need it. As such, we have adjusted the non-strict XOPEN environment to retain
204  * its old behavior so as to minimize namespace pollution; however, we instead
205  * include both variants of the definitions in the generally visible version
206  * allowing software written in either world to hopefully end up in a good
207  * place.
208  *
209  * This isn't perfect, but should hopefully minimize the pain for folks actually
210  * trying to build software.
211  */
212 #if defined(__XOPEN_OR_POSIX) && !defined(__EXTENSIONS__)
213 typedef enum { _B_FALSE, _B_TRUE } boolean_t;
214 #else
215 typedef enum { B_FALSE = 0, B_TRUE = 1, _B_FALSE = 0, _B_TRUE = 1 } boolean_t;
216 #endif /* __XOPEN_OR_POSIX && !__EXTENSIONS__ */
217 
218 #ifdef _KERNEL
219 #define	VALID_BOOLEAN(x)	(((x) == B_FALSE) || ((x) == B_TRUE))
220 #define	VOID2BOOLEAN(x)		(((uintptr_t)(x) == 0) ? B_FALSE : B_TRUE)
221 #endif /* _KERNEL */
222 
223 #ifdef _KERNEL
224 #define	BOOLEAN2VOID(x)		((x) ? 1 : 0)
225 #endif /* _KERNEL */
226 
227 /*
228  * The {u,}pad64_t types can be used in structures such that those structures
229  * may be accessed by code produced by compilation environments which don't
230  * support a 64 bit integral datatype.  The intention is not to allow
231  * use of these fields in such environments, but to maintain the alignment
232  * and offsets of the structure.
233  *
234  * Similar comments for {u,}pad128_t.
235  *
236  * Note that these types do NOT generate any stronger alignment constraints
237  * than those available in the underlying ABI.  See <sys/isa_defs.h>
238  */
239 #if defined(_INT64_TYPE)
240 typedef int64_t		pad64_t;
241 typedef	uint64_t	upad64_t;
242 #else
243 typedef union {
244 	double   _d;
245 	int32_t  _l[2];
246 } pad64_t;
247 
248 typedef union {
249 	double   _d;
250 	uint32_t _l[2];
251 } upad64_t;
252 #endif
253 
254 typedef union {
255 	long double	_q;
256 	int32_t		_l[4];
257 } pad128_t;
258 
259 typedef union {
260 	long double	_q;
261 	uint32_t	_l[4];
262 } upad128_t;
263 
264 typedef union {
265 	long double	_q[2];
266 	uint32_t	_l[8];
267 } upad256_t;
268 
269 typedef union {
270 	long double	_q[4];
271 	uint32_t	_l[16];
272 } upad512_t;
273 
274 typedef	longlong_t	offset_t;
275 typedef	u_longlong_t	u_offset_t;
276 typedef u_longlong_t	len_t;
277 typedef	u_longlong_t	diskaddr_t;
278 #if (defined(_KERNEL) || defined(_KMEMUSER) || defined(_BOOT))
279 typedef	uint64_t	paddr_t;
280 #endif
281 
282 /*
283  * Definitions remaining from previous partial support for 64-bit file
284  * offsets.  This partial support for devices greater than 2gb requires
285  * compiler support for long long.
286  */
287 #ifdef _LONG_LONG_LTOH
288 typedef union {
289 	offset_t	_f;	/* Full 64 bit offset value */
290 	struct {
291 		int32_t	_l;	/* lower 32 bits of offset value */
292 		int32_t	_u;	/* upper 32 bits of offset value */
293 	} _p;
294 } lloff_t;
295 #endif
296 
297 #ifdef _LONG_LONG_HTOL
298 typedef union {
299 	offset_t	_f;	/* Full 64 bit offset value */
300 	struct {
301 		int32_t	_u;	/* upper 32 bits of offset value */
302 		int32_t	_l;	/* lower 32 bits of offset value */
303 	} _p;
304 } lloff_t;
305 #endif
306 
307 #ifdef _LONG_LONG_LTOH
308 typedef union {
309 	longlong_t	_f;	/* Full 64 bit disk address value */
310 	struct {
311 		int32_t	_l;	/* lower 32 bits of disk address value */
312 		int32_t	_u;	/* upper 32 bits of disk address value */
313 	} _p;
314 } lldaddr_t;
315 #endif
316 
317 #ifdef _LONG_LONG_HTOL
318 typedef union {
319 	longlong_t	_f;	/* Full 64 bit disk address value */
320 	struct {
321 		int32_t	_u;	/* upper 32 bits of disk address value */
322 		int32_t	_l;	/* lower 32 bits of disk address value */
323 	} _p;
324 } lldaddr_t;
325 #endif
326 
327 typedef uint_t k_fltset_t;	/* kernel fault set type */
328 
329 /*
330  * The following type is for various kinds of identifiers.  The
331  * actual type must be the same for all since some system calls
332  * (such as sigsend) take arguments that may be any of these
333  * types.  The enumeration type idtype_t defined in sys/procset.h
334  * is used to indicate what type of id is being specified --
335  * a process id, process group id, session id, scheduling class id,
336  * user id, group id, project id, task id or zone id.
337  */
338 #if defined(_LP64) || defined(_I32LPx)
339 typedef int		id_t;
340 #else
341 typedef	long		id_t;		/* (historical version) */
342 #endif
343 
344 typedef id_t		lgrp_id_t;	/* lgroup ID */
345 
346 /*
347  * Type useconds_t is an unsigned integral type capable of storing
348  * values at least in the range of zero to 1,000,000.
349  */
350 typedef uint_t		useconds_t;	/* Time, in microseconds */
351 
352 #ifndef	_SUSECONDS_T
353 #define	_SUSECONDS_T
354 typedef long	suseconds_t;	/* signed # of microseconds */
355 #endif	/* _SUSECONDS_T */
356 
357 /*
358  * Typedefs for dev_t components.
359  */
360 #if defined(_LP64) || defined(_I32LPx)
361 typedef uint_t	major_t;	/* major part of device number */
362 typedef uint_t	minor_t;	/* minor part of device number */
363 #else
364 typedef ulong_t	major_t;	/* (historical version) */
365 typedef ulong_t	minor_t;	/* (historical version) */
366 #endif
367 
368 /*
369  * The data type of a thread priority.
370  */
371 typedef short	pri_t;
372 
373 /*
374  * The data type for a CPU flags field.  (Can be extended to larger unsigned
375  * types, if needed, limited by ability to update atomically.)
376  */
377 typedef ushort_t	cpu_flag_t;
378 
379 /*
380  * For compatibility reasons the following typedefs (prefixed o_)
381  * can't grow regardless of the EFT definition. Although,
382  * applications should not explicitly use these typedefs
383  * they may be included via a system header definition.
384  * WARNING: These typedefs may be removed in a future
385  * release.
386  *		ex. the definitions in s5inode.h (now obsoleted)
387  *			remained small to preserve compatibility
388  *			in the S5 file system type.
389  */
390 typedef	ushort_t o_mode_t;		/* old file attribute type */
391 typedef short	o_dev_t;		/* old device type	*/
392 typedef	ushort_t o_uid_t;		/* old UID type		*/
393 typedef	o_uid_t	o_gid_t;		/* old GID type		*/
394 typedef	short	o_nlink_t;		/* old file link type	*/
395 typedef short	o_pid_t;		/* old process id type	*/
396 typedef ushort_t o_ino_t;		/* old inode type	*/
397 
398 
399 /*
400  * POSIX and XOPEN Declarations
401  */
402 typedef	int	key_t;			/* IPC key type		*/
403 #if defined(_LP64) || defined(_I32LPx)
404 typedef	uint_t	mode_t;			/* file attribute type	*/
405 #else
406 typedef	ulong_t	mode_t;			/* (historical version) */
407 #endif
408 
409 #ifndef	_UID_T
410 #define	_UID_T
411 typedef	unsigned int uid_t;		/* UID type		*/
412 #endif	/* _UID_T */
413 
414 typedef	uid_t	gid_t;			/* GID type		*/
415 
416 typedef uint32_t	datalink_id_t;
417 typedef	uint32_t	vrid_t;
418 
419 typedef id_t    taskid_t;
420 typedef id_t    projid_t;
421 typedef	id_t	poolid_t;
422 typedef id_t	zoneid_t;
423 typedef id_t	ctid_t;
424 
425 /*
426  * POSIX definitions are same as defined in thread.h and synch.h.
427  * Any changes made to here should be reflected in corresponding
428  * files as described in comments.
429  */
430 typedef	uint_t	pthread_t;	/* = thread_t in thread.h */
431 typedef	uint_t	pthread_key_t;	/* = thread_key_t in thread.h */
432 
433 /* "Magic numbers" tagging synchronization object types */
434 #define	_MUTEX_MAGIC	0x4d58		/* "MX" */
435 #define	_SEMA_MAGIC	0x534d		/* "SM" */
436 #define	_COND_MAGIC	0x4356		/* "CV" */
437 #define	_RWL_MAGIC	0x5257		/* "RW" */
438 
439 typedef	struct _pthread_mutex {		/* = mutex_t in synch.h */
440 	struct {
441 		uint16_t	__pthread_mutex_flag1;
442 		uint8_t		__pthread_mutex_flag2;
443 		uint8_t		__pthread_mutex_ceiling;
444 		uint16_t	__pthread_mutex_type;
445 		uint16_t	__pthread_mutex_magic;
446 	} __pthread_mutex_flags;
447 	union {
448 		struct {
449 			uint8_t	__pthread_mutex_pad[8];
450 		} __pthread_mutex_lock64;
451 		struct {
452 			uint32_t __pthread_ownerpid;
453 			uint32_t __pthread_lockword;
454 		} __pthread_mutex_lock32;
455 		upad64_t __pthread_mutex_owner64;
456 	} __pthread_mutex_lock;
457 	upad64_t __pthread_mutex_data;
458 } pthread_mutex_t;
459 
460 typedef	struct _pthread_cond {		/* = cond_t in synch.h */
461 	struct {
462 		uint8_t		__pthread_cond_flag[4];
463 		uint16_t	__pthread_cond_type;
464 		uint16_t	__pthread_cond_magic;
465 	} __pthread_cond_flags;
466 	upad64_t __pthread_cond_data;
467 } pthread_cond_t;
468 
469 /*
470  * UNIX 98 Extension
471  */
472 typedef	struct _pthread_rwlock {	/* = rwlock_t in synch.h */
473 	int32_t		__pthread_rwlock_readers;
474 	uint16_t	__pthread_rwlock_type;
475 	uint16_t	__pthread_rwlock_magic;
476 	pthread_mutex_t	__pthread_rwlock_mutex;
477 	pthread_cond_t	__pthread_rwlock_readercv;
478 	pthread_cond_t	__pthread_rwlock_writercv;
479 } pthread_rwlock_t;
480 
481 /*
482  * SUSV3
483  */
484 typedef struct {
485 	uint32_t	__pthread_barrier_count;
486 	uint32_t	__pthread_barrier_current;
487 	upad64_t	__pthread_barrier_cycle;
488 	upad64_t	__pthread_barrier_reserved;
489 	pthread_mutex_t	__pthread_barrier_lock;
490 	pthread_cond_t	__pthread_barrier_cond;
491 } pthread_barrier_t;
492 
493 typedef	pthread_mutex_t	pthread_spinlock_t;
494 
495 /*
496  * attributes for threads, dynamically allocated by library
497  */
498 typedef struct _pthread_attr {
499 	void	*__pthread_attrp;
500 } pthread_attr_t;
501 
502 /*
503  * attributes for mutex, dynamically allocated by library
504  */
505 typedef struct _pthread_mutexattr {
506 	void	*__pthread_mutexattrp;
507 } pthread_mutexattr_t;
508 
509 /*
510  * attributes for cond, dynamically allocated by library
511  */
512 typedef struct _pthread_condattr {
513 	void	*__pthread_condattrp;
514 } pthread_condattr_t;
515 
516 /*
517  * pthread_once
518  */
519 typedef	struct _once {
520 	upad64_t	__pthread_once_pad[4];
521 } pthread_once_t;
522 
523 /*
524  * UNIX 98 Extensions
525  * attributes for rwlock, dynamically allocated by library
526  */
527 typedef struct _pthread_rwlockattr {
528 	void	*__pthread_rwlockattrp;
529 } pthread_rwlockattr_t;
530 
531 /*
532  * SUSV3
533  * attributes for pthread_barrier_t, dynamically allocated by library
534  */
535 typedef struct {
536 	void	*__pthread_barrierattrp;
537 } pthread_barrierattr_t;
538 
539 typedef ulong_t	dev_t;			/* expanded device type */
540 
541 #if defined(_LP64) || defined(_I32LPx)
542 typedef	uint_t nlink_t;			/* file link type	*/
543 typedef int	pid_t;			/* process id type	*/
544 #else
545 typedef	ulong_t	nlink_t;		/* (historical version) */
546 typedef	long	pid_t;			/* (historical version) */
547 #endif
548 
549 #if !defined(_SIZE_T) || __cplusplus >= 199711L
550 #define	_SIZE_T
551 #if defined(_LP64) || defined(_I32LPx)
552 typedef	ulong_t	size_t;		/* size of something in bytes */
553 #else
554 typedef	uint_t	size_t;		/* (historical version) */
555 #endif
556 #endif	/* _SIZE_T */
557 
558 #ifndef _SSIZE_T
559 #define	_SSIZE_T
560 #if defined(_LP64) || defined(_I32LPx)
561 typedef long	ssize_t;	/* size of something in bytes or -1 */
562 #else
563 typedef int	ssize_t;	/* (historical version) */
564 #endif
565 #endif	/* _SSIZE_T */
566 
567 #if !defined(_TIME_T) || __cplusplus >= 199711L
568 #define	_TIME_T
569 typedef	long		time_t;	/* time of day in seconds */
570 #endif	/* _TIME_T */
571 
572 #if !defined(_CLOCK_T) || __cplusplus >= 199711L
573 #define	_CLOCK_T
574 typedef	long		clock_t; /* relative time in a specified resolution */
575 #endif	/* ifndef _CLOCK_T */
576 
577 #ifndef _CLOCKID_T
578 #define	_CLOCKID_T
579 typedef	int	clockid_t;	/* clock identifier type */
580 #endif	/* ifndef _CLOCKID_T */
581 
582 #ifndef _TIMER_T
583 #define	_TIMER_T
584 typedef	int	timer_t;	/* timer identifier type */
585 #endif	/* ifndef _TIMER_T */
586 
587 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
588 
589 /* BEGIN CSTYLED */
590 typedef	unsigned char	unchar;
591 typedef	unsigned short	ushort;
592 typedef	unsigned int	uint;
593 typedef	unsigned long	ulong;
594 /* END CSTYLED */
595 
596 #if defined(_KERNEL) || defined(_FAKE_KERNEL)
597 
598 #define	SHRT_MIN	(-32768)	/* min value of a "short int" */
599 #define	SHRT_MAX	32767		/* max value of a "short int" */
600 #define	USHRT_MAX	65535		/* max of "unsigned short int" */
601 #define	INT_MIN		(-2147483647-1) /* min value of an "int" */
602 #define	INT_MAX		2147483647	/* max value of an "int" */
603 #define	UINT_MAX	4294967295U	/* max value of an "unsigned int" */
604 #if defined(_LP64)
605 #define	LONG_MIN	(-9223372036854775807L-1L)
606 					/* min value of a "long int" */
607 #define	LONG_MAX	9223372036854775807L
608 					/* max value of a "long int" */
609 #define	ULONG_MAX	18446744073709551615UL
610 					/* max of "unsigned long int" */
611 #else /* _ILP32 */
612 #define	LONG_MIN	(-2147483647L-1L)
613 					/* min value of a "long int" */
614 #define	LONG_MAX	2147483647L	/* max value of a "long int" */
615 #define	ULONG_MAX	4294967295UL	/* max of "unsigned long int" */
616 #endif
617 
618 #define	LLONG_MIN	(-9223372036854775807LL-1LL)
619 					/* min of "long long int" */
620 #define	LLONG_MAX	9223372036854775807LL
621 					/* max of "long long int" */
622 #define	ULLONG_MAX	18446744073709551615ULL
623 					/* max of "unsigned long long int" */
624 
625 #if defined(_LP64) || _FILE_OFFSET_BITS == 32
626 #define	OFF_MIN		LONG_MIN
627 #define	OFF_MAX		LONG_MAX
628 #elif _FILE_OFFSET_BITS == 64
629 #define	OFF_MIN		LLONG_MIN
630 #define	OFF_MAX		LLONG_MAX
631 #endif	/* _LP64 || _FILE_OFFSET_BITS == 32 */
632 
633 #endif	/* defined(_KERNEL) */
634 
635 #define	P_MYPID	((pid_t)0)
636 
637 /*
638  * The following is the value of type id_t to use to indicate the
639  * caller's current id.  See procset.h for the type idtype_t
640  * which defines which kind of id is being specified.
641  */
642 #define	P_MYID	(-1)
643 #define	NOPID (pid_t)(-1)
644 
645 #ifndef NODEV
646 #define	NODEV	(dev_t)(-1l)
647 #ifdef _SYSCALL32
648 #define	NODEV32	(dev32_t)(-1)
649 #endif	/* _SYSCALL32 */
650 #endif	/* NODEV */
651 
652 /*
653  * The following value of type pfn_t is used to indicate
654  * invalid page frame number.
655  */
656 #define	PFN_INVALID	((pfn_t)-1)
657 #define	PFN_SUSPENDED	((pfn_t)-2)
658 
659 /* BEGIN CSTYLED */
660 typedef unsigned char	u_char;
661 typedef unsigned short	u_short;
662 typedef unsigned int	u_int;
663 typedef unsigned long	u_long;
664 typedef struct _quad { int val[2]; } quad_t;	/* used by UFS */
665 typedef quad_t		quad;			/* used by UFS */
666 /* END CSTYLED */
667 
668 /*
669  * Nested include for BSD/sockets source compatibility.
670  * (The select macros used to be defined here).
671  */
672 #include <sys/select.h>
673 
674 #endif	/* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
675 
676 /*
677  * _VOID was defined to be either void or char but this is not
678  * required because previous SunOS compilers have accepted the void
679  * type. However, because many system header and source files use the
680  * void keyword, the volatile keyword, and ANSI C function prototypes,
681  * non-ANSI compilers cannot compile the system anyway. The _VOID macro
682  * should therefore not be used and remains for source compatibility
683  * only.
684  */
685 /* CSTYLED */
686 #define	_VOID	void
687 
688 #ifdef	__cplusplus
689 }
690 #endif
691 
692 #endif	/* _SYS_TYPES_H */
693