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