]>
Commit | Line | Data |
---|---|---|
0ed99ce4 | 1 | /* Copyright (C) 1991,92,94,95,96,97,98,99,2000 Free Software Foundation, Inc. |
54d79e99 UD |
2 | This file is part of the GNU C Library. |
3 | ||
4 | The GNU C Library is free software; you can redistribute it and/or | |
5 | modify it under the terms of the GNU Library General Public License as | |
6 | published by the Free Software Foundation; either version 2 of the | |
7 | License, or (at your option) any later version. | |
8 | ||
9 | The GNU C Library is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | Library General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU Library General Public | |
15 | License along with the GNU C Library; see the file COPYING.LIB. If not, | |
16 | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
17 | Boston, MA 02111-1307, USA. */ | |
28f540f4 RM |
18 | |
19 | /* | |
20 | * POSIX Standard: 2.6 Primitive System Data Types <sys/types.h> | |
21 | */ | |
22 | ||
23 | #ifndef _SYS_TYPES_H | |
28f540f4 | 24 | #define _SYS_TYPES_H 1 |
5107cf1d | 25 | |
28f540f4 RM |
26 | #include <features.h> |
27 | ||
28 | __BEGIN_DECLS | |
29 | ||
5107cf1d | 30 | #include <bits/types.h> |
28f540f4 RM |
31 | |
32 | #ifdef __USE_BSD | |
c2cc0483 | 33 | # ifndef __u_char_defined |
a68b0d31 UD |
34 | typedef __u_char u_char; |
35 | typedef __u_short u_short; | |
36 | typedef __u_int u_int; | |
37 | typedef __u_long u_long; | |
38 | typedef __quad_t quad_t; | |
39 | typedef __u_quad_t u_quad_t; | |
40 | typedef __fsid_t fsid_t; | |
c2cc0483 UD |
41 | # define __u_char_defined |
42 | # endif | |
28f540f4 RM |
43 | #endif |
44 | ||
a68b0d31 | 45 | typedef __loff_t loff_t; |
a5a0310d | 46 | |
7df789e0 | 47 | #ifndef __ino_t_defined |
9756dfe1 | 48 | # ifndef __USE_FILE_OFFSET64 |
dfd2257a | 49 | typedef __ino_t ino_t; |
9756dfe1 | 50 | # else |
dfd2257a | 51 | typedef __ino64_t ino_t; |
9756dfe1 | 52 | # endif |
7df789e0 | 53 | # define __ino_t_defined |
dfd2257a | 54 | #endif |
8353b5f6 | 55 | #if defined __USE_LARGEFILE64 && !defined __ino64_t_defined |
dfd2257a | 56 | typedef __ino64_t ino64_t; |
8353b5f6 | 57 | # define __ino64_t_defined |
dfd2257a UD |
58 | #endif |
59 | ||
7df789e0 | 60 | #ifndef __dev_t_defined |
9756dfe1 | 61 | typedef __dev_t dev_t; |
7df789e0 | 62 | # define __dev_t_defined |
9756dfe1 UD |
63 | #endif |
64 | ||
7df789e0 | 65 | #ifndef __gid_t_defined |
a5a0310d | 66 | typedef __gid_t gid_t; |
7df789e0 | 67 | # define __gid_t_defined |
a5a0310d UD |
68 | #endif |
69 | ||
7df789e0 | 70 | #ifndef __mode_t_defined |
9756dfe1 | 71 | typedef __mode_t mode_t; |
7df789e0 | 72 | # define __mode_t_defined |
9756dfe1 UD |
73 | #endif |
74 | ||
7df789e0 | 75 | #ifndef __nlink_t_defined |
9756dfe1 | 76 | typedef __nlink_t nlink_t; |
7df789e0 | 77 | # define __nlink_t_defined |
9756dfe1 UD |
78 | #endif |
79 | ||
7df789e0 | 80 | #ifndef __uid_t_defined |
a68b0d31 | 81 | typedef __uid_t uid_t; |
7df789e0 | 82 | # define __uid_t_defined |
a5a0310d UD |
83 | #endif |
84 | ||
7df789e0 | 85 | #ifndef __off_t_defined |
dfd2257a | 86 | # ifndef __USE_FILE_OFFSET64 |
a5a0310d | 87 | typedef __off_t off_t; |
dfd2257a UD |
88 | # else |
89 | typedef __off64_t off_t; | |
90 | # endif | |
7df789e0 | 91 | # define __off_t_defined |
a5a0310d | 92 | #endif |
7df789e0 | 93 | #if defined __USE_LARGEFILE64 && !defined __off64_t_defined |
dfd2257a | 94 | typedef __off64_t off64_t; |
7df789e0 | 95 | # define __off64_t_defined |
dfd2257a | 96 | #endif |
a5a0310d | 97 | |
7df789e0 | 98 | #ifndef __pid_t_defined |
a5a0310d | 99 | typedef __pid_t pid_t; |
7df789e0 | 100 | # define __pid_t_defined |
a5a0310d | 101 | #endif |
a68b0d31 | 102 | |
0ed99ce4 | 103 | #if (defined __USE_SVID || defined __USE_XOPEN) && !defined __id_t_defined |
bd355af0 | 104 | typedef __id_t id_t; |
0ed99ce4 | 105 | # define __id_t_defined |
bd355af0 UD |
106 | #endif |
107 | ||
7df789e0 | 108 | #ifndef __ssize_t_defined |
a68b0d31 | 109 | typedef __ssize_t ssize_t; |
7df789e0 | 110 | # define __ssize_t_defined |
28f540f4 RM |
111 | #endif |
112 | ||
113 | #ifdef __USE_BSD | |
c2cc0483 | 114 | # ifndef __daddr_t_defined |
a68b0d31 UD |
115 | typedef __daddr_t daddr_t; |
116 | typedef __caddr_t caddr_t; | |
c2cc0483 UD |
117 | # define __daddr_t_defined |
118 | # endif | |
a68b0d31 UD |
119 | #endif |
120 | ||
219aa9e9 | 121 | #if (defined __USE_SVID || defined __USE_XOPEN) && !defined __key_t_defined |
a68b0d31 | 122 | typedef __key_t key_t; |
219aa9e9 | 123 | # define __key_t_defined |
28f540f4 RM |
124 | #endif |
125 | ||
9756dfe1 UD |
126 | #ifdef __USE_XOPEN |
127 | # define __need_clock_t | |
128 | #endif | |
28f540f4 | 129 | #define __need_time_t |
91bc38d0 UD |
130 | #define __need_timer_t |
131 | #define __need_clockid_t | |
28f540f4 RM |
132 | #include <time.h> |
133 | ||
57fb9b38 | 134 | #ifdef __USE_XOPEN |
7707af89 UD |
135 | # ifndef __useconds_t_defined |
136 | typedef __useconds_t useconds_t; | |
137 | # define __useconds_t_defined | |
138 | # endif | |
0ed99ce4 | 139 | # ifndef __suseconds_t_defined |
57fb9b38 | 140 | typedef __suseconds_t suseconds_t; |
0ed99ce4 UD |
141 | # define __suseconds_t_defined |
142 | # endif | |
57fb9b38 UD |
143 | #endif |
144 | ||
28f540f4 RM |
145 | #define __need_size_t |
146 | #include <stddef.h> | |
147 | ||
148 | #ifdef __USE_MISC | |
149 | /* Old compatibility names for C types. */ | |
510ca033 | 150 | typedef unsigned long int ulong; |
28f540f4 RM |
151 | typedef unsigned short int ushort; |
152 | typedef unsigned int uint; | |
153 | #endif | |
154 | ||
28f540f4 RM |
155 | /* These size-specific names are used by some of the inet code. */ |
156 | ||
4360eafd | 157 | #if !__GNUC_PREREQ (2, 7) |
4ca84cff | 158 | |
63ae7b63 | 159 | /* These types are defined by the ISO C99 header <inttypes.h>. */ |
55c14926 UD |
160 | # ifndef __int8_t_defined |
161 | # define __int8_t_defined | |
28f540f4 | 162 | typedef char int8_t; |
3d61b63c | 163 | typedef short int int16_t; |
3d61b63c | 164 | typedef int int32_t; |
55c14926 | 165 | # ifdef __GNUC__ |
7782d0bf | 166 | __extension__ typedef long long int int64_t; |
55c14926 UD |
167 | # endif |
168 | # endif | |
5107cf1d UD |
169 | |
170 | /* But these were defined by ISO C without the first `_'. */ | |
171 | typedef unsigned char u_int8_t; | |
172 | typedef unsigned short int u_int16_t; | |
173 | typedef unsigned int u_int32_t; | |
55c14926 | 174 | # ifdef __GNUC__ |
7782d0bf | 175 | __extension__ typedef unsigned long long int u_int64_t; |
55c14926 | 176 | # endif |
5107cf1d | 177 | |
a68b0d31 | 178 | typedef int register_t; |
3d61b63c | 179 | |
4ca84cff RM |
180 | #else |
181 | ||
182 | /* For GCC 2.7 and later, we can use specific type-size attributes. */ | |
55c14926 | 183 | # define __intN_t(N, MODE) \ |
4ca84cff | 184 | typedef int int##N##_t __attribute__ ((__mode__ (MODE))) |
55c14926 | 185 | # define __u_intN_t(N, MODE) \ |
4ca84cff RM |
186 | typedef unsigned int u_int##N##_t __attribute__ ((__mode__ (MODE))) |
187 | ||
55c14926 UD |
188 | # ifndef __int8_t_defined |
189 | # define __int8_t_defined | |
4ca84cff | 190 | __intN_t (8, __QI__); |
4ca84cff | 191 | __intN_t (16, __HI__); |
4ca84cff | 192 | __intN_t (32, __SI__); |
4ca84cff | 193 | __intN_t (64, __DI__); |
55c14926 | 194 | # endif |
5107cf1d UD |
195 | |
196 | __u_intN_t (8, __QI__); | |
197 | __u_intN_t (16, __HI__); | |
198 | __u_intN_t (32, __SI__); | |
4ca84cff RM |
199 | __u_intN_t (64, __DI__); |
200 | ||
201 | typedef int register_t __attribute__ ((__mode__ (__word__))); | |
202 | ||
4ca84cff | 203 | |
3d61b63c RM |
204 | /* Some code from BIND tests this macro to see if the types above are |
205 | defined. */ | |
28f540f4 | 206 | #endif |
55c14926 | 207 | #define __BIT_TYPES_DEFINED__ 1 |
28f540f4 RM |
208 | |
209 | ||
fc4026d8 RM |
210 | #ifdef __USE_BSD |
211 | /* In BSD <sys/types.h> is expected to define BYTE_ORDER. */ | |
55c14926 | 212 | # include <endian.h> |
28f540f4 | 213 | |
503054c0 | 214 | /* It also defines `fd_set' and the FD_* macros for `select'. */ |
55c14926 | 215 | # include <sys/select.h> |
d1462d2e UD |
216 | |
217 | /* BSD defines these symbols, so we follow. */ | |
218 | # include <sys/sysmacros.h> | |
28f540f4 RM |
219 | #endif /* Use BSD. */ |
220 | ||
221 | ||
219aa9e9 UD |
222 | #if defined __USE_UNIX98 && !defined __blksize_t_defined |
223 | typedef __blksize_t blksize_t; | |
224 | # define __blksize_t_defined | |
225 | #endif | |
226 | ||
dfd2257a UD |
227 | /* Types from the Large File Support interface. */ |
228 | #ifndef __USE_FILE_OFFSET64 | |
219aa9e9 | 229 | # ifndef __blkcnt_t_defined |
dfd2257a | 230 | typedef __blkcnt_t blkcnt_t; /* Type to count number of disk blocks. */ |
219aa9e9 UD |
231 | # define __blkcnt_t_defined |
232 | # endif | |
0ed99ce4 | 233 | # ifndef __fsblkcnt_t_defined |
dfd2257a | 234 | typedef __fsblkcnt_t fsblkcnt_t; /* Type to count file system blocks. */ |
0ed99ce4 UD |
235 | # define __fsblkcnt_t_defined |
236 | # endif | |
237 | # ifndef __fsfilcnt_t_defined | |
dfd2257a | 238 | typedef __fsfilcnt_t fsfilcnt_t; /* Type to count file system inodes. */ |
0ed99ce4 UD |
239 | # define __fsfilcnt_t_defined |
240 | # endif | |
dfd2257a | 241 | #else |
219aa9e9 | 242 | # ifndef __blkcnt_t_defined |
dfd2257a | 243 | typedef __blkcnt64_t blkcnt_t; /* Type to count number of disk blocks. */ |
219aa9e9 UD |
244 | # define __blkcnt_t_defined |
245 | # endif | |
0ed99ce4 | 246 | # ifndef __fsblkcnt_t_defined |
dfd2257a | 247 | typedef __fsblkcnt64_t fsblkcnt_t; /* Type to count file system blocks. */ |
0ed99ce4 UD |
248 | # define __fsblkcnt_t_defined |
249 | # endif | |
250 | # ifndef __fsfilcnt_t_defined | |
dfd2257a | 251 | typedef __fsfilcnt64_t fsfilcnt_t; /* Type to count file system inodes. */ |
0ed99ce4 UD |
252 | # define __fsfilcnt_t_defined |
253 | # endif | |
dfd2257a UD |
254 | #endif |
255 | ||
256 | #ifdef __USE_LARGEFILE64 | |
257 | typedef __blkcnt64_t blkcnt64_t; /* Type to count number of disk blocks. */ | |
258 | typedef __fsblkcnt64_t fsblkcnt64_t; /* Type to count file system blocks. */ | |
259 | typedef __fsfilcnt64_t fsfilcnt64_t; /* Type to count file system inodes. */ | |
260 | #endif | |
261 | ||
28f540f4 RM |
262 | __END_DECLS |
263 | ||
264 | #endif /* sys/types.h */ |