]>
Commit | Line | Data |
---|---|---|
3efdabe7 | 1 | /* bits/types.h -- definitions of __*_t types underlying *_t types. |
d4697bc9 | 2 | Copyright (C) 2002-2014 Free Software Foundation, Inc. |
54d79e99 | 3 | This file is part of the GNU C Library. |
28f540f4 | 4 | |
54d79e99 | 5 | The GNU C Library is free software; you can redistribute it and/or |
41bdb6e2 AJ |
6 | modify it under the terms of the GNU Lesser General Public |
7 | License as published by the Free Software Foundation; either | |
8 | version 2.1 of the License, or (at your option) any later version. | |
28f540f4 | 9 | |
54d79e99 UD |
10 | The GNU C Library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
41bdb6e2 | 13 | Lesser General Public License for more details. |
28f540f4 | 14 | |
41bdb6e2 | 15 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 PE |
16 | License along with the GNU C Library; if not, see |
17 | <http://www.gnu.org/licenses/>. */ | |
28f540f4 | 18 | |
5107cf1d UD |
19 | /* |
20 | * Never include this file directly; use <sys/types.h> instead. | |
21 | */ | |
28f540f4 | 22 | |
5107cf1d UD |
23 | #ifndef _BITS_TYPES_H |
24 | #define _BITS_TYPES_H 1 | |
28f540f4 | 25 | |
5d47ceca | 26 | #include <features.h> |
3efdabe7 | 27 | #include <bits/wordsize.h> |
5d47ceca | 28 | |
28f540f4 RM |
29 | /* Convenience types. */ |
30 | typedef unsigned char __u_char; | |
3efdabe7 | 31 | typedef unsigned short int __u_short; |
28f540f4 | 32 | typedef unsigned int __u_int; |
3efdabe7 RM |
33 | typedef unsigned long int __u_long; |
34 | ||
35 | /* Fixed-size types, underlying types depend on word size and compiler. */ | |
36 | typedef signed char __int8_t; | |
37 | typedef unsigned char __uint8_t; | |
38 | typedef signed short int __int16_t; | |
39 | typedef unsigned short int __uint16_t; | |
40 | typedef signed int __int32_t; | |
41 | typedef unsigned int __uint32_t; | |
42 | #if __WORDSIZE == 64 | |
43 | typedef signed long int __int64_t; | |
44 | typedef unsigned long int __uint64_t; | |
6a57d931 | 45 | #else |
3efdabe7 RM |
46 | __extension__ typedef signed long long int __int64_t; |
47 | __extension__ typedef unsigned long long int __uint64_t; | |
48 | #endif | |
49 | ||
806e4a4a UD |
50 | /* quad_t is also 64 bits. */ |
51 | #if __WORDSIZE == 64 | |
3efdabe7 RM |
52 | typedef long int __quad_t; |
53 | typedef unsigned long int __u_quad_t; | |
6a57d931 | 54 | #else |
806e4a4a UD |
55 | __extension__ typedef long long int __quad_t; |
56 | __extension__ typedef unsigned long long int __u_quad_t; | |
28f540f4 | 57 | #endif |
5d47ceca | 58 | |
3efdabe7 RM |
59 | |
60 | /* The machine-dependent file <bits/typesizes.h> defines __*_T_TYPE | |
61 | macros for each of the OS types we define below. The definitions | |
62 | of those macros must use the following macros for underlying types. | |
63 | We define __S<SIZE>_TYPE and __U<SIZE>_TYPE for the signed and unsigned | |
64 | variants of each of the following integer types on this machine. | |
65 | ||
66 | 16 -- "natural" 16-bit type (always short) | |
67 | 32 -- "natural" 32-bit type (always int) | |
68 | 64 -- "natural" 64-bit type (long or long long) | |
69 | LONG32 -- 32-bit type, traditionally long | |
70 | QUAD -- 64-bit type, always long long | |
71 | WORD -- natural type of __WORDSIZE bits (int or long) | |
72 | LONGWORD -- type of __WORDSIZE bits, traditionally long | |
73 | ||
74 | We distinguish WORD/LONGWORD, 32/LONG32, and 64/QUAD so that the | |
75 | conventional uses of `long' or `long long' type modifiers match the | |
76 | types we define, even when a less-adorned type would be the same size. | |
77 | This matters for (somewhat) portably writing printf/scanf formats for | |
78 | these types, where using the appropriate l or ll format modifiers can | |
79 | make the typedefs and the formats match up across all GNU platforms. If | |
80 | we used `long' when it's 64 bits where `long long' is expected, then the | |
81 | compiler would warn about the formats not matching the argument types, | |
82 | and the programmer changing them to shut up the compiler would break the | |
83 | program's portability. | |
84 | ||
85 | Here we assume what is presently the case in all the GCC configurations | |
86 | we support: long long is always 64 bits, long is always word/address size, | |
87 | and int is always 32 bits. */ | |
88 | ||
89 | #define __S16_TYPE short int | |
90 | #define __U16_TYPE unsigned short int | |
91 | #define __S32_TYPE int | |
92 | #define __U32_TYPE unsigned int | |
93 | #define __SLONGWORD_TYPE long int | |
94 | #define __ULONGWORD_TYPE unsigned long int | |
3efdabe7 | 95 | #if __WORDSIZE == 32 |
a1d335d6 UD |
96 | # define __SQUAD_TYPE __quad_t |
97 | # define __UQUAD_TYPE __u_quad_t | |
3efdabe7 RM |
98 | # define __SWORD_TYPE int |
99 | # define __UWORD_TYPE unsigned int | |
100 | # define __SLONG32_TYPE long int | |
101 | # define __ULONG32_TYPE unsigned long int | |
102 | # define __S64_TYPE __quad_t | |
103 | # define __U64_TYPE __u_quad_t | |
553cc5f9 UD |
104 | /* We want __extension__ before typedef's that use nonstandard base types |
105 | such as `long long' in C89 mode. */ | |
106 | # define __STD_TYPE __extension__ typedef | |
3efdabe7 | 107 | #elif __WORDSIZE == 64 |
806e4a4a UD |
108 | # define __SQUAD_TYPE long int |
109 | # define __UQUAD_TYPE unsigned long int | |
3efdabe7 RM |
110 | # define __SWORD_TYPE long int |
111 | # define __UWORD_TYPE unsigned long int | |
112 | # define __SLONG32_TYPE int | |
113 | # define __ULONG32_TYPE unsigned int | |
114 | # define __S64_TYPE long int | |
115 | # define __U64_TYPE unsigned long int | |
553cc5f9 UD |
116 | /* No need to mark the typedef with __extension__. */ |
117 | # define __STD_TYPE typedef | |
3efdabe7 RM |
118 | #else |
119 | # error | |
120 | #endif | |
121 | #include <bits/typesizes.h> /* Defines __*_T_TYPE macros. */ | |
122 | ||
bba446f7 RM |
123 | |
124 | __STD_TYPE __DEV_T_TYPE __dev_t; /* Type of device numbers. */ | |
125 | __STD_TYPE __UID_T_TYPE __uid_t; /* Type of user identifications. */ | |
126 | __STD_TYPE __GID_T_TYPE __gid_t; /* Type of group identifications. */ | |
127 | __STD_TYPE __INO_T_TYPE __ino_t; /* Type of file serial numbers. */ | |
128 | __STD_TYPE __INO64_T_TYPE __ino64_t; /* Type of file serial numbers (LFS).*/ | |
129 | __STD_TYPE __MODE_T_TYPE __mode_t; /* Type of file attribute bitmasks. */ | |
130 | __STD_TYPE __NLINK_T_TYPE __nlink_t; /* Type of file link counts. */ | |
131 | __STD_TYPE __OFF_T_TYPE __off_t; /* Type of file sizes and offsets. */ | |
132 | __STD_TYPE __OFF64_T_TYPE __off64_t; /* Type of file sizes and offsets (LFS). */ | |
133 | __STD_TYPE __PID_T_TYPE __pid_t; /* Type of process identifications. */ | |
134 | __STD_TYPE __FSID_T_TYPE __fsid_t; /* Type of file system IDs. */ | |
135 | __STD_TYPE __CLOCK_T_TYPE __clock_t; /* Type of CPU usage counts. */ | |
136 | __STD_TYPE __RLIM_T_TYPE __rlim_t; /* Type for resource measurement. */ | |
137 | __STD_TYPE __RLIM64_T_TYPE __rlim64_t; /* Type for resource measurement (LFS). */ | |
138 | __STD_TYPE __ID_T_TYPE __id_t; /* General type for IDs. */ | |
139 | __STD_TYPE __TIME_T_TYPE __time_t; /* Seconds since the Epoch. */ | |
140 | __STD_TYPE __USECONDS_T_TYPE __useconds_t; /* Count of microseconds. */ | |
141 | __STD_TYPE __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds. */ | |
142 | ||
143 | __STD_TYPE __DADDR_T_TYPE __daddr_t; /* The type of a disk address. */ | |
bba446f7 | 144 | __STD_TYPE __KEY_T_TYPE __key_t; /* Type of an IPC key. */ |
5d47ceca | 145 | |
724000bc | 146 | /* Clock ID used in clock and timer functions. */ |
bba446f7 | 147 | __STD_TYPE __CLOCKID_T_TYPE __clockid_t; |
724000bc MK |
148 | |
149 | /* Timer ID returned by `timer_create'. */ | |
bba446f7 | 150 | __STD_TYPE __TIMER_T_TYPE __timer_t; |
dfd2257a | 151 | |
219aa9e9 | 152 | /* Type to represent block size. */ |
bba446f7 | 153 | __STD_TYPE __BLKSIZE_T_TYPE __blksize_t; |
219aa9e9 | 154 | |
dfd2257a UD |
155 | /* Types from the Large File Support interface. */ |
156 | ||
3efdabe7 | 157 | /* Type to count number of disk blocks. */ |
bba446f7 RM |
158 | __STD_TYPE __BLKCNT_T_TYPE __blkcnt_t; |
159 | __STD_TYPE __BLKCNT64_T_TYPE __blkcnt64_t; | |
dfd2257a UD |
160 | |
161 | /* Type to count file system blocks. */ | |
bba446f7 RM |
162 | __STD_TYPE __FSBLKCNT_T_TYPE __fsblkcnt_t; |
163 | __STD_TYPE __FSBLKCNT64_T_TYPE __fsblkcnt64_t; | |
dfd2257a | 164 | |
3efdabe7 | 165 | /* Type to count file system nodes. */ |
bba446f7 RM |
166 | __STD_TYPE __FSFILCNT_T_TYPE __fsfilcnt_t; |
167 | __STD_TYPE __FSFILCNT64_T_TYPE __fsfilcnt64_t; | |
dfd2257a | 168 | |
3e5aef87 L |
169 | /* Type of miscellaneous file system fields. */ |
170 | __STD_TYPE __FSWORD_T_TYPE __fsword_t; | |
171 | ||
973d66e4 | 172 | __STD_TYPE __SSIZE_T_TYPE __ssize_t; /* Type of a byte count, or error. */ |
3efdabe7 | 173 | |
de986b56 L |
174 | /* Signed long type used in system calls. */ |
175 | __STD_TYPE __SYSCALL_SLONG_TYPE __syscall_slong_t; | |
176 | /* Unsigned long type used in system calls. */ | |
177 | __STD_TYPE __SYSCALL_ULONG_TYPE __syscall_ulong_t; | |
178 | ||
3efdabe7 RM |
179 | /* These few don't really vary by system, they always correspond |
180 | to one of the other defined types. */ | |
3efdabe7 RM |
181 | typedef __off64_t __loff_t; /* Type of file sizes and offsets (LFS). */ |
182 | typedef __quad_t *__qaddr_t; | |
183 | typedef char *__caddr_t; | |
af69217f | 184 | |
5d47ceca | 185 | /* Duplicates info from stdint.h but this is used in unistd.h. */ |
bba446f7 | 186 | __STD_TYPE __SWORD_TYPE __intptr_t; |
4bae5567 | 187 | |
750f9af6 | 188 | /* Duplicate info from sys/socket.h. */ |
bba446f7 RM |
189 | __STD_TYPE __U32_TYPE __socklen_t; |
190 | ||
3efdabe7 | 191 | |
bba446f7 | 192 | #undef __STD_TYPE |
750f9af6 | 193 | |
5107cf1d | 194 | #endif /* bits/types.h */ |