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-2010 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 #ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems. */
32 # include <sys/stat.h>
34 #@INCLUDE_NEXT@ @NEXT_FCNTL_H@
37 /* Normal invocation convention. */
41 #include <sys/types.h>
42 #ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems. */
43 # include <sys/stat.h>
45 /* The include_next requires a split double-inclusion guard. */
46 #@INCLUDE_NEXT@ @NEXT_FCNTL_H@
51 #ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems. */
56 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
58 /* The definition of _GL_ARG_NONNULL is copied here. */
60 /* The definition of _GL_WARN_ON_USE is copied here. */
63 /* Declare overridden functions. */
67 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
69 # define fcntl rpl_fcntl
71 _GL_FUNCDECL_RPL (fcntl, int, (int fd, int action, ...));
72 _GL_CXXALIAS_RPL (fcntl, int, (int fd, int action, ...));
75 _GL_FUNCDECL_SYS (fcntl, int, (int fd, int action, ...));
77 _GL_CXXALIAS_SYS (fcntl, int, (int fd, int action, ...));
79 _GL_CXXALIASWARN (fcntl);
80 #elif defined GNULIB_POSIXCHECK
82 # if HAVE_RAW_DECL_FCNTL
83 _GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - "
84 "use gnulib module fcntl for portability");
90 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
92 # define open rpl_open
94 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
95 _GL_ARG_NONNULL ((1)));
96 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
98 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
100 _GL_CXXALIASWARN (open);
101 #elif defined GNULIB_POSIXCHECK
103 /* Assume open is always declared. */
104 _GL_WARN_ON_USE (open, "open is not always POSIX compliant - "
105 "use gnulib module open for portability");
109 # if @REPLACE_OPENAT@
110 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
112 # define openat rpl_openat
114 _GL_FUNCDECL_RPL (openat, int,
115 (int fd, char const *file, int flags, /* mode_t mode */ ...)
116 _GL_ARG_NONNULL ((2)));
117 _GL_CXXALIAS_RPL (openat, int,
118 (int fd, char const *file, int flags, /* mode_t mode */ ...));
121 _GL_FUNCDECL_SYS (openat, int,
122 (int fd, char const *file, int flags, /* mode_t mode */ ...)
123 _GL_ARG_NONNULL ((2)));
125 _GL_CXXALIAS_SYS (openat, int,
126 (int fd, char const *file, int flags, /* mode_t mode */ ...));
128 _GL_CXXALIASWARN (openat);
129 #elif defined GNULIB_POSIXCHECK
131 # if HAVE_RAW_DECL_OPENAT
132 _GL_WARN_ON_USE (openat, "openat is not portable - "
133 "use gnulib module openat for portability");
138 /* Fix up the FD_* macros, only known to be missing on mingw. */
141 # define FD_CLOEXEC 1
144 /* Fix up the supported F_* macros. Intentionally leave other F_*
145 macros undefined. Only known to be missing on mingw. */
147 #ifndef F_DUPFD_CLOEXEC
148 # define F_DUPFD_CLOEXEC 0x40000000
149 /* Witness variable: 1 if gnulib defined F_DUPFD_CLOEXEC, 0 otherwise. */
150 # define GNULIB_defined_F_DUPFD_CLOEXEC 1
152 # define GNULIB_defined_F_DUPFD_CLOEXEC 0
163 /* Fix up the O_* macros. */
165 #if !defined O_DIRECT && defined O_DIRECTIO
166 /* Tru64 spells it `O_DIRECTIO'. */
167 # define O_DIRECT O_DIRECTIO
170 #if !defined O_CLOEXEC && defined O_NOINHERIT
171 /* Mingw spells it `O_NOINHERIT'. Intentionally leave it
172 undefined if not available. */
173 # define O_CLOEXEC O_NOINHERIT
185 # define O_DIRECTORY 0
193 # define O_EXEC O_RDONLY /* This is often close enough in older systems. */
205 # define O_NONBLOCK O_NDELAY
213 # define O_NOFOLLOW 0
225 # define O_SEARCH O_RDONLY /* This is often close enough in older systems. */
233 # define O_TTY_INIT 0
236 /* For systems that distinguish between text and binary I/O.
237 O_BINARY is usually declared in fcntl.h */
238 #if !defined O_BINARY && defined _O_BINARY
239 /* For MSC-compatible compilers. */
240 # define O_BINARY _O_BINARY
241 # define O_TEXT _O_TEXT
244 #if defined __BEOS__ || defined __HAIKU__
245 /* BeOS 5 and Haiku have O_BINARY and O_TEXT, but they have no effect. */
255 /* Fix up the AT_* macros. */
257 /* Work around a bug in Solaris 9 and 10: AT_FDCWD is positive. Its
258 value exceeds INT_MAX, so its use as an int doesn't conform to the
259 C standard, and GCC and Sun C complain in some cases. If the bug
260 is present, undef AT_FDCWD here, so it can be redefined below. */
261 #if 0 < AT_FDCWD && AT_FDCWD == 0xffd19553
265 /* Use the same bit pattern as Solaris 9, but with the proper
266 signedness. The bit pattern is important, in case this actually is
267 Solaris with the above workaround. */
269 # define AT_FDCWD (-3041965)
272 /* Use the same values as Solaris 9. This shouldn't matter, but
273 there's no real reason to differ. */
274 #ifndef AT_SYMLINK_NOFOLLOW
275 # define AT_SYMLINK_NOFOLLOW 4096
279 # define AT_REMOVEDIR 1
282 /* Solaris 9 lacks these two, so just pick unique values. */
283 #ifndef AT_SYMLINK_FOLLOW
284 # define AT_SYMLINK_FOLLOW 2
288 # define AT_EACCESS 4
292 #endif /* _GL_FCNTL_H */
293 #endif /* _GL_FCNTL_H */