1TYPES(5) File Formats Manual TYPES(5)
2
3
4
6 types - primitive system data types
7
9 #include <sys/types.h>
10
12 The data types defined in the include file are used in UNIX system
13 code; some data of these types are accessible to user code:
14
15 /* Copyright (C) 1991,1992,1994-2002,2006,2010 Free Software Foundation, Inc.
16 This file is part of the GNU C Library.
17
18 The GNU C Library is free software; you can redistribute it and/or
19 modify it under the terms of the GNU Lesser General Public
20 License as published by the Free Software Foundation; either
21 version 2.1 of the License, or (at your option) any later version.
22
23 The GNU C Library is distributed in the hope that it will be useful,
24 but WITHOUT ANY WARRANTY; without even the implied warranty of
25 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26 Lesser General Public License for more details.
27
28 You should have received a copy of the GNU Lesser General Public
29 License along with the GNU C Library; if not, see
30 <http://www.gnu.org/licenses/>. */
31
32 /*
33 * POSIX Standard: 2.6 Primitive System Data Types<sys/types.h>
34 */
35
36 #ifndef _SYS_TYPES_H
37 #define _SYS_TYPES_H 1
38
39 #include <features.h>
40
41 __BEGIN_DECLS
42
43 #include <bits/types.h>
44
45 #ifdef __USE_BSD
46 # ifndef __u_char_defined
47 typedef __u_char u_char;
48 typedef __u_short u_short;
49 typedef __u_int u_int;
50 typedef __u_long u_long;
51 typedef __quad_t quad_t;
52 typedef __u_quad_t u_quad_t;
53 typedef __fsid_t fsid_t;
54 # define __u_char_defined
55 # endif
56 #endif
57
58 typedef __loff_t loff_t;
59
60 #ifndef __ino_t_defined
61 # ifndef __USE_FILE_OFFSET64
62 typedef __ino_t ino_t;
63 # else
64 typedef __ino64_t ino_t;
65 # endif
66 # define __ino_t_defined
67 #endif
68 #if defined __USE_LARGEFILE64 && !defined __ino64_t_defined
69 typedef __ino64_t ino64_t;
70 # define __ino64_t_defined
71 #endif
72
73 #ifndef __dev_t_defined
74 typedef __dev_t dev_t;
75 # define __dev_t_defined
76 #endif
77
78 #ifndef __gid_t_defined
79 typedef __gid_t gid_t;
80 # define __gid_t_defined
81 #endif
82
83 #ifndef __mode_t_defined
84 typedef __mode_t mode_t;
85 # define __mode_t_defined
86 #endif
87
88 #ifndef __nlink_t_defined
89 typedef __nlink_t nlink_t;
90 # define __nlink_t_defined
91 #endif
92
93 #ifndef __uid_t_defined
94 typedef __uid_t uid_t;
95 # define __uid_t_defined
96 #endif
97
98 #ifndef __off_t_defined
99 # ifndef __USE_FILE_OFFSET64
100 typedef __off_t off_t;
101 # else
102 typedef __off64_t off_t;
103 # endif
104 # define __off_t_defined
105 #endif
106 #if defined __USE_LARGEFILE64 && !defined __off64_t_defined
107 typedef __off64_t off64_t;
108 # define __off64_t_defined
109 #endif
110
111 #ifndef __pid_t_defined
112 typedef __pid_t pid_t;
113 # define __pid_t_defined
114 #endif
115
116 #if (defined __USE_SVID || defined __USE_XOPEN || defined __USE_XOPEN2K8) && !defined __id_t_defined
117 typedef __id_t id_t;
118 # define __id_t_defined
119 #endif
120
121 #ifndef __ssize_t_defined
122 typedef __ssize_t ssize_t;
123 # define __ssize_t_defined
124 #endif
125
126 #ifdef __USE_BSD
127 # ifndef __daddr_t_defined
128 typedef __daddr_t daddr_t;
129 typedef __caddr_t caddr_t;
130 # define __daddr_t_defined
131 # endif
132 #endif
133
134 #if (defined __USE_SVID || defined __USE_XOPEN) && !defined __key_t_defined
135 typedef __key_t key_t;
136 # define __key_t_defined
137 #endif
138
139 #if defined __USE_XOPEN || defined __USE_XOPEN2K8
140 # define __need_clock_t
141 #endif
142 #define __need_time_t
143 #define __need_timer_t
144 #define __need_clockid_t
145 #include <time.h>
146
147 #ifdef __USE_XOPEN
148 # ifndef __useconds_t_defined
149 typedef __useconds_t useconds_t;
150 # define __useconds_t_defined
151 # endif
152 # ifndef __suseconds_t_defined
153 typedef __suseconds_t suseconds_t;
154 # define __suseconds_t_defined
155 # endif
156 #endif
157
158 #define __need_size_t
159 #include <stddef.h>
160
161 #ifdef __USE_MISC
162 /* Old compatibility names for C types. */
163 typedef unsigned long int ulong;
164 typedef unsigned short int ushort;
165 typedef unsigned int uint;
166 #endif
167
168 /* These size-specific names are used by some of the inet code. */
169
170 #if !__GNUC_PREREQ (2, 7)
171
172 /* These types are defined by the ISO C99 header <inttypes.h>. */
173 # ifndef __int8_t_defined
174 # define __int8_t_defined
175 typedef char int8_t;
176 typedef short int int16_t;
177 typedef int int32_t;
178 # if __WORDSIZE == 64
179 typedef long int int64_t;
180 # elif __GLIBC_HAVE_LONG_LONG
181 __extension__ typedef long long int int64_t;
182 # endif
183 # endif
184
185 /* But these were defined by ISO C without the first `_'. */
186 typedef unsigned char u_int8_t;
187 typedef unsigned short int u_int16_t;
188 typedef unsigned int u_int32_t;
189 # if __WORDSIZE == 64
190 typedef unsigned long int u_int64_t;
191 # elif __GLIBC_HAVE_LONG_LONG
192 __extension__ typedef unsigned long long int u_int64_t;
193 # endif
194
195 typedef int register_t;
196
197 #else
198
199 /* For GCC 2.7 and later, we can use specific type-size attributes. */
200 # define __intN_t(N, MODE) typedef int int##N##_t __attribute__ ((__mode__ (MODE)))
201 # define __u_intN_t(N, MODE) typedef unsigned int u_int##N##_t __attribute__ ((__mode__ (MODE)))
202
203 # ifndef __int8_t_defined
204 # define __int8_t_defined
205 __intN_t (8, __QI__);
206 __intN_t (16, __HI__);
207 __intN_t (32, __SI__);
208 __intN_t (64, __DI__);
209 # endif
210
211 __u_intN_t (8, __QI__);
212 __u_intN_t (16, __HI__);
213 __u_intN_t (32, __SI__);
214 __u_intN_t (64, __DI__);
215
216 typedef int register_t __attribute__ ((__mode__ (__word__)));
217
218
219 /* Some code from BIND tests this macro to see if the types above are
220 defined. */
221 #endif
222 #define __BIT_TYPES_DEFINED__1
223
224
225 #ifdef __USE_BSD
226 /* In BSD <sys/types.h> is expected to define BYTE_ORDER. */
227 # include <endian.h>
228
229 /* It also defines `fd_set' and the FD_* macros for `select'. */
230 # include <sys/select.h>
231
232 /* BSD defines these symbols, so we follow. */
233 # include <sys/sysmacros.h>
234 #endif /* Use BSD. */
235
236
237 #if (defined __USE_UNIX98 || defined __USE_XOPEN2K8) && !defined __blksize_t_defined
238 typedef __blksize_t blksize_t;
239 # define __blksize_t_defined
240 #endif
241
242 /* Types from the Large File Support interface. */
243 #ifndef __USE_FILE_OFFSET64
244 # ifndef __blkcnt_t_defined
245 typedef __blkcnt_t blkcnt_t; /* Type to count number of disk blocks. */
246 # define __blkcnt_t_defined
247 # endif
248 # ifndef __fsblkcnt_t_defined
249 typedef __fsblkcnt_t fsblkcnt_t; /* Type to count file system blocks. */
250 # define __fsblkcnt_t_defined
251 # endif
252 # ifndef __fsfilcnt_t_defined
253 typedef __fsfilcnt_t fsfilcnt_t; /* Type to count file system inodes. */
254 # define __fsfilcnt_t_defined
255 # endif
256 #else
257 # ifndef __blkcnt_t_defined
258 typedef __blkcnt64_t blkcnt_t; /* Type to count number of disk blocks. */
259 # define __blkcnt_t_defined
260 # endif
261 # ifndef __fsblkcnt_t_defined
262 typedef __fsblkcnt64_t fsblkcnt_t; /* Type to count file system blocks. */
263 # define __fsblkcnt_t_defined
264 # endif
265 # ifndef __fsfilcnt_t_defined
266 typedef __fsfilcnt64_t fsfilcnt_t; /* Type to count file system inodes. */
267 # define __fsfilcnt_t_defined
268 # endif
269 #endif
270
271 #ifdef __USE_LARGEFILE64
272 typedef __blkcnt64_t blkcnt64_t; /* Type to count number of disk blocks. */
273 typedef __fsblkcnt64_t fsblkcnt64_t; /* Type to count file system blocks. */
274 typedef __fsfilcnt64_t fsfilcnt64_t; /* Type to count file system inodes. */
275 #endif
276
277
278 /* Now add the thread types. */
279 #if defined __USE_POSIX199506 || defined __USE_UNIX98
280 # include <bits/pthreadtypes.h>
281 #endif
282
283 __END_DECLS
284
285 #endif /* sys/types.h */
286
287 The form daddr_t is used for disk addresses except in an i-node on
288 disk, see fs(5). Times are encoded in seconds since 00:00:00 GMT, Jan‐
289 uary 1, 1970. The major and minor parts of a device code specify kind
290 and unit number of a device and are installation-dependent. Offsets
291 are measured in bytes from the beginning of a file. The label_t vari‐
292 ables are used to save the processor state while another process is
293 running.
294
296 fs(5), time(3), lseek(2), adb(1)
297
298
299
3004th Berkeley Distribution May 15, 1985 TYPES(5)