1 /* bits/types.h -- definitions of __*_t types underlying *_t types.
2 Copyright (C) 2002 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
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.
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
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 * Never include this file directly; use <sys/types.h> instead.
25 #define _BITS_TYPES_H 1
28 #include <bits/wordsize.h>
33 /* Convenience types. */
34 typedef unsigned char __u_char
;
35 typedef unsigned short int __u_short
;
36 typedef unsigned int __u_int
;
37 typedef unsigned long int __u_long
;
39 /* Fixed-size types, underlying types depend on word size and compiler. */
40 typedef signed char __int8_t
;
41 typedef unsigned char __uint8_t
;
42 typedef signed short int __int16_t
;
43 typedef unsigned short int __uint16_t
;
44 typedef signed int __int32_t
;
45 typedef unsigned int __uint32_t
;
47 typedef signed long int __int64_t
;
48 typedef unsigned long int __uint64_t
;
49 #elif defined __GLIBC_HAVE_LONG_LONG
50 __extension__
typedef signed long long int __int64_t
;
51 __extension__
typedef unsigned long long int __uint64_t
;
54 /* quad_t is also 64 bits, but is traditionally defined as `long long'
55 even when `long' is also 64 bits. */
56 #ifdef __GLIBC_HAVE_LONG_LONG
57 __extension__
typedef long long int __quad_t
;
58 __extension__
typedef unsigned long long int __u_quad_t
;
59 #elif __WORDSIZE == 64
60 typedef long int __quad_t
;
61 typedef unsigned long int __u_quad_t
;
74 /* The machine-dependent file <bits/typesizes.h> defines __*_T_TYPE
75 macros for each of the OS types we define below. The definitions
76 of those macros must use the following macros for underlying types.
77 We define __S<SIZE>_TYPE and __U<SIZE>_TYPE for the signed and unsigned
78 variants of each of the following integer types on this machine.
80 16 -- "natural" 16-bit type (always short)
81 32 -- "natural" 32-bit type (always int)
82 64 -- "natural" 64-bit type (long or long long)
83 LONG32 -- 32-bit type, traditionally long
84 QUAD -- 64-bit type, always long long
85 WORD -- natural type of __WORDSIZE bits (int or long)
86 LONGWORD -- type of __WORDSIZE bits, traditionally long
88 We distinguish WORD/LONGWORD, 32/LONG32, and 64/QUAD so that the
89 conventional uses of `long' or `long long' type modifiers match the
90 types we define, even when a less-adorned type would be the same size.
91 This matters for (somewhat) portably writing printf/scanf formats for
92 these types, where using the appropriate l or ll format modifiers can
93 make the typedefs and the formats match up across all GNU platforms. If
94 we used `long' when it's 64 bits where `long long' is expected, then the
95 compiler would warn about the formats not matching the argument types,
96 and the programmer changing them to shut up the compiler would break the
97 program's portability.
99 Here we assume what is presently the case in all the GCC configurations
100 we support: long long is always 64 bits, long is always word/address size,
101 and int is always 32 bits. */
103 #define __S16_TYPE short int
104 #define __U16_TYPE unsigned short int
105 #define __S32_TYPE int
106 #define __U32_TYPE unsigned int
107 #define __SLONGWORD_TYPE long int
108 #define __ULONGWORD_TYPE unsigned long int
109 #define __SQUAD_TYPE long long int
110 #define __UQUAD_TYPE unsigned long long int
112 # define __SWORD_TYPE int
113 # define __UWORD_TYPE unsigned int
114 # define __SLONG32_TYPE long int
115 # define __ULONG32_TYPE unsigned long int
116 # define __S64_TYPE __quad_t
117 # define __U64_TYPE __u_quad_t
118 #elif __WORDSIZE == 64
119 # define __SWORD_TYPE long int
120 # define __UWORD_TYPE unsigned long int
121 # define __SLONG32_TYPE int
122 # define __ULONG32_TYPE unsigned int
123 # define __S64_TYPE long int
124 # define __U64_TYPE unsigned long int
128 #include <bits/typesizes.h> /* Defines __*_T_TYPE macros. */
131 typedef __DEV_T_TYPE __dev_t
; /* Type of device numbers. */
132 typedef __UID_T_TYPE __uid_t
; /* Type of user identifications. */
133 typedef __GID_T_TYPE __gid_t
; /* Type of group identifications. */
134 typedef __INO_T_TYPE __ino_t
; /* Type of file serial numbers. */
135 typedef __INO64_T_TYPE __ino64_t
; /* Type of file serial numbers (LFS). */
136 typedef __MODE_T_TYPE __mode_t
; /* Type of file attribute bitmasks. */
137 typedef __NLINK_T_TYPE __nlink_t
; /* Type of file link counts. */
138 typedef __OFF_T_TYPE __off_t
; /* Type of file sizes and offsets. */
139 typedef __OFF64_T_TYPE __off64_t
; /* Type of file sizes and offsets (LFS). */
140 typedef __PID_T_TYPE __pid_t
; /* Type of process identifications. */
141 typedef __FSID_T_TYPE __fsid_t
; /* Type of file system IDs. */
142 typedef __CLOCK_T_TYPE __clock_t
; /* Type of CPU usage counts. */
143 typedef __RLIM_T_TYPE __rlim_t
; /* Type for resource measurement. */
144 typedef __RLIM64_T_TYPE __rlim64_t
; /* Type for resource measurement (LFS). */
145 typedef __ID_T_TYPE __id_t
; /* General type for IDs. */
146 typedef __TIME_T_TYPE __time_t
; /* Seconds since the Epoch. */
147 typedef __USECONDS_T_TYPE __useconds_t
; /* Count of microseconds. */
148 typedef __SUSECONDS_T_TYPE __suseconds_t
; /* Signed count of microseconds. */
150 typedef __DADDR_T_TYPE __daddr_t
; /* The type of a disk address. */
151 typedef __SWBLK_T_TYPE __swblk_t
; /* Type of a swap block maybe? */
152 typedef __KEY_T_TYPE __key_t
; /* Type of an IPC key */
154 /* Clock ID used in clock and timer functions. */
155 typedef __CLOCKID_T_TYPE __clockid_t
;
157 /* Timer ID returned by `timer_create'. */
158 typedef __TIMER_T_TYPE __timer_t
;
160 /* Type to represent block size. */
161 typedef __BLKSIZE_T_TYPE __blksize_t
;
163 /* Types from the Large File Support interface. */
165 /* Type to count number of disk blocks. */
166 typedef __BLKCNT_T_TYPE __blkcnt_t
;
167 typedef __BLKCNT64_T_TYPE __blkcnt64_t
;
169 /* Type to count file system blocks. */
170 typedef __FSBLKCNT_T_TYPE __fsblkcnt_t
;
171 typedef __FSBLKCNT64_T_TYPE __fsblkcnt64_t
;
173 /* Type to count file system nodes. */
174 typedef __FSFILCNT_T_TYPE __fsfilcnt_t
;
175 typedef __FSFILCNT64_T_TYPE __fsfilcnt64_t
;
178 /* These few don't really vary by system, they always correspond
179 to one of the other defined types. */
180 typedef __SWORD_TYPE __ssize_t
; /* Type of a byte count, or error. */
181 typedef __off64_t __loff_t
; /* Type of file sizes and offsets (LFS). */
182 typedef __quad_t
*__qaddr_t
;
183 typedef char *__caddr_t
;
185 /* Duplicates info from stdint.h but this is used in unistd.h. */
186 typedef __SWORD_TYPE __intptr_t
;
188 /* Duplicate info from sys/socket.h. */
189 typedef __U32_TYPE __socklen_t
;
192 #endif /* bits/types.h */