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@
26 #if defined __need_system_fcntl_h
27 /* Special invocation convention. */
29 #include <sys/types.h>
30 #ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems. */
31 # include <sys/stat.h>
33 #@INCLUDE_NEXT@ @NEXT_FCNTL_H@
36 /* Normal invocation convention. */
40 #include <sys/types.h>
41 #ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems. */
42 # include <sys/stat.h>
44 /* The include_next requires a split double-inclusion guard. */
45 #@INCLUDE_NEXT@ @NEXT_FCNTL_H@
50 #ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems. */
55 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
57 /* The definition of _GL_ARG_NONNULL is copied here. */
59 /* The definition of _GL_WARN_ON_USE is copied here. */
62 /* Declare overridden functions. */
66 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
68 # define fcntl rpl_fcntl
70 _GL_FUNCDECL_RPL (fcntl, int, (int fd, int action, ...));
71 _GL_CXXALIAS_RPL (fcntl, int, (int fd, int action, ...));
74 _GL_FUNCDECL_SYS (fcntl, int, (int fd, int action, ...));
76 _GL_CXXALIAS_SYS (fcntl, int, (int fd, int action, ...));
78 _GL_CXXALIASWARN (fcntl);
79 #elif defined GNULIB_POSIXCHECK
81 # if HAVE_RAW_DECL_FCNTL
82 _GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - "
83 "use gnulib module fcntl for portability");
89 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
91 # define open rpl_open
93 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
94 _GL_ARG_NONNULL ((1)));
95 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
97 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
99 _GL_CXXALIASWARN (open);
100 #elif defined GNULIB_POSIXCHECK
102 /* Assume open is always declared. */
103 _GL_WARN_ON_USE (open, "open is not always POSIX compliant - "
104 "use gnulib module open for portability");
108 # if @REPLACE_OPENAT@
109 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
111 # define openat rpl_openat
113 _GL_FUNCDECL_RPL (openat, int,
114 (int fd, char const *file, int flags, /* mode_t mode */ ...)
115 _GL_ARG_NONNULL ((2)));
116 _GL_CXXALIAS_RPL (openat, int,
117 (int fd, char const *file, int flags, /* mode_t mode */ ...));
120 _GL_FUNCDECL_SYS (openat, int,
121 (int fd, char const *file, int flags, /* mode_t mode */ ...)
122 _GL_ARG_NONNULL ((2)));
124 _GL_CXXALIAS_SYS (openat, int,
125 (int fd, char const *file, int flags, /* mode_t mode */ ...));
127 _GL_CXXALIASWARN (openat);
128 #elif defined GNULIB_POSIXCHECK
130 # if HAVE_RAW_DECL_OPENAT
131 _GL_WARN_ON_USE (openat, "openat is not portable - "
132 "use gnulib module openat for portability");
137 /* Fix up the FD_* macros, only known to be missing on mingw. */
140 # define FD_CLOEXEC 1
143 /* Fix up the supported F_* macros. Intentionally leave other F_*
144 macros undefined. Only known to be missing on mingw. */
146 #ifndef F_DUPFD_CLOEXEC
147 # define F_DUPFD_CLOEXEC 0x40000000
148 /* Witness variable: 1 if gnulib defined F_DUPFD_CLOEXEC, 0 otherwise. */
149 # define GNULIB_defined_F_DUPFD_CLOEXEC 1
151 # define GNULIB_defined_F_DUPFD_CLOEXEC 0
162 /* Fix up the O_* macros. */
164 #if !defined O_DIRECT && defined O_DIRECTIO
165 /* Tru64 spells it `O_DIRECTIO'. */
166 # define O_DIRECT O_DIRECTIO
169 #if !defined O_CLOEXEC && defined O_NOINHERIT
170 /* Mingw spells it `O_NOINHERIT'. Intentionally leave it
171 undefined if not available. */
172 # define O_CLOEXEC O_NOINHERIT
180 # define O_DIRECTORY 0
196 # define O_NONBLOCK O_NDELAY
204 # define O_NOFOLLOW 0
220 # define O_TTY_INIT 0
223 /* For systems that distinguish between text and binary I/O.
224 O_BINARY is usually declared in fcntl.h */
225 #if !defined O_BINARY && defined _O_BINARY
226 /* For MSC-compatible compilers. */
227 # define O_BINARY _O_BINARY
228 # define O_TEXT _O_TEXT
231 #if defined __BEOS__ || defined __HAIKU__
232 /* BeOS 5 and Haiku have O_BINARY and O_TEXT, but they have no effect. */
242 /* Fix up the AT_* macros. */
244 /* Work around a bug in Solaris 9 and 10: AT_FDCWD is positive. Its
245 value exceeds INT_MAX, so its use as an int doesn't conform to the
246 C standard, and GCC and Sun C complain in some cases. If the bug
247 is present, undef AT_FDCWD here, so it can be redefined below. */
248 #if 0 < AT_FDCWD && AT_FDCWD == 0xffd19553
252 /* Use the same bit pattern as Solaris 9, but with the proper
253 signedness. The bit pattern is important, in case this actually is
254 Solaris with the above workaround. */
256 # define AT_FDCWD (-3041965)
259 /* Use the same values as Solaris 9. This shouldn't matter, but
260 there's no real reason to differ. */
261 #ifndef AT_SYMLINK_NOFOLLOW
262 # define AT_SYMLINK_NOFOLLOW 4096
266 # define AT_REMOVEDIR 1
269 /* Solaris 9 lacks these two, so just pick unique values. */
270 #ifndef AT_SYMLINK_FOLLOW
271 # define AT_SYMLINK_FOLLOW 2
275 # define AT_EACCESS 4
279 #endif /* _GL_FCNTL_H */
280 #endif /* _GL_FCNTL_H */