1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* Like <fcntl.h>, but with non-working flags defined to 0.
5 Copyright (C) 2006-2013 Free Software Foundation, Inc.
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 /* written by Paul Eggert */
23 @PRAGMA_SYSTEM_HEADER@
27 #if defined __need_system_fcntl_h
28 /* Special invocation convention. */
30 /* Needed before <sys/stat.h>.
31 May also define off_t to a 64-bit type on native Windows. */
32 #include <sys/types.h>
33 /* On some systems other than glibc, <sys/stat.h> is a prerequisite of
34 <fcntl.h>. On glibc systems, we would like to avoid namespace pollution.
35 But on glibc systems, <fcntl.h> includes <sys/stat.h> inside an
36 extern "C" { ... } block, which leads to errors in C++ mode with the
37 overridden <sys/stat.h> from gnulib. These errors are known to be gone
38 with g++ version >= 4.3. */
39 #if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
40 # include <sys/stat.h>
42 #@INCLUDE_NEXT@ @NEXT_FCNTL_H@
45 /* Normal invocation convention. */
47 #ifndef _@GUARD_PREFIX@_FCNTL_H
49 /* Needed before <sys/stat.h>.
50 May also define off_t to a 64-bit type on native Windows. */
51 #include <sys/types.h>
52 /* On some systems other than glibc, <sys/stat.h> is a prerequisite of
53 <fcntl.h>. On glibc systems, we would like to avoid namespace pollution.
54 But on glibc systems, <fcntl.h> includes <sys/stat.h> inside an
55 extern "C" { ... } block, which leads to errors in C++ mode with the
56 overridden <sys/stat.h> from gnulib. These errors are known to be gone
57 with g++ version >= 4.3. */
58 #if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
59 # include <sys/stat.h>
61 /* The include_next requires a split double-inclusion guard. */
62 #@INCLUDE_NEXT@ @NEXT_FCNTL_H@
64 #ifndef _@GUARD_PREFIX@_FCNTL_H
65 #define _@GUARD_PREFIX@_FCNTL_H
67 #ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems. */
71 /* Native Windows platforms declare open(), creat() in <io.h>. */
72 #if (@GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \
73 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
78 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
80 /* The definition of _GL_ARG_NONNULL is copied here. */
82 /* The definition of _GL_WARN_ON_USE is copied here. */
85 /* Declare overridden functions. */
89 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
91 # define fcntl rpl_fcntl
93 _GL_FUNCDECL_RPL (fcntl, int, (int fd, int action, ...));
94 _GL_CXXALIAS_RPL (fcntl, int, (int fd, int action, ...));
97 _GL_FUNCDECL_SYS (fcntl, int, (int fd, int action, ...));
99 _GL_CXXALIAS_SYS (fcntl, int, (int fd, int action, ...));
101 _GL_CXXALIASWARN (fcntl);
102 #elif defined GNULIB_POSIXCHECK
104 # if HAVE_RAW_DECL_FCNTL
105 _GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - "
106 "use gnulib module fcntl for portability");
112 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
114 # define open rpl_open
116 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
117 _GL_ARG_NONNULL ((1)));
118 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
120 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
122 /* On HP-UX 11, in C++ mode, open() is defined as an inline function with a
123 default argument. _GL_CXXALIASWARN does not work in this case. */
125 _GL_CXXALIASWARN (open);
127 #elif defined GNULIB_POSIXCHECK
129 /* Assume open is always declared. */
130 _GL_WARN_ON_USE (open, "open is not always POSIX compliant - "
131 "use gnulib module open for portability");
135 # if @REPLACE_OPENAT@
136 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
138 # define openat rpl_openat
140 _GL_FUNCDECL_RPL (openat, int,
141 (int fd, char const *file, int flags, /* mode_t mode */ ...)
142 _GL_ARG_NONNULL ((2)));
143 _GL_CXXALIAS_RPL (openat, int,
144 (int fd, char const *file, int flags, /* mode_t mode */ ...));
147 _GL_FUNCDECL_SYS (openat, int,
148 (int fd, char const *file, int flags, /* mode_t mode */ ...)
149 _GL_ARG_NONNULL ((2)));
151 _GL_CXXALIAS_SYS (openat, int,
152 (int fd, char const *file, int flags, /* mode_t mode */ ...));
154 _GL_CXXALIASWARN (openat);
155 #elif defined GNULIB_POSIXCHECK
157 # if HAVE_RAW_DECL_OPENAT
158 _GL_WARN_ON_USE (openat, "openat is not portable - "
159 "use gnulib module openat for portability");
164 /* Fix up the FD_* macros, only known to be missing on mingw. */
167 # define FD_CLOEXEC 1
170 /* Fix up the supported F_* macros. Intentionally leave other F_*
171 macros undefined. Only known to be missing on mingw. */
173 #ifndef F_DUPFD_CLOEXEC
174 # define F_DUPFD_CLOEXEC 0x40000000
175 /* Witness variable: 1 if gnulib defined F_DUPFD_CLOEXEC, 0 otherwise. */
176 # define GNULIB_defined_F_DUPFD_CLOEXEC 1
178 # define GNULIB_defined_F_DUPFD_CLOEXEC 0
189 /* Fix up the O_* macros. */
191 #if !defined O_DIRECT && defined O_DIRECTIO
192 /* Tru64 spells it 'O_DIRECTIO'. */
193 # define O_DIRECT O_DIRECTIO
196 #if !defined O_CLOEXEC && defined O_NOINHERIT
197 /* Mingw spells it 'O_NOINHERIT'. */
198 # define O_CLOEXEC O_NOINHERIT
210 # define O_DIRECTORY 0
218 # define O_EXEC O_RDONLY /* This is often close enough in older systems. */
221 #ifndef O_IGNORE_CTTY
222 # define O_IGNORE_CTTY 0
234 # define O_NONBLOCK O_NDELAY
237 /* If the gnulib module 'nonblocking' is in use, guarantee a working non-zero
238 value of O_NONBLOCK. Otherwise, O_NONBLOCK is defined (above) to O_NDELAY
239 or to 0 as fallback. */
240 #if @GNULIB_NONBLOCKING@
242 # define GNULIB_defined_O_NONBLOCK 0
244 # define GNULIB_defined_O_NONBLOCK 1
246 # define O_NONBLOCK 0x40000000
255 # define O_NOFOLLOW 0
275 # define O_SEARCH O_RDONLY /* This is often close enough in older systems. */
283 # define O_TTY_INIT 0
286 #if ~O_ACCMODE & (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH)
288 # define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH)
291 /* For systems that distinguish between text and binary I/O.
292 O_BINARY is usually declared in fcntl.h */
293 #if !defined O_BINARY && defined _O_BINARY
294 /* For MSC-compatible compilers. */
295 # define O_BINARY _O_BINARY
296 # define O_TEXT _O_TEXT
299 #if defined __BEOS__ || defined __HAIKU__
300 /* BeOS 5 and Haiku have O_BINARY and O_TEXT, but they have no effect. */
310 /* Fix up the AT_* macros. */
312 /* Work around a bug in Solaris 9 and 10: AT_FDCWD is positive. Its
313 value exceeds INT_MAX, so its use as an int doesn't conform to the
314 C standard, and GCC and Sun C complain in some cases. If the bug
315 is present, undef AT_FDCWD here, so it can be redefined below. */
316 #if 0 < AT_FDCWD && AT_FDCWD == 0xffd19553
320 /* Use the same bit pattern as Solaris 9, but with the proper
321 signedness. The bit pattern is important, in case this actually is
322 Solaris with the above workaround. */
324 # define AT_FDCWD (-3041965)
327 /* Use the same values as Solaris 9. This shouldn't matter, but
328 there's no real reason to differ. */
329 #ifndef AT_SYMLINK_NOFOLLOW
330 # define AT_SYMLINK_NOFOLLOW 4096
334 # define AT_REMOVEDIR 1
337 /* Solaris 9 lacks these two, so just pick unique values. */
338 #ifndef AT_SYMLINK_FOLLOW
339 # define AT_SYMLINK_FOLLOW 2
343 # define AT_EACCESS 4
347 #endif /* _@GUARD_PREFIX@_FCNTL_H */
348 #endif /* _@GUARD_PREFIX@_FCNTL_H */