1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2 /* Like <fcntl.h>, but with non-working flags defined to 0.
3 
4    Copyright (C) 2006-2015 Free Software Foundation, Inc.
5 
6    This program is free software: you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10 
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15 
16    You should have received a copy of the GNU General Public License
17    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
18 
19 /* written by Paul Eggert */
20 
21 #if __GNUC__ >= 3
22 #pragma GCC system_header
23 #endif
24 
25 
26 #if defined __need_system_fcntl_h
27 /* Special invocation convention.  */
28 
29 /* Needed before <sys/stat.h>.
30    May also define off_t to a 64-bit type on native Windows.  */
31 #include <sys/types.h>
32 /* On some systems other than glibc, <sys/stat.h> is a prerequisite of
33    <fcntl.h>.  On glibc systems, we would like to avoid namespace pollution.
34    But on glibc systems, <fcntl.h> includes <sys/stat.h> inside an
35    extern "C" { ... } block, which leads to errors in C++ mode with the
36    overridden <sys/stat.h> from gnulib.  These errors are known to be gone
37    with g++ version >= 4.3.  */
38 #if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && (defined __ICC || !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))))
39 # include <sys/stat.h>
40 #endif
41 #include_next <fcntl.h>
42 
43 #else
44 /* Normal invocation convention.  */
45 
46 #ifndef _GL_FCNTL_H
47 
48 /* Needed before <sys/stat.h>.
49    May also define off_t to a 64-bit type on native Windows.  */
50 #include <sys/types.h>
51 /* On some systems other than glibc, <sys/stat.h> is a prerequisite of
52    <fcntl.h>.  On glibc systems, we would like to avoid namespace pollution.
53    But on glibc systems, <fcntl.h> includes <sys/stat.h> inside an
54    extern "C" { ... } block, which leads to errors in C++ mode with the
55    overridden <sys/stat.h> from gnulib.  These errors are known to be gone
56    with g++ version >= 4.3.  */
57 #if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && (defined __ICC || !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))))
58 # include <sys/stat.h>
59 #endif
60 /* The include_next requires a split double-inclusion guard.  */
61 #include_next <fcntl.h>
62 
63 #ifndef _GL_FCNTL_H
64 #define _GL_FCNTL_H
65 
66 #ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems.  */
67 # include <unistd.h>
68 #endif
69 
70 /* Native Windows platforms declare open(), creat() in <io.h>.  */
71 #if (1 || defined GNULIB_POSIXCHECK) \
72     && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
73 # include <io.h>
74 #endif
75 
76 
77 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
78 #ifndef _GL_CXXDEFS_H
79 #define _GL_CXXDEFS_H
80 
81 /* The three most frequent use cases of these macros are:
82 
83    * For providing a substitute for a function that is missing on some
84      platforms, but is declared and works fine on the platforms on which
85      it exists:
86 
87        #if @GNULIB_FOO@
88        # if !@HAVE_FOO@
89        _GL_FUNCDECL_SYS (foo, ...);
90        # endif
91        _GL_CXXALIAS_SYS (foo, ...);
92        _GL_CXXALIASWARN (foo);
93        #elif defined GNULIB_POSIXCHECK
94        ...
95        #endif
96 
97    * For providing a replacement for a function that exists on all platforms,
98      but is broken/insufficient and needs to be replaced on some platforms:
99 
100        #if @GNULIB_FOO@
101        # if @REPLACE_FOO@
102        #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
103        #   undef foo
104        #   define foo rpl_foo
105        #  endif
106        _GL_FUNCDECL_RPL (foo, ...);
107        _GL_CXXALIAS_RPL (foo, ...);
108        # else
109        _GL_CXXALIAS_SYS (foo, ...);
110        # endif
111        _GL_CXXALIASWARN (foo);
112        #elif defined GNULIB_POSIXCHECK
113        ...
114        #endif
115 
116    * For providing a replacement for a function that exists on some platforms
117      but is broken/insufficient and needs to be replaced on some of them and
118      is additionally either missing or undeclared on some other platforms:
119 
120        #if @GNULIB_FOO@
121        # if @REPLACE_FOO@
122        #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
123        #   undef foo
124        #   define foo rpl_foo
125        #  endif
126        _GL_FUNCDECL_RPL (foo, ...);
127        _GL_CXXALIAS_RPL (foo, ...);
128        # else
129        #  if !@HAVE_FOO@   or   if !@HAVE_DECL_FOO@
130        _GL_FUNCDECL_SYS (foo, ...);
131        #  endif
132        _GL_CXXALIAS_SYS (foo, ...);
133        # endif
134        _GL_CXXALIASWARN (foo);
135        #elif defined GNULIB_POSIXCHECK
136        ...
137        #endif
138 */
139 
140 /* _GL_EXTERN_C declaration;
141    performs the declaration with C linkage.  */
142 #if defined __cplusplus
143 # define _GL_EXTERN_C extern "C"
144 #else
145 # define _GL_EXTERN_C extern
146 #endif
147 
148 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
149    declares a replacement function, named rpl_func, with the given prototype,
150    consisting of return type, parameters, and attributes.
151    Example:
152      _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
153                                   _GL_ARG_NONNULL ((1)));
154  */
155 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
156   _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
157 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
158   _GL_EXTERN_C rettype rpl_func parameters_and_attributes
159 
160 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
161    declares the system function, named func, with the given prototype,
162    consisting of return type, parameters, and attributes.
163    Example:
164      _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
165                                   _GL_ARG_NONNULL ((1)));
166  */
167 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
168   _GL_EXTERN_C rettype func parameters_and_attributes
169 
170 /* _GL_CXXALIAS_RPL (func, rettype, parameters);
171    declares a C++ alias called GNULIB_NAMESPACE::func
172    that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
173    Example:
174      _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
175  */
176 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
177   _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
178 #if defined __cplusplus && defined GNULIB_NAMESPACE
179 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
180     namespace GNULIB_NAMESPACE                                \
181     {                                                         \
182       rettype (*const func) parameters = ::rpl_func;          \
183     }                                                         \
184     _GL_EXTERN_C int _gl_cxxalias_dummy
185 #else
186 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
187     _GL_EXTERN_C int _gl_cxxalias_dummy
188 #endif
189 
190 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
191    is like  _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
192    except that the C function rpl_func may have a slightly different
193    declaration.  A cast is used to silence the "invalid conversion" error
194    that would otherwise occur.  */
195 #if defined __cplusplus && defined GNULIB_NAMESPACE
196 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
197     namespace GNULIB_NAMESPACE                                     \
198     {                                                              \
199       rettype (*const func) parameters =                           \
200         reinterpret_cast<rettype(*)parameters>(::rpl_func);        \
201     }                                                              \
202     _GL_EXTERN_C int _gl_cxxalias_dummy
203 #else
204 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
205     _GL_EXTERN_C int _gl_cxxalias_dummy
206 #endif
207 
208 /* _GL_CXXALIAS_SYS (func, rettype, parameters);
209    declares a C++ alias called GNULIB_NAMESPACE::func
210    that redirects to the system provided function func, if GNULIB_NAMESPACE
211    is defined.
212    Example:
213      _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
214  */
215 #if defined __cplusplus && defined GNULIB_NAMESPACE
216   /* If we were to write
217        rettype (*const func) parameters = ::func;
218      like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls
219      better (remove an indirection through a 'static' pointer variable),
220      but then the _GL_CXXALIASWARN macro below would cause a warning not only
221      for uses of ::func but also for uses of GNULIB_NAMESPACE::func.  */
222 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
223     namespace GNULIB_NAMESPACE                     \
224     {                                              \
225       static rettype (*func) parameters = ::func;  \
226     }                                              \
227     _GL_EXTERN_C int _gl_cxxalias_dummy
228 #else
229 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
230     _GL_EXTERN_C int _gl_cxxalias_dummy
231 #endif
232 
233 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
234    is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
235    except that the C function func may have a slightly different declaration.
236    A cast is used to silence the "invalid conversion" error that would
237    otherwise occur.  */
238 #if defined __cplusplus && defined GNULIB_NAMESPACE
239 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
240     namespace GNULIB_NAMESPACE                          \
241     {                                                   \
242       static rettype (*func) parameters =               \
243         reinterpret_cast<rettype(*)parameters>(::func); \
244     }                                                   \
245     _GL_EXTERN_C int _gl_cxxalias_dummy
246 #else
247 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
248     _GL_EXTERN_C int _gl_cxxalias_dummy
249 #endif
250 
251 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
252    is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
253    except that the C function is picked among a set of overloaded functions,
254    namely the one with rettype2 and parameters2.  Two consecutive casts
255    are used to silence the "cannot find a match" and "invalid conversion"
256    errors that would otherwise occur.  */
257 #if defined __cplusplus && defined GNULIB_NAMESPACE
258   /* The outer cast must be a reinterpret_cast.
259      The inner cast: When the function is defined as a set of overloaded
260      functions, it works as a static_cast<>, choosing the designated variant.
261      When the function is defined as a single variant, it works as a
262      reinterpret_cast<>. The parenthesized cast syntax works both ways.  */
263 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
264     namespace GNULIB_NAMESPACE                                                \
265     {                                                                         \
266       static rettype (*func) parameters =                                     \
267         reinterpret_cast<rettype(*)parameters>(                               \
268           (rettype2(*)parameters2)(::func));                                  \
269     }                                                                         \
270     _GL_EXTERN_C int _gl_cxxalias_dummy
271 #else
272 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
273     _GL_EXTERN_C int _gl_cxxalias_dummy
274 #endif
275 
276 /* _GL_CXXALIASWARN (func);
277    causes a warning to be emitted when ::func is used but not when
278    GNULIB_NAMESPACE::func is used.  func must be defined without overloaded
279    variants.  */
280 #if defined __cplusplus && defined GNULIB_NAMESPACE
281 # define _GL_CXXALIASWARN(func) \
282    _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
283 # define _GL_CXXALIASWARN_1(func,namespace) \
284    _GL_CXXALIASWARN_2 (func, namespace)
285 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
286    we enable the warning only when not optimizing.  */
287 # if !__OPTIMIZE__
288 #  define _GL_CXXALIASWARN_2(func,namespace) \
289     _GL_WARN_ON_USE (func, \
290                      "The symbol ::" #func " refers to the system function. " \
291                      "Use " #namespace "::" #func " instead.")
292 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
293 #  define _GL_CXXALIASWARN_2(func,namespace) \
294      extern __typeof__ (func) func
295 # else
296 #  define _GL_CXXALIASWARN_2(func,namespace) \
297      _GL_EXTERN_C int _gl_cxxalias_dummy
298 # endif
299 #else
300 # define _GL_CXXALIASWARN(func) \
301     _GL_EXTERN_C int _gl_cxxalias_dummy
302 #endif
303 
304 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
305    causes a warning to be emitted when the given overloaded variant of ::func
306    is used but not when GNULIB_NAMESPACE::func is used.  */
307 #if defined __cplusplus && defined GNULIB_NAMESPACE
308 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
309    _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
310                         GNULIB_NAMESPACE)
311 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
312    _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
313 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
314    we enable the warning only when not optimizing.  */
315 # if !__OPTIMIZE__
316 #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
317     _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
318                          "The symbol ::" #func " refers to the system function. " \
319                          "Use " #namespace "::" #func " instead.")
320 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
321 #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
322      extern __typeof__ (func) func
323 # else
324 #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
325      _GL_EXTERN_C int _gl_cxxalias_dummy
326 # endif
327 #else
328 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
329     _GL_EXTERN_C int _gl_cxxalias_dummy
330 #endif
331 
332 #endif /* _GL_CXXDEFS_H */
333 
334 /* The definition of _GL_ARG_NONNULL is copied here.  */
335 /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
336    that the values passed as arguments n, ..., m must be non-NULL pointers.
337    n = 1 stands for the first argument, n = 2 for the second argument etc.  */
338 #ifndef _GL_ARG_NONNULL
339 # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
340 #  define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
341 # else
342 #  define _GL_ARG_NONNULL(params)
343 # endif
344 #endif
345 
346 /* The definition of _GL_WARN_ON_USE is copied here.  */
347 #ifndef _GL_WARN_ON_USE
348 
349 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
350 /* A compiler attribute is available in gcc versions 4.3.0 and later.  */
351 #  define _GL_WARN_ON_USE(function, message) \
352 extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
353 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
354 /* Verify the existence of the function.  */
355 #  define _GL_WARN_ON_USE(function, message) \
356 extern __typeof__ (function) function
357 # else /* Unsupported.  */
358 #  define _GL_WARN_ON_USE(function, message) \
359 _GL_WARN_EXTERN_C int _gl_warn_on_use
360 # endif
361 #endif
362 
363 /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
364    is like _GL_WARN_ON_USE (function, "string"), except that the function is
365    declared with the given prototype, consisting of return type, parameters,
366    and attributes.
367    This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
368    not work in this case.  */
369 #ifndef _GL_WARN_ON_USE_CXX
370 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
371 #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
372 extern rettype function parameters_and_attributes \
373      __attribute__ ((__warning__ (msg)))
374 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
375 /* Verify the existence of the function.  */
376 #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
377 extern rettype function parameters_and_attributes
378 # else /* Unsupported.  */
379 #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
380 _GL_WARN_EXTERN_C int _gl_warn_on_use
381 # endif
382 #endif
383 
384 /* _GL_WARN_EXTERN_C declaration;
385    performs the declaration with C linkage.  */
386 #ifndef _GL_WARN_EXTERN_C
387 # if defined __cplusplus
388 #  define _GL_WARN_EXTERN_C extern "C"
389 # else
390 #  define _GL_WARN_EXTERN_C extern
391 # endif
392 #endif
393 
394 
395 /* Declare overridden functions.  */
396 
397 #if 1
398 # if 1
399 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
400 #   undef fcntl
401 #   define fcntl rpl_fcntl
402 #  endif
403 _GL_FUNCDECL_RPL (fcntl, int, (int fd, int action, ...));
404 _GL_CXXALIAS_RPL (fcntl, int, (int fd, int action, ...));
405 # else
406 #  if !1
407 _GL_FUNCDECL_SYS (fcntl, int, (int fd, int action, ...));
408 #  endif
409 _GL_CXXALIAS_SYS (fcntl, int, (int fd, int action, ...));
410 # endif
411 _GL_CXXALIASWARN (fcntl);
412 #elif defined GNULIB_POSIXCHECK
413 # undef fcntl
414 # if HAVE_RAW_DECL_FCNTL
415 _GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - "
416                  "use gnulib module fcntl for portability");
417 # endif
418 #endif
419 
420 #if 1
421 # if 0
422 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
423 #   undef open
424 #   define open rpl_open
425 #  endif
426 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
427                              _GL_ARG_NONNULL ((1)));
428 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
429 # else
430 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
431 # endif
432 /* On HP-UX 11, in C++ mode, open() is defined as an inline function with a
433    default argument.  _GL_CXXALIASWARN does not work in this case.  */
434 # if !defined __hpux
435 _GL_CXXALIASWARN (open);
436 # endif
437 #elif defined GNULIB_POSIXCHECK
438 # undef open
439 /* Assume open is always declared.  */
440 _GL_WARN_ON_USE (open, "open is not always POSIX compliant - "
441                  "use gnulib module open for portability");
442 #endif
443 
444 #if 1
445 # if 0
446 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
447 #   undef openat
448 #   define openat rpl_openat
449 #  endif
450 _GL_FUNCDECL_RPL (openat, int,
451                   (int fd, char const *file, int flags, /* mode_t mode */ ...)
452                   _GL_ARG_NONNULL ((2)));
453 _GL_CXXALIAS_RPL (openat, int,
454                   (int fd, char const *file, int flags, /* mode_t mode */ ...));
455 # else
456 #  if !1
457 _GL_FUNCDECL_SYS (openat, int,
458                   (int fd, char const *file, int flags, /* mode_t mode */ ...)
459                   _GL_ARG_NONNULL ((2)));
460 #  endif
461 _GL_CXXALIAS_SYS (openat, int,
462                   (int fd, char const *file, int flags, /* mode_t mode */ ...));
463 # endif
464 _GL_CXXALIASWARN (openat);
465 #elif defined GNULIB_POSIXCHECK
466 # undef openat
467 # if HAVE_RAW_DECL_OPENAT
468 _GL_WARN_ON_USE (openat, "openat is not portable - "
469                  "use gnulib module openat for portability");
470 # endif
471 #endif
472 
473 
474 /* Fix up the FD_* macros, only known to be missing on mingw.  */
475 
476 #ifndef FD_CLOEXEC
477 # define FD_CLOEXEC 1
478 #endif
479 
480 /* Fix up the supported F_* macros.  Intentionally leave other F_*
481    macros undefined.  Only known to be missing on mingw.  */
482 
483 #ifndef F_DUPFD_CLOEXEC
484 # define F_DUPFD_CLOEXEC 0x40000000
485 /* Witness variable: 1 if gnulib defined F_DUPFD_CLOEXEC, 0 otherwise.  */
486 # define GNULIB_defined_F_DUPFD_CLOEXEC 1
487 #else
488 # define GNULIB_defined_F_DUPFD_CLOEXEC 0
489 #endif
490 
491 #ifndef F_DUPFD
492 # define F_DUPFD 1
493 #endif
494 
495 #ifndef F_GETFD
496 # define F_GETFD 2
497 #endif
498 
499 /* Fix up the O_* macros.  */
500 
501 /* AIX 7.1 with XL C 12.1 defines O_CLOEXEC, O_NOFOLLOW, and O_TTY_INIT
502    to values outside 'int' range, so omit these misdefinitions.
503    But avoid namespace pollution on non-AIX systems.  */
504 #ifdef _AIX
505 # include <limits.h>
506 # if defined O_CLOEXEC && ! (INT_MIN <= O_CLOEXEC && O_CLOEXEC <= INT_MAX)
507 #  undef O_CLOEXEC
508 # endif
509 # if defined O_NOFOLLOW && ! (INT_MIN <= O_NOFOLLOW && O_NOFOLLOW <= INT_MAX)
510 #  undef O_NOFOLLOW
511 # endif
512 # if defined O_TTY_INIT && ! (INT_MIN <= O_TTY_INIT && O_TTY_INIT <= INT_MAX)
513 #  undef O_TTY_INIT
514 # endif
515 #endif
516 
517 #if !defined O_DIRECT && defined O_DIRECTIO
518 /* Tru64 spells it 'O_DIRECTIO'.  */
519 # define O_DIRECT O_DIRECTIO
520 #endif
521 
522 #if !defined O_CLOEXEC && defined O_NOINHERIT
523 /* Mingw spells it 'O_NOINHERIT'.  */
524 # define O_CLOEXEC O_NOINHERIT
525 #endif
526 
527 #ifndef O_CLOEXEC
528 # define O_CLOEXEC 0
529 #endif
530 
531 #ifndef O_DIRECT
532 # define O_DIRECT 0
533 #endif
534 
535 #ifndef O_DIRECTORY
536 # define O_DIRECTORY 0
537 #endif
538 
539 #ifndef O_DSYNC
540 # define O_DSYNC 0
541 #endif
542 
543 #ifndef O_EXEC
544 # define O_EXEC O_RDONLY /* This is often close enough in older systems.  */
545 #endif
546 
547 #ifndef O_IGNORE_CTTY
548 # define O_IGNORE_CTTY 0
549 #endif
550 
551 #ifndef O_NDELAY
552 # define O_NDELAY 0
553 #endif
554 
555 #ifndef O_NOATIME
556 # define O_NOATIME 0
557 #endif
558 
559 #ifndef O_NONBLOCK
560 # define O_NONBLOCK O_NDELAY
561 #endif
562 
563 /* If the gnulib module 'nonblocking' is in use, guarantee a working non-zero
564    value of O_NONBLOCK.  Otherwise, O_NONBLOCK is defined (above) to O_NDELAY
565    or to 0 as fallback.  */
566 #if 0
567 # if O_NONBLOCK
568 #  define GNULIB_defined_O_NONBLOCK 0
569 # else
570 #  define GNULIB_defined_O_NONBLOCK 1
571 #  undef O_NONBLOCK
572 #  define O_NONBLOCK 0x40000000
573 # endif
574 #endif
575 
576 #ifndef O_NOCTTY
577 # define O_NOCTTY 0
578 #endif
579 
580 #ifndef O_NOFOLLOW
581 # define O_NOFOLLOW 0
582 #endif
583 
584 #ifndef O_NOLINK
585 # define O_NOLINK 0
586 #endif
587 
588 #ifndef O_NOLINKS
589 # define O_NOLINKS 0
590 #endif
591 
592 #ifndef O_NOTRANS
593 # define O_NOTRANS 0
594 #endif
595 
596 #ifndef O_RSYNC
597 # define O_RSYNC 0
598 #endif
599 
600 #ifndef O_SEARCH
601 # define O_SEARCH O_RDONLY /* This is often close enough in older systems.  */
602 #endif
603 
604 #ifndef O_SYNC
605 # define O_SYNC 0
606 #endif
607 
608 #ifndef O_TTY_INIT
609 # define O_TTY_INIT 0
610 #endif
611 
612 #if ~O_ACCMODE & (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH)
613 # undef O_ACCMODE
614 # define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH)
615 #endif
616 
617 /* For systems that distinguish between text and binary I/O.
618    O_BINARY is usually declared in fcntl.h  */
619 #if !defined O_BINARY && defined _O_BINARY
620   /* For MSC-compatible compilers.  */
621 # define O_BINARY _O_BINARY
622 # define O_TEXT _O_TEXT
623 #endif
624 
625 #if defined __BEOS__ || defined __HAIKU__
626   /* BeOS 5 and Haiku have O_BINARY and O_TEXT, but they have no effect.  */
627 # undef O_BINARY
628 # undef O_TEXT
629 #endif
630 
631 #ifndef O_BINARY
632 # define O_BINARY 0
633 # define O_TEXT 0
634 #endif
635 
636 /* Fix up the AT_* macros.  */
637 
638 /* Work around a bug in Solaris 9 and 10: AT_FDCWD is positive.  Its
639    value exceeds INT_MAX, so its use as an int doesn't conform to the
640    C standard, and GCC and Sun C complain in some cases.  If the bug
641    is present, undef AT_FDCWD here, so it can be redefined below.  */
642 #if 0 < AT_FDCWD && AT_FDCWD == 0xffd19553
643 # undef AT_FDCWD
644 #endif
645 
646 /* Use the same bit pattern as Solaris 9, but with the proper
647    signedness.  The bit pattern is important, in case this actually is
648    Solaris with the above workaround.  */
649 #ifndef AT_FDCWD
650 # define AT_FDCWD (-3041965)
651 #endif
652 
653 /* Use the same values as Solaris 9.  This shouldn't matter, but
654    there's no real reason to differ.  */
655 #ifndef AT_SYMLINK_NOFOLLOW
656 # define AT_SYMLINK_NOFOLLOW 4096
657 #endif
658 
659 #ifndef AT_REMOVEDIR
660 # define AT_REMOVEDIR 1
661 #endif
662 
663 /* Solaris 9 lacks these two, so just pick unique values.  */
664 #ifndef AT_SYMLINK_FOLLOW
665 # define AT_SYMLINK_FOLLOW 2
666 #endif
667 
668 #ifndef AT_EACCESS
669 # define AT_EACCESS 4
670 #endif
671 
672 
673 #endif /* _GL_FCNTL_H */
674 #endif /* _GL_FCNTL_H */
675 #endif
676