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