Installed-header hygiene (BZ#20366): time.h types.
[glibc.git] / posix / sys / types.h
blob386f3e570389018665fcfca98da57b61cec6b108
1 /* Copyright (C) 1991-2016 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
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.
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.
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/>. */
19 * POSIX Standard: 2.6 Primitive System Data Types <sys/types.h>
22 #ifndef _SYS_TYPES_H
23 #define _SYS_TYPES_H 1
25 #include <features.h>
27 __BEGIN_DECLS
29 #include <bits/types.h>
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 #endif
44 typedef __loff_t loff_t;
46 #ifndef __ino_t_defined
47 # ifndef __USE_FILE_OFFSET64
48 typedef __ino_t ino_t;
49 # else
50 typedef __ino64_t ino_t;
51 # endif
52 # define __ino_t_defined
53 #endif
54 #if defined __USE_LARGEFILE64 && !defined __ino64_t_defined
55 typedef __ino64_t ino64_t;
56 # define __ino64_t_defined
57 #endif
59 #ifndef __dev_t_defined
60 typedef __dev_t dev_t;
61 # define __dev_t_defined
62 #endif
64 #ifndef __gid_t_defined
65 typedef __gid_t gid_t;
66 # define __gid_t_defined
67 #endif
69 #ifndef __mode_t_defined
70 typedef __mode_t mode_t;
71 # define __mode_t_defined
72 #endif
74 #ifndef __nlink_t_defined
75 typedef __nlink_t nlink_t;
76 # define __nlink_t_defined
77 #endif
79 #ifndef __uid_t_defined
80 typedef __uid_t uid_t;
81 # define __uid_t_defined
82 #endif
84 #ifndef __off_t_defined
85 # ifndef __USE_FILE_OFFSET64
86 typedef __off_t off_t;
87 # else
88 typedef __off64_t off_t;
89 # endif
90 # define __off_t_defined
91 #endif
92 #if defined __USE_LARGEFILE64 && !defined __off64_t_defined
93 typedef __off64_t off64_t;
94 # define __off64_t_defined
95 #endif
97 #ifndef __pid_t_defined
98 typedef __pid_t pid_t;
99 # define __pid_t_defined
100 #endif
102 #if (defined __USE_XOPEN || defined __USE_XOPEN2K8) \
103 && !defined __id_t_defined
104 typedef __id_t id_t;
105 # define __id_t_defined
106 #endif
108 #ifndef __ssize_t_defined
109 typedef __ssize_t ssize_t;
110 # define __ssize_t_defined
111 #endif
113 #ifdef __USE_MISC
114 # ifndef __daddr_t_defined
115 typedef __daddr_t daddr_t;
116 typedef __caddr_t caddr_t;
117 # define __daddr_t_defined
118 # endif
119 #endif
121 #if (defined __USE_MISC || defined __USE_XOPEN) && !defined __key_t_defined
122 typedef __key_t key_t;
123 # define __key_t_defined
124 #endif
126 #if defined __USE_XOPEN || defined __USE_XOPEN2K8
127 # include <bits/types/clock_t.h>
128 #endif
129 #include <bits/types/clockid_t.h>
130 #include <bits/types/time_t.h>
131 #include <bits/types/timer_t.h>
133 #ifdef __USE_XOPEN
134 # ifndef __useconds_t_defined
135 typedef __useconds_t useconds_t;
136 # define __useconds_t_defined
137 # endif
138 # ifndef __suseconds_t_defined
139 typedef __suseconds_t suseconds_t;
140 # define __suseconds_t_defined
141 # endif
142 #endif
144 #define __need_size_t
145 #include <stddef.h>
147 #ifdef __USE_MISC
148 /* Old compatibility names for C types. */
149 typedef unsigned long int ulong;
150 typedef unsigned short int ushort;
151 typedef unsigned int uint;
152 #endif
154 /* These size-specific names are used by some of the inet code. */
156 #if !__GNUC_PREREQ (2, 7)
158 /* These types are defined by the ISO C99 header <inttypes.h>. */
159 # ifndef __int8_t_defined
160 # define __int8_t_defined
161 typedef char int8_t;
162 typedef short int int16_t;
163 typedef int int32_t;
164 # if __WORDSIZE == 64
165 typedef long int int64_t;
166 # else
167 __extension__ typedef long long int int64_t;
168 # endif
169 # endif
171 /* But these were defined by ISO C without the first `_'. */
172 typedef unsigned char u_int8_t;
173 typedef unsigned short int u_int16_t;
174 typedef unsigned int u_int32_t;
175 # if __WORDSIZE == 64
176 typedef unsigned long int u_int64_t;
177 # else
178 __extension__ typedef unsigned long long int u_int64_t;
179 # endif
181 typedef int register_t;
183 #else
185 /* For GCC 2.7 and later, we can use specific type-size attributes. */
186 # define __intN_t(N, MODE) \
187 typedef int int##N##_t __attribute__ ((__mode__ (MODE)))
188 # define __u_intN_t(N, MODE) \
189 typedef unsigned int u_int##N##_t __attribute__ ((__mode__ (MODE)))
191 # ifndef __int8_t_defined
192 # define __int8_t_defined
193 __intN_t (8, __QI__);
194 __intN_t (16, __HI__);
195 __intN_t (32, __SI__);
196 __intN_t (64, __DI__);
197 # endif
199 __u_intN_t (8, __QI__);
200 __u_intN_t (16, __HI__);
201 __u_intN_t (32, __SI__);
202 __u_intN_t (64, __DI__);
204 typedef int register_t __attribute__ ((__mode__ (__word__)));
207 /* Some code from BIND tests this macro to see if the types above are
208 defined. */
209 #endif
210 #define __BIT_TYPES_DEFINED__ 1
213 #ifdef __USE_MISC
214 /* In BSD <sys/types.h> is expected to define BYTE_ORDER. */
215 # include <endian.h>
217 /* It also defines `fd_set' and the FD_* macros for `select'. */
218 # include <sys/select.h>
220 /* BSD defines `major', `minor', and `makedev' in this header.
221 However, these symbols are likely to collide with user code, so we are
222 going to stop defining them here in an upcoming release. Code that needs
223 these macros should include <sys/sysmacros.h> directly. Code that does
224 not need these macros should #undef them after including this header. */
225 # define __SYSMACROS_DEPRECATED_INCLUSION
226 # include <sys/sysmacros.h>
227 # undef __SYSMACROS_DEPRECATED_INCLUSION
228 #endif /* Use misc. */
231 #if (defined __USE_UNIX98 || defined __USE_XOPEN2K8) \
232 && !defined __blksize_t_defined
233 typedef __blksize_t blksize_t;
234 # define __blksize_t_defined
235 #endif
237 /* Types from the Large File Support interface. */
238 #ifndef __USE_FILE_OFFSET64
239 # ifndef __blkcnt_t_defined
240 typedef __blkcnt_t blkcnt_t; /* Type to count number of disk blocks. */
241 # define __blkcnt_t_defined
242 # endif
243 # ifndef __fsblkcnt_t_defined
244 typedef __fsblkcnt_t fsblkcnt_t; /* Type to count file system blocks. */
245 # define __fsblkcnt_t_defined
246 # endif
247 # ifndef __fsfilcnt_t_defined
248 typedef __fsfilcnt_t fsfilcnt_t; /* Type to count file system inodes. */
249 # define __fsfilcnt_t_defined
250 # endif
251 #else
252 # ifndef __blkcnt_t_defined
253 typedef __blkcnt64_t blkcnt_t; /* Type to count number of disk blocks. */
254 # define __blkcnt_t_defined
255 # endif
256 # ifndef __fsblkcnt_t_defined
257 typedef __fsblkcnt64_t fsblkcnt_t; /* Type to count file system blocks. */
258 # define __fsblkcnt_t_defined
259 # endif
260 # ifndef __fsfilcnt_t_defined
261 typedef __fsfilcnt64_t fsfilcnt_t; /* Type to count file system inodes. */
262 # define __fsfilcnt_t_defined
263 # endif
264 #endif
266 #ifdef __USE_LARGEFILE64
267 typedef __blkcnt64_t blkcnt64_t; /* Type to count number of disk blocks. */
268 typedef __fsblkcnt64_t fsblkcnt64_t; /* Type to count file system blocks. */
269 typedef __fsfilcnt64_t fsfilcnt64_t; /* Type to count file system inodes. */
270 #endif
273 /* Now add the thread types. */
274 #if defined __USE_POSIX199506 || defined __USE_UNIX98
275 # include <bits/pthreadtypes.h>
276 #endif
278 __END_DECLS
280 #endif /* sys/types.h */