4 * Definitions of (primarily POSIX) system data types.
8 * Written by Rob Savoye <rob@cygnus.com>
9 * Copyright (C) 1997-1999, 2001, 2003, 2004, 2008, 2011, 2014-2016,
13 * Permission is hereby granted, free of charge, to any person obtaining a
14 * copy of this software and associated documentation files (the "Software"),
15 * to deal in the Software without restriction, including without limitation
16 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 * and/or sell copies of the Software, and to permit persons to whom the
18 * Software is furnished to do so, subject to the following conditions:
20 * The above copyright notice, this permission notice, and the following
21 * disclaimer shall be included in all copies or substantial portions of
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF OR OTHER
30 * DEALINGS IN THE SOFTWARE.
34 #pragma GCC system_header
36 /* All the headers include this file.
40 /* Duplicates of some type definitions from here are also to be
41 * provided by other system headers; use __need_TYPENAME selector
42 * macros to make them selectively visible...
44 #if ! defined __need_off_t && ! defined __need___off64_t \
45 && ! defined __need_ssize_t && ! defined __need_time_t
47 * ...and define the multiple inclusion guard macro for this
48 * header, ONLY IF no such selector macro is defined.
54 /* First handle those typedefs which POSIX requires us to be able
55 * to expose selectively, via other system headers.
57 #if ! defined __have_typedef_off_t \
58 && ( defined _SYS_TYPES_H || defined __need_off_t )
59 /* We base this on an implementation specific private typedef,
60 * analogous to our __off64_t (defined below)...
62 typedef __int32 __off32_t;
64 /* The POSIX off_t typedef is uglified, by Microsoft, as _off_t;
65 * ensure that we provide support for the Microsoft form...
67 typedef __off32_t _off_t;
70 /* ...but note that this form should ALWAYS be preferred when
71 * compiling POSIX compatible source code.
76 /* Some compilers, including GCC prior to v4, may get upset
77 * if we try to specifiy these typedefs more than once.
79 # define __have_typedef_off_t
84 #if ! defined __have_typedef___off64_t \
85 && ( defined _SYS_TYPES_H || defined __need___off64_t )
86 /* This is neither an ISO-C standard type, nor even a POSIX
87 * standard type; keep it runtime implementation specific.
89 typedef __int64 __off64_t;
91 # ifndef __STRICT_ANSI__
92 /* GCC itself, (specifically libgfortran.a), gratuitously
93 * assumes that non-standard type off64_t is defined; make
94 * it so, pending upstream correction.
96 typedef __off64_t off64_t;
100 /* Some compilers, including GCC prior to v4, may get upset
101 * if we try to specifiy these typedefs more than once.
103 # define __have_typedef___off64_t
106 #undef __need___off64_t
108 #if ! defined __have_typedef_ssize_t \
109 && ( defined _SYS_TYPES_H || defined __need_ssize_t )
110 /* POSIX ssize_t typedef, uglified by Microsoft as _ssize_t; ensure
111 * that we support the Microsoft form...
113 typedef int _ssize_t;
116 /* ...but note that this form should ALWAYS be preferred when
117 * compiling POSIX compatible source code.
119 typedef _ssize_t ssize_t;
122 /* Some compilers, including GCC prior to v4, may get upset
123 * if we try to specifiy these typedefs more than once.
125 # define __have_typedef_ssize_t
128 #undef __need_ssize_t
130 #if ! defined __have_typedef_time_t \
131 && ( defined _SYS_TYPES_H || defined __need_time_t )
132 /* Current versions of MSVC define time_t ambiguously, in terms of
133 * one of the following unambiguous internal types:
135 typedef __int32 __time32_t; /* unambiguous 32-bit time_t */
136 typedef __int64 __time64_t; /* unambiguous 64-bit time_t */
138 # if __MSVCRT_VERSION__ < __MSVCR80_DLL || defined _USE_32BIT_TIME_T
139 /* From MSVCR80.DLL onwards, Microsoft have royally messed up the
140 * definition of time_t; maintain POSIX consistency, (as MSVCRT.DLL
141 * itself does), unless the user is explicitly using one of these
142 * brain damaged DLL variants, and has not elected to retain the
143 * 32-bit time_t representation.
145 typedef __time32_t time_t;
148 /* Microsoft's brain damaged default, from MSVCR80.DLL onwards.
150 typedef __time64_t time_t;
153 /* Assume any compiler which is not GCC-4.x or newer may require
154 * guarding against repeated time_t typedefs.
156 # define __have_typedef_time_t 1
162 /* This is normal <sys/types.h> inclusion, i.e. for its own sake.
164 * A small subset of the required type definitions are actually
165 * furnished by <stddef.h>; get them by selective inclusion...
167 #define __need_size_t
168 #define __need_ptrdiff_t
169 #define __need_wchar_t
172 /* Today, Microsoft generally prefers to prefix POSIX type names
173 * with an ugly initial underscore; ensure that we provide support
174 * for this ungainly practice.
177 /* Additionally, note that _dev_t is a special case, requiring
178 * this definition when linking with MSVCRT.DLL...
180 typedef unsigned int _dev_t;
183 /* ...but this alternative, when linking with CRTDLL.DLL
185 typedef short _dev_t;
188 /* ...while the remaining type names have consistent definitions,
189 * regardless of any particular DLL association.
191 typedef short _ino_t;
192 typedef unsigned short _mode_t;
194 typedef int _sigset_t;
196 /* Users who value portability should prefer...
198 #if _POSIX_C_SOURCE || ! defined _NO_OLDNAMES
199 /* ...the standard POSIX type names, (which are consistent with
200 * earlier Microsoft naming practice, and are also historically
201 * exposed by MinGW, except when _NO_OLDNAMES is defined).
203 typedef _dev_t dev_t;
204 typedef _ino_t ino_t;
205 typedef _mode_t mode_t;
206 typedef _pid_t pid_t;
207 typedef _sigset_t sigset_t;
210 typedef __int64 fpos64_t;
213 /* useconds_t is an obsolete POSIX data type; we continue to define
214 * it here, for backward compatibility, but we flag it as deprecated,
215 * due to its obsolete status.
217 typedef unsigned long useconds_t __MINGW_ATTRIB_DEPRECATED;
219 #endif /* _SYS_TYPES_H normal inclusion */
221 #endif /* ! RC_INVOKED */
222 #endif /* !_SYS_TYPES_H: $RCSfile$: end of file */