1 | /* Copyright (C) 1991-2018 Free Software Foundation, Inc. |
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 Lesser General Public |
6 | License as published by the Free Software Foundation; either |
7 | version 2.1 of the 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 | Lesser General Public License for more details. |
13 | |
14 | You should have received a copy of the GNU Lesser General Public |
15 | License along with the GNU C Library; if not, see |
16 | <http://www.gnu.org/licenses/>. */ |
17 | |
18 | /* |
19 | * POSIX Standard: 2.6 Primitive System Data Types <sys/types.h> |
20 | */ |
21 | |
22 | #ifndef _SYS_TYPES_H |
23 | #define _SYS_TYPES_H 1 |
24 | |
25 | #include <features.h> |
26 | |
27 | __BEGIN_DECLS |
28 | |
29 | #include <bits/types.h> |
30 | |
31 | #ifdef __USE_MISC |
32 | # ifndef __u_char_defined |
33 | typedef __u_char u_char; |
34 | typedef __u_short u_short; |
35 | typedef __u_int u_int; |
36 | typedef __u_long u_long; |
37 | typedef __quad_t quad_t; |
38 | typedef __u_quad_t u_quad_t; |
39 | typedef __fsid_t fsid_t; |
40 | # define __u_char_defined |
41 | # endif |
42 | typedef __loff_t loff_t; |
43 | #endif |
44 | |
45 | #ifndef __ino_t_defined |
46 | # ifndef __USE_FILE_OFFSET64 |
47 | typedef __ino_t ino_t; |
48 | # else |
49 | typedef __ino64_t ino_t; |
50 | # endif |
51 | # define __ino_t_defined |
52 | #endif |
53 | #if defined __USE_LARGEFILE64 && !defined __ino64_t_defined |
54 | typedef __ino64_t ino64_t; |
55 | # define __ino64_t_defined |
56 | #endif |
57 | |
58 | #ifndef __dev_t_defined |
59 | typedef __dev_t dev_t; |
60 | # define __dev_t_defined |
61 | #endif |
62 | |
63 | #ifndef __gid_t_defined |
64 | typedef __gid_t gid_t; |
65 | # define __gid_t_defined |
66 | #endif |
67 | |
68 | #ifndef __mode_t_defined |
69 | typedef __mode_t mode_t; |
70 | # define __mode_t_defined |
71 | #endif |
72 | |
73 | #ifndef __nlink_t_defined |
74 | typedef __nlink_t nlink_t; |
75 | # define __nlink_t_defined |
76 | #endif |
77 | |
78 | #ifndef __uid_t_defined |
79 | typedef __uid_t uid_t; |
80 | # define __uid_t_defined |
81 | #endif |
82 | |
83 | #ifndef __off_t_defined |
84 | # ifndef __USE_FILE_OFFSET64 |
85 | typedef __off_t off_t; |
86 | # else |
87 | typedef __off64_t off_t; |
88 | # endif |
89 | # define __off_t_defined |
90 | #endif |
91 | #if defined __USE_LARGEFILE64 && !defined __off64_t_defined |
92 | typedef __off64_t off64_t; |
93 | # define __off64_t_defined |
94 | #endif |
95 | |
96 | #ifndef __pid_t_defined |
97 | typedef __pid_t pid_t; |
98 | # define __pid_t_defined |
99 | #endif |
100 | |
101 | #if (defined __USE_XOPEN || defined __USE_XOPEN2K8) \ |
102 | && !defined __id_t_defined |
103 | typedef __id_t id_t; |
104 | # define __id_t_defined |
105 | #endif |
106 | |
107 | #ifndef __ssize_t_defined |
108 | typedef __ssize_t ssize_t; |
109 | # define __ssize_t_defined |
110 | #endif |
111 | |
112 | #ifdef __USE_MISC |
113 | # ifndef __daddr_t_defined |
114 | typedef __daddr_t daddr_t; |
115 | typedef __caddr_t caddr_t; |
116 | # define __daddr_t_defined |
117 | # endif |
118 | #endif |
119 | |
120 | #if (defined __USE_MISC || defined __USE_XOPEN) && !defined __key_t_defined |
121 | typedef __key_t key_t; |
122 | # define __key_t_defined |
123 | #endif |
124 | |
125 | #if defined __USE_XOPEN || defined __USE_XOPEN2K8 |
126 | # include <bits/types/clock_t.h> |
127 | #endif |
128 | #include <bits/types/clockid_t.h> |
129 | #include <bits/types/time_t.h> |
130 | #include <bits/types/timer_t.h> |
131 | |
132 | #ifdef __USE_XOPEN |
133 | # ifndef __useconds_t_defined |
134 | typedef __useconds_t useconds_t; |
135 | # define __useconds_t_defined |
136 | # endif |
137 | # ifndef __suseconds_t_defined |
138 | typedef __suseconds_t suseconds_t; |
139 | # define __suseconds_t_defined |
140 | # endif |
141 | #endif |
142 | |
143 | #define __need_size_t |
144 | #include <stddef.h> |
145 | |
146 | #ifdef __USE_MISC |
147 | /* Old compatibility names for C types. */ |
148 | typedef unsigned long int ulong; |
149 | typedef unsigned short int ushort; |
150 | typedef unsigned int uint; |
151 | #endif |
152 | |
153 | /* These size-specific names are used by some of the inet code. */ |
154 | |
155 | #include <bits/stdint-intn.h> |
156 | |
157 | #if !__GNUC_PREREQ (2, 7) |
158 | |
159 | /* These were defined by ISO C without the first `_'. */ |
160 | typedef unsigned char u_int8_t; |
161 | typedef unsigned short int u_int16_t; |
162 | typedef unsigned int u_int32_t; |
163 | # if __WORDSIZE == 64 |
164 | typedef unsigned long int u_int64_t; |
165 | # else |
166 | __extension__ typedef unsigned long long int u_int64_t; |
167 | # endif |
168 | |
169 | typedef int register_t; |
170 | |
171 | #else |
172 | |
173 | /* For GCC 2.7 and later, we can use specific type-size attributes. */ |
174 | # define __u_intN_t(N, MODE) \ |
175 | typedef unsigned int u_int##N##_t __attribute__ ((__mode__ (MODE))) |
176 | |
177 | __u_intN_t (8, __QI__); |
178 | __u_intN_t (16, __HI__); |
179 | __u_intN_t (32, __SI__); |
180 | __u_intN_t (64, __DI__); |
181 | |
182 | typedef int register_t __attribute__ ((__mode__ (__word__))); |
183 | |
184 | |
185 | /* Some code from BIND tests this macro to see if the types above are |
186 | defined. */ |
187 | #endif |
188 | #define __BIT_TYPES_DEFINED__ 1 |
189 | |
190 | |
191 | #ifdef __USE_MISC |
192 | /* In BSD <sys/types.h> is expected to define BYTE_ORDER. */ |
193 | # include <endian.h> |
194 | |
195 | /* It also defines `fd_set' and the FD_* macros for `select'. */ |
196 | # include <sys/select.h> |
197 | #endif /* Use misc. */ |
198 | |
199 | |
200 | #if (defined __USE_UNIX98 || defined __USE_XOPEN2K8) \ |
201 | && !defined __blksize_t_defined |
202 | typedef __blksize_t blksize_t; |
203 | # define __blksize_t_defined |
204 | #endif |
205 | |
206 | /* Types from the Large File Support interface. */ |
207 | #ifndef __USE_FILE_OFFSET64 |
208 | # ifndef __blkcnt_t_defined |
209 | typedef __blkcnt_t blkcnt_t; /* Type to count number of disk blocks. */ |
210 | # define __blkcnt_t_defined |
211 | # endif |
212 | # ifndef __fsblkcnt_t_defined |
213 | typedef __fsblkcnt_t fsblkcnt_t; /* Type to count file system blocks. */ |
214 | # define __fsblkcnt_t_defined |
215 | # endif |
216 | # ifndef __fsfilcnt_t_defined |
217 | typedef __fsfilcnt_t fsfilcnt_t; /* Type to count file system inodes. */ |
218 | # define __fsfilcnt_t_defined |
219 | # endif |
220 | #else |
221 | # ifndef __blkcnt_t_defined |
222 | typedef __blkcnt64_t blkcnt_t; /* Type to count number of disk blocks. */ |
223 | # define __blkcnt_t_defined |
224 | # endif |
225 | # ifndef __fsblkcnt_t_defined |
226 | typedef __fsblkcnt64_t fsblkcnt_t; /* Type to count file system blocks. */ |
227 | # define __fsblkcnt_t_defined |
228 | # endif |
229 | # ifndef __fsfilcnt_t_defined |
230 | typedef __fsfilcnt64_t fsfilcnt_t; /* Type to count file system inodes. */ |
231 | # define __fsfilcnt_t_defined |
232 | # endif |
233 | #endif |
234 | |
235 | #ifdef __USE_LARGEFILE64 |
236 | typedef __blkcnt64_t blkcnt64_t; /* Type to count number of disk blocks. */ |
237 | typedef __fsblkcnt64_t fsblkcnt64_t; /* Type to count file system blocks. */ |
238 | typedef __fsfilcnt64_t fsfilcnt64_t; /* Type to count file system inodes. */ |
239 | #endif |
240 | |
241 | |
242 | /* Now add the thread types. */ |
243 | #if defined __USE_POSIX199506 || defined __USE_UNIX98 |
244 | # include <bits/pthreadtypes.h> |
245 | #endif |
246 | |
247 | __END_DECLS |
248 | |
249 | #endif /* sys/types.h */ |
250 | |