2 .\" Copyright 1989 AT&T. Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH TYPES.H 3HEAD "Oct 6, 2004"
8 types.h, types \- primitive system data types
12 \fB#include <sys/types.h>\fR
18 The data types defined in <\fBsys/types.h\fR> are as follows:
22 The data types listed below are defined in <\fBsys/types.h\fR> for 32-bit
27 typedef struct { int r[1]; } *physadr;
30 typedef char * caddr_t;
31 typedef unsigned char unchar;
32 typedef unsigned short ushort;
33 typedef unsigned int uint;
34 typedef unsigned long ulong_t;
35 typedef unsigned long ino_t;
38 typedef ulong_t nlink_t;
39 typedef ulong_t mode_t;
42 typedef int label_t[10];
43 typedef ulong_t dev_t;
48 typedef unsigned char use_t;
49 typedef short sysid_t;
50 typedef short index_t;
52 typedef unsigned int size_t;
61 The data types listed below are defined in <\fBsys/types.h\fR> for 64-bit
70 typedef ulong_t fsblkcnt_t
71 typedef ulong_t fsfilcnt_t
76 typedef uint_t major_t
77 typedef uint_t minor_t
79 typedef uint_t nlink_t
81 typedef ptrdiff_t intptr_t
82 typedef ulong_t rlim_t
83 typedef ulong_t size_t
84 typedef uint_t speed_t
86 typedef long suseconds_t
87 typedef uint_t tcflag_t
94 .SS "Preprocessor Symbols"
97 For 32-bit programs, pointers and the C data types \fBint\fR and \fBlong\fR are
98 all 32-bit quantities. For 64-bit programs, pointers and the C data type
99 \fBlong\fR are defined as 64-bit quantities.
102 The preprocessor symbol \fB_ILP32\fR, made visible by the inclusion of
103 <\fBsys/types.h\fR>, can be used with the preprocessor \fB#ifdef\fR construct
104 to define sections of code that will be compiled only as part of a 32-bit
105 version of a given C program.
108 The preprocessor symbol \fB_LP64\fR can be used in the same way to define
109 sections of code that will be compiled only as part of a 64-bit version of a
110 given C program. See EXAMPLES.
113 This header incorporates definitions of other preprocessor symbols that can be
114 useful when keeping code portable between different instruction set
119 \fB\fB_LITTLE_ENDIAN\fR\fR
123 \fB\fB_BIG_ENDIAN\fR\fR
126 The natural byte order of the processor. A pointer to an \fBint\fR points to
127 the least/most significant byte of that \fBint\fR.
133 \fB\fB_STACK_GROWS_UPWARD\fR\fR
137 \fB\fB_STACK_GROWS_DOWNWARD\fR\fR
140 The processor specific direction of stack growth. A push onto the stack
141 increases/decreases the stack pointer, so it stores data at successively
142 higher/lower addresses.
148 \fB\fB_CHAR_IS_UNSIGNED\fR\fR
152 \fB\fB_CHAR_IS_SIGNED\fR\fR
155 The C Compiler implements objects of type \fBchar\fR as \fBunsigned\fR or
156 \fBsigned\fR respectively. This is really an implementation choice of the
157 compiler, but it is specified in the ABI and tends to be uniform across
158 compilers for an instruction set architecture.
164 \fB\fB_CHAR_ALIGNMENT\fR\fR
168 \fB\fB_SHORT_ALIGNMENT\fR\fR
172 \fB\fB_INT_ALIGNMENT\fR\fR
176 \fB\fB_LONG_ALIGNMENT\fR\fR
180 \fB\fB_LONG_LONG_ALIGNMENT\fR\fR
184 \fB\fB_DOUBLE_ALIGNMENT\fR\fR
188 \fB\fB_LONG_DOUBLE_ALIGNMENT\fR\fR
192 \fB\fB_POINTER_ALIGNMENT\fR\fR
196 \fB\fB_FLOAT_ALIGNMENT\fR\fR
199 The ABI defines alignment requirements of each of the primitive object types.
200 Some, if not all, might be hardware requirements as well. The values are
207 \fB\fB_MAX_ALIGNMENT\fR\fR
210 The most stringent alignment requirement as specified by the ABI. Equal to the
211 maximum of all the above _\fIXXX\fR_\fBALIGNMENT\fR values.
217 \fB\fB_LONG_LONG_ALIGNMENT_32\fR\fR
220 The 32-bit ABI supported by a 64-bit kernel may have different alignment
221 requirements for primitive object types. The value of this identifier is
228 The \fBdaddr_t\fR type is used for disk addresses except in an inode on disk.
229 Times are encoded in seconds since 00:00:00 UTC, January 1, 1970. The major and
230 minor parts of a device code specify kind and unit number of a device and are
231 installation-dependent. Offsets are measured in bytes from the beginning of a
235 The \fBlabel_t[\|]\fR types are used to save the processor state while another
239 \fBExample 1 \fRUse of preprocessor symbol \fB_LP64\fR.
242 In the following example, the preprocessor symbol \fB_LP64\fR defines sections
243 of code that will be compiled only as part of a 64-bit version of the given C
249 #include <sys/types.h>
253 printf("The data model is LP64 in this environment\en");
256 printf("The data model is ILP32 in this environment\en");
258 #error "Unknown data model!"
267 See \fBattributes\fR(5) for descriptions of the following attributes:
275 ATTRIBUTE TYPE ATTRIBUTE VALUE
277 Interface Stability Stable
283 \fBtypes32.h\fR(3HEAD), \fBattributes\fR(5), \fBstandards\fR(5)