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-2011 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 #include <sys/types.h>
31 /* On some systems other than glibc, <sys/stat.h> is a prerequisite of
32 <fcntl.h>. On glibc systems, we would like to avoid namespace pollution.
33 But on glibc systems, <fcntl.h> includes <sys/stat.h> inside an
34 extern "C" { ... } block, which leads to errors in C++ mode with the
35 overridden <sys/stat.h> from gnulib. These errors are known to be gone
36 with g++ version >= 4.3. */
37 #if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
38 # include <sys/stat.h>
40 #@INCLUDE_NEXT@ @NEXT_FCNTL_H@
43 /* Normal invocation convention. */
47 #include <sys/types.h>
48 /* On some systems other than glibc, <sys/stat.h> is a prerequisite of
49 <fcntl.h>. On glibc systems, we would like to avoid namespace pollution.
50 But on glibc systems, <fcntl.h> includes <sys/stat.h> inside an
51 extern "C" { ... } block, which leads to errors in C++ mode with the
52 overridden <sys/stat.h> from gnulib. These errors are known to be gone
53 with g++ version >= 4.3. */
54 #if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
55 # include <sys/stat.h>
57 /* The include_next requires a split double-inclusion guard. */
58 #@INCLUDE_NEXT@ @NEXT_FCNTL_H@
63 #ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems. */
68 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
70 /* The definition of _GL_ARG_NONNULL is copied here. */
72 /* The definition of _GL_WARN_ON_USE is copied here. */
75 /* Declare overridden functions. */
79 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
81 # define fcntl rpl_fcntl
83 _GL_FUNCDECL_RPL (fcntl, int, (int fd, int action, ...));
84 _GL_CXXALIAS_RPL (fcntl, int, (int fd, int action, ...));
87 _GL_FUNCDECL_SYS (fcntl, int, (int fd, int action, ...));
89 _GL_CXXALIAS_SYS (fcntl, int, (int fd, int action, ...));
91 _GL_CXXALIASWARN (fcntl);
92 #elif defined GNULIB_POSIXCHECK
94 # if HAVE_RAW_DECL_FCNTL
95 _GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - "
96 "use gnulib module fcntl for portability");
102 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
104 # define open rpl_open
106 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
107 _GL_ARG_NONNULL ((1)));
108 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
110 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
112 /* On HP-UX 11, in C++ mode, open() is defined as an inline function with a
113 default argument. _GL_CXXALIASWARN does not work in this case. */
115 _GL_CXXALIASWARN (open);
117 #elif defined GNULIB_POSIXCHECK
119 /* Assume open is always declared. */
120 _GL_WARN_ON_USE (open, "open is not always POSIX compliant - "
121 "use gnulib module open for portability");
125 # if @REPLACE_OPENAT@
126 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
128 # define openat rpl_openat
130 _GL_FUNCDECL_RPL (openat, int,
131 (int fd, char const *file, int flags, /* mode_t mode */ ...)
132 _GL_ARG_NONNULL ((2)));
133 _GL_CXXALIAS_RPL (openat, int,
134 (int fd, char const *file, int flags, /* mode_t mode */ ...));
137 _GL_FUNCDECL_SYS (openat, int,
138 (int fd, char const *file, int flags, /* mode_t mode */ ...)
139 _GL_ARG_NONNULL ((2)));
141 _GL_CXXALIAS_SYS (openat, int,
142 (int fd, char const *file, int flags, /* mode_t mode */ ...));
144 _GL_CXXALIASWARN (openat);
145 #elif defined GNULIB_POSIXCHECK
147 # if HAVE_RAW_DECL_OPENAT
148 _GL_WARN_ON_USE (openat, "openat is not portable - "
149 "use gnulib module openat for portability");
154 /* Fix up the FD_* macros, only known to be missing on mingw. */
157 # define FD_CLOEXEC 1
160 /* Fix up the supported F_* macros. Intentionally leave other F_*
161 macros undefined. Only known to be missing on mingw. */
163 #ifndef F_DUPFD_CLOEXEC
164 # define F_DUPFD_CLOEXEC 0x40000000
165 /* Witness variable: 1 if gnulib defined F_DUPFD_CLOEXEC, 0 otherwise. */
166 # define GNULIB_defined_F_DUPFD_CLOEXEC 1
168 # define GNULIB_defined_F_DUPFD_CLOEXEC 0
179 /* Fix up the O_* macros. */
181 #if !defined O_DIRECT && defined O_DIRECTIO
182 /* Tru64 spells it `O_DIRECTIO'. */
183 # define O_DIRECT O_DIRECTIO
186 #if !defined O_CLOEXEC && defined O_NOINHERIT
187 /* Mingw spells it `O_NOINHERIT'. Intentionally leave it
188 undefined if not available. */
189 # define O_CLOEXEC O_NOINHERIT
201 # define O_DIRECTORY 0
209 # define O_EXEC O_RDONLY /* This is often close enough in older systems. */
221 # define O_NONBLOCK O_NDELAY
229 # define O_NOFOLLOW 0
241 # define O_SEARCH O_RDONLY /* This is often close enough in older systems. */
249 # define O_TTY_INIT 0
252 /* For systems that distinguish between text and binary I/O.
253 O_BINARY is usually declared in fcntl.h */
254 #if !defined O_BINARY && defined _O_BINARY
255 /* For MSC-compatible compilers. */
256 # define O_BINARY _O_BINARY
257 # define O_TEXT _O_TEXT
260 #if defined __BEOS__ || defined __HAIKU__
261 /* BeOS 5 and Haiku have O_BINARY and O_TEXT, but they have no effect. */
271 /* Fix up the AT_* macros. */
273 /* Work around a bug in Solaris 9 and 10: AT_FDCWD is positive. Its
274 value exceeds INT_MAX, so its use as an int doesn't conform to the
275 C standard, and GCC and Sun C complain in some cases. If the bug
276 is present, undef AT_FDCWD here, so it can be redefined below. */
277 #if 0 < AT_FDCWD && AT_FDCWD == 0xffd19553
281 /* Use the same bit pattern as Solaris 9, but with the proper
282 signedness. The bit pattern is important, in case this actually is
283 Solaris with the above workaround. */
285 # define AT_FDCWD (-3041965)
288 /* Use the same values as Solaris 9. This shouldn't matter, but
289 there's no real reason to differ. */
290 #ifndef AT_SYMLINK_NOFOLLOW
291 # define AT_SYMLINK_NOFOLLOW 4096
295 # define AT_REMOVEDIR 1
298 /* Solaris 9 lacks these two, so just pick unique values. */
299 #ifndef AT_SYMLINK_FOLLOW
300 # define AT_SYMLINK_FOLLOW 2
304 # define AT_EACCESS 4
308 #endif /* _GL_FCNTL_H */
309 #endif /* _GL_FCNTL_H */