Update.
[glibc.git] / posix / sys / types.h
blobab28d39aaf21bdd01102ae05f744424e67ab25ee
1 /* Copyright (C) 1991, 92, 94, 95, 96, 97 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 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.
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.
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. */
20 * POSIX Standard: 2.6 Primitive System Data Types <sys/types.h>
23 #ifndef _SYS_TYPES_H
24 #define _SYS_TYPES_H 1
26 #include <features.h>
28 __BEGIN_DECLS
30 #include <bits/types.h>
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
42 typedef __dev_t dev_t;
43 typedef __mode_t mode_t;
44 typedef __nlink_t nlink_t;
45 typedef __loff_t loff_t;
47 #ifndef __USE_FILE_OFFSET64
48 typedef __ino_t ino_t;
49 #else
50 typedef __ino64_t ino_t;
51 #endif
52 #ifdef __USE_LARGEFILE64
53 typedef __ino64_t ino64_t;
54 #endif
56 #ifndef gid_t
57 typedef __gid_t gid_t;
58 # define gid_t gid_t
59 #endif
61 #ifndef uid_t
62 typedef __uid_t uid_t;
63 # define uid_t uid_t
64 #endif
66 #ifndef off_t
67 # ifndef __USE_FILE_OFFSET64
68 typedef __off_t off_t;
69 # else
70 typedef __off64_t off_t;
71 # endif
72 # define off_t off_t
73 #endif
74 #if defined __USE_LARGEFILE64 && !defined off64_t
75 typedef __off64_t off64_t;
76 # define off64_t off64_t
77 #endif
79 #ifndef pid_t
80 typedef __pid_t pid_t;
81 # define pid_t pid_t
82 #endif
84 #ifndef ssize_t
85 typedef __ssize_t ssize_t;
86 # define ssize_t ssize_t
87 #endif
89 #ifdef __USE_BSD
90 typedef __daddr_t daddr_t;
91 typedef __caddr_t caddr_t;
92 #endif
94 #if defined __USE_SVID || defined __USE_XOPEN
95 typedef __key_t key_t;
96 #endif
98 #define __need_time_t
99 #include <time.h>
101 #define __need_size_t
102 #include <stddef.h>
104 #ifdef __USE_MISC
105 /* Old compatibility names for C types. */
106 typedef unsigned long int ulong;
107 typedef unsigned short int ushort;
108 typedef unsigned int uint;
109 #endif
111 /* These size-specific names are used by some of the inet code. */
113 #if !defined (__GNUC__) || __GNUC__ < 2 || __GNUC_MINOR__ < 7
115 /* These types are defined by the ISO C 9x header <inttypes.h>. */
116 # ifndef __int8_t_defined
117 # define __int8_t_defined
118 typedef char int8_t;
119 typedef short int int16_t;
120 typedef int int32_t;
121 # ifdef __GNUC__
122 typedef long long int int64_t;
123 # endif
124 # endif
126 /* But these were defined by ISO C without the first `_'. */
127 typedef unsigned char u_int8_t;
128 typedef unsigned short int u_int16_t;
129 typedef unsigned int u_int32_t;
130 # ifdef __GNUC__
131 typedef unsigned long long int u_int64_t;
132 # endif
134 typedef int register_t;
136 #else
138 /* For GCC 2.7 and later, we can use specific type-size attributes. */
139 # define __intN_t(N, MODE) \
140 typedef int int##N##_t __attribute__ ((__mode__ (MODE)))
141 # define __u_intN_t(N, MODE) \
142 typedef unsigned int u_int##N##_t __attribute__ ((__mode__ (MODE)))
144 # ifndef __int8_t_defined
145 # define __int8_t_defined
146 __intN_t (8, __QI__);
147 __intN_t (16, __HI__);
148 __intN_t (32, __SI__);
149 __intN_t (64, __DI__);
150 # endif
152 __u_intN_t (8, __QI__);
153 __u_intN_t (16, __HI__);
154 __u_intN_t (32, __SI__);
155 __u_intN_t (64, __DI__);
157 typedef int register_t __attribute__ ((__mode__ (__word__)));
160 /* Some code from BIND tests this macro to see if the types above are
161 defined. */
162 #endif
163 #define __BIT_TYPES_DEFINED__ 1
166 #ifdef __USE_BSD
167 /* In BSD <sys/types.h> is expected to define BYTE_ORDER. */
168 # include <endian.h>
170 /* It also defines `fd_set' and the FD_* macros for `select'. */
171 # include <sys/select.h>
172 #endif /* Use BSD. */
175 /* Types from the Large File Support interface. */
176 #ifndef __USE_FILE_OFFSET64
177 typedef __blkcnt_t blkcnt_t; /* Type to count number of disk blocks. */
178 typedef __fsblkcnt_t fsblkcnt_t; /* Type to count file system blocks. */
179 typedef __fsfilcnt_t fsfilcnt_t; /* Type to count file system inodes. */
180 #else
181 typedef __blkcnt64_t blkcnt_t; /* Type to count number of disk blocks. */
182 typedef __fsblkcnt64_t fsblkcnt_t; /* Type to count file system blocks. */
183 typedef __fsfilcnt64_t fsfilcnt_t; /* Type to count file system inodes. */
184 #endif
186 #ifdef __USE_LARGEFILE64
187 typedef __blkcnt64_t blkcnt64_t; /* Type to count number of disk blocks. */
188 typedef __fsblkcnt64_t fsblkcnt64_t; /* Type to count file system blocks. */
189 typedef __fsfilcnt64_t fsfilcnt64_t; /* Type to count file system inodes. */
190 #endif
192 __END_DECLS
194 #endif /* sys/types.h */