sys/types.h
1 /* DO NOT EDIT THIS FILE.
2
3 It has been auto-edited by fixincludes from:
4
5 "/usr/include/sys/types.h"
6
7 This had to be done to correct non-standard usages in the
8 original, manufacturer supplied header file. */
9
10 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
11 /* All Rights Reserved */
12
13 /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
14 /* The copyright notice above does not evidence any */
15 /* actual or intended publication of such source code. */
16
17 /*
18 * Copyright 1996-2002 by Sun Microsystems, Inc. All rights reserved.
19 * Use is subject to license terms.
20 */
21
22 #ifndef _SYS_TYPES_H
23 #define _SYS_TYPES_H
24
25 #pragma ident "@(#)types.h 1.68 02/06/10 SMI"
26
27 #include
28 #include
29
30 /*
31 * Machine dependent definitions moved to .
32 */
33 #include
34
35 /*
36 * Include fixed width type declarations proposed by the ISO/JTC1/SC22/WG14 C
37 * committee's working draft for the revision of the current ISO C standard,
38 * ISO/IEC 9899:1990 Programming language - C. These are not currently
39 * required by any standard but constitute a useful, general purpose set
40 * of type definitions which is namespace clean with respect to all standards.
41 */
42 #ifdef _KERNEL
43 #include
44 #else /* _KERNEL */
45 #include
46 #endif /* _KERNEL */
47
48 #if defined(_KERNEL) || defined(_SYSCALL32)
49 #include
50 #endif
51
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55
56 /*
57 * The following protects users who use other than Sun compilers
58 * (eg, GNU C) that don't support long long, and need to include
59 * this header file.
60 */
61 #if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
62 typedef long long longlong_t; <typedef:longlong_t>
63 typedef unsigned long long u_longlong_t; <typedef:u_longlong_t>
64 #else
65 /* used to reserve space and generate alignment */
66 typedef union {
67 double _d;
68 int32_t _l[2];
69 } longlong_t;
70 typedef union {
71 double _d;
72 uint32_t _l[2];
73 } u_longlong_t;
74 #endif /* __STDC__ - 0 == 0 && !defined(_NO_LONGLONG) */
75
76 /*
77 * These types (t_{u}scalar_t) exist because the XTI/TPI/DLPI standards had
78 * to use them instead of int32_t and uint32_t because DEC had
79 * shipped 64-bit wide.
80 */
81 #if defined(_LP64) || defined(_I32LPx)
82 typedef int32_t t_scalar_t;
83 typedef uint32_t t_uscalar_t;
84 #else
85 typedef long t_scalar_t; /* historical versions */ <typedef:t_scalar_t>
86 typedef unsigned long t_uscalar_t; <typedef:t_uscalar_t>
87 #endif /* defined(_LP64) || defined(_I32LPx) */
88
89 /*
90 * POSIX Extensions
91 */
92 typedef unsigned char uchar_t; <typedef:uchar_t>
93 typedef unsigned short ushort_t; <typedef:ushort_t>
94 typedef unsigned int uint_t; <typedef:uint_t>
95 typedef unsigned long ulong_t; <typedef:ulong_t>
96
97 typedef char *caddr_t; /* ? type */ <typedef:caddr_t>
98 typedef long daddr_t; /* type */ <typedef:daddr_t>
99 typedef short cnt_t; /* ? type */ <typedef:cnt_t>
100
101 #if defined(_ILP32) /* only used in i386 code */
102 typedef ulong_t paddr_t; /* type */ <typedef:paddr_t>
103 #elif defined(__ia64) /* XXX Fix me */
104 typedef uint_t paddr_t;
105 #endif
106
107 #ifndef _PTRDIFF_T
108 #define _PTRDIFF_T
109 #if defined(_LP64) || defined(_I32LPx)
110 #if !defined(_GCC_PTRDIFF_T)
111 #define _GCC_PTRDIFF_T
112 typedef __PTRDIFF_TYPE__ ptrdiff_t;
113 #endif
114 /* pointer difference */
115 #else
116 #if !defined(_GCC_PTRDIFF_T)
117 #define _GCC_PTRDIFF_T
118 typedef __PTRDIFF_TYPE__ ptrdiff_t; <typedef:ptrdiff_t>
119 #endif
120 /* (historical version) */
121 #endif
122 #endif
123
124 /*
125 * VM-related types
126 */
127 typedef ulong_t pfn_t; /* page frame number */ <typedef:pfn_t>
128 typedef ulong_t pgcnt_t; /* number of pages */ <typedef:pgcnt_t>
129 typedef long spgcnt_t; /* signed number of pages */ <typedef:spgcnt_t>
130
131 typedef uchar_t use_t; /* use count for swap. */ <typedef:use_t>
132 typedef short sysid_t; <typedef:sysid_t>
133 typedef short index_t; <typedef:index_t>
134 typedef void *timeout_id_t; /* opaque handle from timeout(9F) */ <typedef:timeout_id_t>
135 typedef void *bufcall_id_t; /* opaque handle from bufcall(9F) */ <typedef:bufcall_id_t>
136
137 /*
138 * The size of off_t and related types depends on the setting of
139 * _FILE_OFFSET_BITS. (Note that other system headers define other types
140 * related to those defined here.)
141 *
142 * If _LARGEFILE64_SOURCE is defined, variants of these types that are
143 * explicitly 64 bits wide become available.
144 */
145 #ifndef _OFF_T
146 #define _OFF_T
147
148 #if defined(_LP64) || _FILE_OFFSET_BITS == 32
149 typedef long off_t; /* offsets within files */
150 #elif _FILE_OFFSET_BITS == 64
151 typedef longlong_t off_t; /* offsets within files */
152 #endif
153
154 #if defined(_LARGEFILE64_SOURCE)
155 #ifdef _LP64
156 typedef off_t off64_t; /* offsets within files */
157 #else
158 typedef longlong_t off64_t; /* offsets within files */
159 #endif
160 #endif /* _LARGEFILE64_SOURCE */
161
162 #endif /* _OFF_T */
163
164 #if defined(_LP64) || _FILE_OFFSET_BITS == 32
165 typedef ulong_t ino_t; /* expanded inode type */ <typedef:ino_t>
166 typedef long blkcnt_t; /* count of file blocks */ <typedef:blkcnt_t>
167 typedef ulong_t fsblkcnt_t; /* count of file system blocks */ <typedef:fsblkcnt_t>
168 typedef ulong_t fsfilcnt_t; /* count of files */ <typedef:fsfilcnt_t>
169 #elif _FILE_OFFSET_BITS == 64
170 typedef u_longlong_t ino_t; /* expanded inode type */
171 typedef longlong_t blkcnt_t; /* count of file blocks */
172 typedef u_longlong_t fsblkcnt_t; /* count of file system blocks */
173 typedef u_longlong_t fsfilcnt_t; /* count of files */
174 #endif
175
176 #if defined(_LARGEFILE64_SOURCE)
177 #ifdef _LP64
178 typedef ino_t ino64_t; /* expanded inode type */
179 typedef blkcnt_t blkcnt64_t; /* count of file blocks */
180 typedef fsblkcnt_t fsblkcnt64_t; /* count of file system blocks */
181 typedef fsfilcnt_t fsfilcnt64_t; /* count of files */
182 #else
183 typedef u_longlong_t ino64_t; /* expanded inode type */ <typedef:ino64_t>
184 typedef longlong_t blkcnt64_t; /* count of file blocks */ <typedef:blkcnt64_t>
185 typedef u_longlong_t fsblkcnt64_t; /* count of file system blocks */ <typedef:fsblkcnt64_t>
186 typedef u_longlong_t fsfilcnt64_t; /* count of files */ <typedef:fsfilcnt64_t>
187 #endif
188 #endif /* _LARGEFILE64_SOURCE */
189
190 #ifdef _LP64
191 typedef int blksize_t; /* used for block sizes */
192 #else
193 typedef long blksize_t; /* used for block sizes */ <typedef:blksize_t>
194 #endif
195
196 #if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
197 typedef enum { _B_FALSE, _B_TRUE } boolean_t;
198 #else
199 typedef enum { B_FALSE, B_TRUE } boolean_t; <typedef:boolean_t>
200 #endif /* defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) */
201
202 /*
203 * The [u]pad64_t is to be used in structures such that those structures
204 * may be accessed by code produced by compilation environments which don't
205 * support a 64 bit integral datatype. This intention is not to allow
206 * use of these fields in such environments, but to maintain the alignment
207 * and offsets of the structure.
208 */
209 #if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
210 typedef int64_t pad64_t; <typedef:pad64_t>
211 typedef uint64_t upad64_t; <typedef:upad64_t>
212 #else
213 typedef union {
214 double _d;
215 int32_t _l[2];
216 } pad64_t;
217 typedef union {
218 double _d;
219 uint32_t _l[2];
220 } upad64_t;
221 #endif
222
223 typedef longlong_t offset_t; <typedef:offset_t>
224 typedef u_longlong_t u_offset_t; <typedef:u_offset_t>
225 typedef u_longlong_t len_t; <typedef:len_t>
226 typedef longlong_t diskaddr_t; <typedef:diskaddr_t>
227
228 /*
229 * Definitions remaining from previous partial support for 64-bit file
230 * offsets. This partial support for devices greater than 2gb requires
231 * compiler support for long long.
232 */
233 #ifdef _LONG_LONG_LTOH
234 typedef union {
235 offset_t _f; /* Full 64 bit offset value */
236 struct {
237 int32_t _l; /* lower 32 bits of offset value */
238 int32_t _u; /* upper 32 bits of offset value */
239 } _p;
240 } lloff_t;
241 #endif
242
243 #ifdef _LONG_LONG_HTOL
244 typedef union {
245 offset_t _f; /* Full 64 bit offset value */
246 struct {
247 int32_t _u; /* upper 32 bits of offset value */
248 int32_t _l; /* lower 32 bits of offset value */
249 } _p; <??>
250 } lloff_t; <typedef:lloff_t>
251 #endif
252
253 #ifdef _LONG_LONG_LTOH
254 typedef union {
255 diskaddr_t _f; /* Full 64 bit disk address value */
256 struct {
257 int32_t _l; /* lower 32 bits of disk address value */
258 int32_t _u; /* upper 32 bits of disk address value */
259 } _p;
260 } lldaddr_t;
261 #endif
262
263 #ifdef _LONG_LONG_HTOL
264 typedef union {
265 diskaddr_t _f; /* Full 64 bit disk address value */
266 struct {
267 int32_t _u; /* upper 32 bits of disk address value */
268 int32_t _l; /* lower 32 bits of disk address value */
269 } _p; <??>
270 } lldaddr_t; <typedef:lldaddr_t>
271 #endif
272
273 typedef uint_t k_fltset_t; /* kernel fault set type */ <typedef:k_fltset_t>
274
275 /*
276 * The following type is for various kinds of identifiers. The
277 * actual type must be the same for all since some system calls
278 * (such as sigsend) take arguments that may be any of these
279 * types. The enumeration type idtype_t defined in sys/procset.h
280 * is used to indicate what type of id is being specified --
281 * a process id, process group id, session id, scheduling class id,
282 * user id, group id, project id, or task id.
283 */
284 #if defined(_LP64) || defined(_I32LPx)
285 typedef int id_t;
286 #else
287 typedef long id_t; /* (historical version) */ <typedef:id_t>
288 #endif
289
290 /*
291 * Type useconds_t is an unsigned integral type capable of storing
292 * values at least in the range of zero to 1,000,000.
293 */
294 typedef uint_t useconds_t; /* Time, in microseconds */ <typedef:useconds_t>
295
296 #ifndef _SUSECONDS_T
297 #define _SUSECONDS_T
298 typedef long suseconds_t; /* signed # of microseconds */ <typedef:suseconds_t>
299 #endif /* _SUSECONDS_T */
300
301 /*
302 * Typedefs for dev_t components.
303 */
304 #if defined(_LP64) || defined(_I32LPx)
305 typedef uint_t major_t; /* major part of device number */
306 typedef uint_t minor_t; /* minor part of device number */
307 #else
308 typedef ulong_t major_t; /* (historical version) */ <typedef:major_t>
309 typedef ulong_t minor_t; /* (historical version) */ <typedef:minor_t>
310 #endif
311
312 /*
313 * The data type of a thread priority.
314 */
315 typedef short pri_t; <typedef:pri_t>
316
317 /*
318 * For compatibility reasons the following typedefs (prefixed o_)
319 * can't grow regardless of the EFT definition. Although,
320 * applications should not explicitly use these typedefs
321 * they may be included via a system header definition.
322 * WARNING: These typedefs may be removed in a future
323 * release.
324 * ex. the definitions in s5inode.h remain small
325 * to preserve compatibility in the S5
326 * file system type.
327 */
328 typedef ushort_t o_mode_t; /* old file attribute type */ <typedef:o_mode_t>
329 typedef short o_dev_t; /* old device type */ <typedef:o_dev_t>
330 typedef ushort_t o_uid_t; /* old UID type */ <typedef:o_uid_t>
331 typedef o_uid_t o_gid_t; /* old GID type */ <typedef:o_gid_t>
332 typedef short o_nlink_t; /* old file link type */ <typedef:o_nlink_t>
333 typedef short o_pid_t; /* old process id type */ <typedef:o_pid_t>
334 typedef ushort_t o_ino_t; /* old inode type */ <typedef:o_ino_t>
335
336
337 /*
338 * POSIX and XOPEN Declarations
339 */
340 typedef int key_t; /* IPC key type */ <typedef:key_t>
341 #if defined(_LP64) || defined(_I32LPx)
342 typedef uint_t mode_t; /* file attribute type */
343 #else
344 typedef ulong_t mode_t; /* (historical version) */ <typedef:mode_t>
345 #endif
346
347 #ifndef _UID_T
348 #define _UID_T
349 #if defined(_LP64) || defined(_I32LPx)
350 typedef int uid_t; /* UID type */
351 #else
352 typedef long uid_t; /* (historical version) */
353 #endif
354 #endif /* _UID_T */
355
356 typedef uid_t gid_t; /* GID type */ <typedef:gid_t>
357
358 typedef id_t taskid_t; <typedef:taskid_t>
359 typedef id_t projid_t; <typedef:projid_t>
360
361 /*
362 * POSIX definitions are same as defined in thread.h and synch.h.
363 * Any changes made to here should be reflected in corresponding
364 * files as described in comments.
365 */
366 typedef uint_t pthread_t; /* = thread_t in thread.h */ <typedef:pthread_t>
367 typedef uint_t pthread_key_t; /* = thread_key_t in thread.h */ <typedef:pthread_key_t>
368
369 typedef struct _pthread_mutex { /* = mutex_t in synch.h */ <_pthread_mutex>
370 struct {
371 uint16_t __pthread_mutex_flag1;
372 uint8_t __pthread_mutex_flag2;
373 uint8_t __pthread_mutex_ceiling;
374 uint16_t __pthread_mutex_type;
375 uint16_t __pthread_mutex_magic;
376 } __pthread_mutex_flags; <??>
377 union {
378 struct {
379 uint8_t __pthread_mutex_pad[8];
380 } __pthread_mutex_lock64; <??>
381 struct {
382 uint32_t __pthread_ownerpid;
383 uint32_t __pthread_lockword;
384 } __pthread_mutex_lock32; <??>
385 upad64_t __pthread_mutex_owner64;
386 } __pthread_mutex_lock; <??>
387 upad64_t __pthread_mutex_data;
388 } pthread_mutex_t; <typedef:pthread_mutex_t>
389
390 typedef struct _pthread_cond { /* = cond_t in synch.h */ <_pthread_cond>
391 struct {
392 uint8_t __pthread_cond_flag[4];
393 uint16_t __pthread_cond_type;
394 uint16_t __pthread_cond_magic;
395 } __pthread_cond_flags; <??>
396 upad64_t __pthread_cond_data;
397 } pthread_cond_t; <typedef:pthread_cond_t>
398
399 /*
400 * UNIX 98 Extension
401 */
402 typedef struct _pthread_rwlock { /* = rwlock_t in synch.h */ <_pthread_rwlock>
403 int32_t __pthread_rwlock_readers;
404 uint16_t __pthread_rwlock_type;
405 uint16_t __pthread_rwlock_magic;
406 upad64_t __pthread_rwlock_pad1[3];
407 upad64_t __pthread_rwlock_pad2[2];
408 upad64_t __pthread_rwlock_pad3[2];
409 } pthread_rwlock_t; <typedef:pthread_rwlock_t>
410
411 /*
412 * attributes for threads, dynamically allocated by library
413 */
414 typedef struct _pthread_attr { <_pthread_attr>
415 void *__pthread_attrp;
416 } pthread_attr_t; <typedef:pthread_attr_t>
417
418 /*
419 * attributes for mutex, dynamically allocated by library
420 */
421 typedef struct _pthread_mutexattr { <_pthread_mutexattr>
422 void *__pthread_mutexattrp;
423 } pthread_mutexattr_t; <typedef:pthread_mutexattr_t>
424
425 /*
426 * attributes for cond, dynamically allocated by library
427 */
428 typedef struct _pthread_condattr { <_pthread_condattr>
429 void *__pthread_condattrp;
430 } pthread_condattr_t; <typedef:pthread_condattr_t>
431
432 /*
433 * pthread_once
434 */
435 typedef struct _once { <_once>
436 upad64_t __pthread_once_pad[4];
437 } pthread_once_t; <typedef:pthread_once_t>
438
439 /*
440 * UNIX 98 Extensions
441 * attributes for rwlock, dynamically allocated by library
442 */
443 typedef struct _pthread_rwlockattr { <_pthread_rwlockattr>
444 void *__pthread_rwlockattrp;
445 } pthread_rwlockattr_t; <typedef:pthread_rwlockattr_t>
446
447 typedef ulong_t dev_t; /* expanded device type */ <typedef:dev_t>
448
449 #if defined(_LP64) || defined(_I32LPx)
450 typedef uint_t nlink_t; /* file link type */
451 typedef int pid_t; /* process id type */
452 #else
453 typedef ulong_t nlink_t; /* (historical version) */ <typedef:nlink_t>
454 typedef long pid_t; /* (historical version) */ <typedef:pid_t>
455 #endif
456
457 #ifndef _SIZE_T
458 #define _SIZE_T
459 #if defined(_LP64) || defined(_I32LPx)
460 #if !defined(_GCC_SIZE_T)
461 #define _GCC_SIZE_T
462 typedef __SIZE_TYPE__ size_t;
463 #endif
464 /* size of something in bytes */
465 #else
466 #if !defined(_GCC_SIZE_T)
467 #define _GCC_SIZE_T
468 typedef __SIZE_TYPE__ size_t;
469 #endif
470 /* (historical version) */
471 #endif
472 #endif /* _SIZE_T */
473
474 #ifndef _SSIZE_T
475 #define _SSIZE_T
476 #if defined(_LP64) || defined(_I32LPx)
477 typedef long ssize_t; /* size of something in bytes or -1 */
478 #else
479 typedef int ssize_t; /* (historical version) */
480 #endif
481 #endif /* _SSIZE_T */
482
483 #ifndef _TIME_T
484 #define _TIME_T
485 typedef long time_t; /* time of day in seconds */ <typedef:time_t>
486 #endif /* _TIME_T */
487
488 #ifndef _CLOCK_T
489 #define _CLOCK_T
490 typedef long clock_t; /* relative time in a specified resolution */ <typedef:clock_t>
491 #endif /* ifndef _CLOCK_T */
492
493 #ifndef _CLOCKID_T
494 #define _CLOCKID_T
495 typedef int clockid_t; /* clock identifier type */ <typedef:clockid_t>
496 #endif /* ifndef _CLOCKID_T */
497
498 #ifndef _TIMER_T
499 #define _TIMER_T
500 typedef int timer_t; /* timer identifier type */ <typedef:timer_t>
501 #endif /* ifndef _TIMER_T */
502
503 #if defined(__EXTENSIONS__) || \
504 (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE))
505
506 /* BEGIN CSTYLED */
507 typedef unsigned char unchar; <typedef:unchar>
508 typedef unsigned short ushort; <typedef:ushort>
509 typedef unsigned int uint; <typedef:uint>
510 typedef unsigned long ulong; <typedef:ulong>
511 /* END CSTYLED */
512
513 #if defined(_KERNEL)
514
515 #define SHRT_MIN (-32768) /* min value of a "short int" */
516 #define SHRT_MAX 32767 /* max value of a "short int" */
517 #define USHRT_MAX 65535 /* max of "unsigned short int" */
518 #define INT_MIN (-2147483647-1) /* min value of an "int" */
519 #define INT_MAX 2147483647 /* max value of an "int" */
520 #define UINT_MAX 4294967295U /* max value of an "unsigned int" */
521 #if defined(_LP64)
522 #define LONG_MIN (-9223372036854775807L-1L)
523 /* min value of a "long int" */
524 #define LONG_MAX 9223372036854775807L
525 /* max value of a "long int" */
526 #define ULONG_MAX 18446744073709551615UL
527 /* max of "unsigned long int" */
528 #else /* _ILP32 */
529 #define LONG_MIN (-2147483647L-1L)
530 /* min value of a "long int" */
531 #define LONG_MAX 2147483647L /* max value of a "long int" */
532 #define ULONG_MAX 4294967295UL /* max of "unsigned long int" */
533 #endif
534
535 #endif /* defined(_KERNEL) */
536
537 #define P_MYPID ((pid_t)0)
538
539 /*
540 * The following is the value of type id_t to use to indicate the
541 * caller's current id. See procset.h for the type idtype_t
542 * which defines which kind of id is being specified.
543 */
544 #define P_MYID (-1)
545 #define NOPID (pid_t)(-1)
546
547 #ifndef NODEV
548 #define NODEV (dev_t)(-1l)
549 #ifdef _SYSCALL32
550 #define NODEV32 (dev32_t)(-1)
551 #endif /* _SYSCALL32 */
552 #endif /* NODEV */
553
554 /*
555 * The following value of type pfn_t is used to indicate
556 * invalid page frame number.
557 */
558 #define PFN_INVALID ((pfn_t)-1)
559
560 /* BEGIN CSTYLED */
561 typedef unsigned char u_char; <typedef:u_char>
562 typedef unsigned short u_short; <typedef:u_short>
563 typedef unsigned int u_int; <typedef:u_int>
564 typedef unsigned long u_long; <typedef:u_long>
565 typedef struct _quad { int val[2]; } quad_t; /* used by UFS */ <typedef:quad_t>
566 typedef quad_t quad; /* used by UFS */ <typedef:quad>
567 /* END CSTYLED */
568
569 /*
570 * Nested include for BSD/sockets source compatibility.
571 * (The select macros used to be defined here).
572 */
573 #include
574
575 #endif /* defined(__EXTENSIONS__) || (!defined(_POSIX_C_SOURCE) && ... */
576
577 /*
578 * _VOID was defined to be either void or char but this is not
579 * required because previous SunOS compilers have accepted the void
580 * type. However, because many system header and source files use the
581 * void keyword, the volatile keyword, and ANSI C function prototypes,
582 * non-ANSI compilers cannot compile the system anyway. The _VOID macro
583 * should therefore not be used and remains for source compatibility
584 * only.
585 */
586 /* CSTYLED */
587 #define _VOID void
588
589 #ifdef __cplusplus
590 }
591 #endif
592
593 #endif /* _SYS_TYPES_H */