1b816335fa89c3b8922534f21df9303e9801c618
[debian/tar] / gnu / fcntl.in.h
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.
4
5    Copyright (C) 2006-2013 Free Software Foundation, Inc.
6
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.
11
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.
16
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/>.  */
19
20 /* written by Paul Eggert */
21
22 #if __GNUC__ >= 3
23 @PRAGMA_SYSTEM_HEADER@
24 #endif
25 @PRAGMA_COLUMNS@
26
27 #if defined __need_system_fcntl_h
28 /* Special invocation convention.  */
29
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>
41 #endif
42 #@INCLUDE_NEXT@ @NEXT_FCNTL_H@
43
44 #else
45 /* Normal invocation convention.  */
46
47 #ifndef _@GUARD_PREFIX@_FCNTL_H
48
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>
60 #endif
61 /* The include_next requires a split double-inclusion guard.  */
62 #@INCLUDE_NEXT@ @NEXT_FCNTL_H@
63
64 #ifndef _@GUARD_PREFIX@_FCNTL_H
65 #define _@GUARD_PREFIX@_FCNTL_H
66
67 #ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems.  */
68 # include <unistd.h>
69 #endif
70
71 /* Native Windows platforms declare open(), creat() in <io.h>.  */
72 #if (@GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \
73     && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
74 # include <io.h>
75 #endif
76
77
78 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
79
80 /* The definition of _GL_ARG_NONNULL is copied here.  */
81
82 /* The definition of _GL_WARN_ON_USE is copied here.  */
83
84
85 /* Declare overridden functions.  */
86
87 #if @GNULIB_FCNTL@
88 # if @REPLACE_FCNTL@
89 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
90 #   undef fcntl
91 #   define fcntl rpl_fcntl
92 #  endif
93 _GL_FUNCDECL_RPL (fcntl, int, (int fd, int action, ...));
94 _GL_CXXALIAS_RPL (fcntl, int, (int fd, int action, ...));
95 # else
96 #  if !@HAVE_FCNTL@
97 _GL_FUNCDECL_SYS (fcntl, int, (int fd, int action, ...));
98 #  endif
99 _GL_CXXALIAS_SYS (fcntl, int, (int fd, int action, ...));
100 # endif
101 _GL_CXXALIASWARN (fcntl);
102 #elif defined GNULIB_POSIXCHECK
103 # undef fcntl
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");
107 # endif
108 #endif
109
110 #if @GNULIB_OPEN@
111 # if @REPLACE_OPEN@
112 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
113 #   undef open
114 #   define open rpl_open
115 #  endif
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, ...));
119 # else
120 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
121 # endif
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.  */
124 # if !defined __hpux
125 _GL_CXXALIASWARN (open);
126 # endif
127 #elif defined GNULIB_POSIXCHECK
128 # undef open
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");
132 #endif
133
134 #if @GNULIB_OPENAT@
135 # if @REPLACE_OPENAT@
136 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
137 #   undef openat
138 #   define openat rpl_openat
139 #  endif
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 */ ...));
145 # else
146 #  if !@HAVE_OPENAT@
147 _GL_FUNCDECL_SYS (openat, int,
148                   (int fd, char const *file, int flags, /* mode_t mode */ ...)
149                   _GL_ARG_NONNULL ((2)));
150 #  endif
151 _GL_CXXALIAS_SYS (openat, int,
152                   (int fd, char const *file, int flags, /* mode_t mode */ ...));
153 # endif
154 _GL_CXXALIASWARN (openat);
155 #elif defined GNULIB_POSIXCHECK
156 # undef openat
157 # if HAVE_RAW_DECL_OPENAT
158 _GL_WARN_ON_USE (openat, "openat is not portable - "
159                  "use gnulib module openat for portability");
160 # endif
161 #endif
162
163
164 /* Fix up the FD_* macros, only known to be missing on mingw.  */
165
166 #ifndef FD_CLOEXEC
167 # define FD_CLOEXEC 1
168 #endif
169
170 /* Fix up the supported F_* macros.  Intentionally leave other F_*
171    macros undefined.  Only known to be missing on mingw.  */
172
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
177 #else
178 # define GNULIB_defined_F_DUPFD_CLOEXEC 0
179 #endif
180
181 #ifndef F_DUPFD
182 # define F_DUPFD 1
183 #endif
184
185 #ifndef F_GETFD
186 # define F_GETFD 2
187 #endif
188
189 /* Fix up the O_* macros.  */
190
191 #if !defined O_DIRECT && defined O_DIRECTIO
192 /* Tru64 spells it 'O_DIRECTIO'.  */
193 # define O_DIRECT O_DIRECTIO
194 #endif
195
196 #if !defined O_CLOEXEC && defined O_NOINHERIT
197 /* Mingw spells it 'O_NOINHERIT'.  */
198 # define O_CLOEXEC O_NOINHERIT
199 #endif
200
201 #ifndef O_CLOEXEC
202 # define O_CLOEXEC 0
203 #endif
204
205 #ifndef O_DIRECT
206 # define O_DIRECT 0
207 #endif
208
209 #ifndef O_DIRECTORY
210 # define O_DIRECTORY 0
211 #endif
212
213 #ifndef O_DSYNC
214 # define O_DSYNC 0
215 #endif
216
217 #ifndef O_EXEC
218 # define O_EXEC O_RDONLY /* This is often close enough in older systems.  */
219 #endif
220
221 #ifndef O_IGNORE_CTTY
222 # define O_IGNORE_CTTY 0
223 #endif
224
225 #ifndef O_NDELAY
226 # define O_NDELAY 0
227 #endif
228
229 #ifndef O_NOATIME
230 # define O_NOATIME 0
231 #endif
232
233 #ifndef O_NONBLOCK
234 # define O_NONBLOCK O_NDELAY
235 #endif
236
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@
241 # if O_NONBLOCK
242 #  define GNULIB_defined_O_NONBLOCK 0
243 # else
244 #  define GNULIB_defined_O_NONBLOCK 1
245 #  undef O_NONBLOCK
246 #  define O_NONBLOCK 0x40000000
247 # endif
248 #endif
249
250 #ifndef O_NOCTTY
251 # define O_NOCTTY 0
252 #endif
253
254 #ifndef O_NOFOLLOW
255 # define O_NOFOLLOW 0
256 #endif
257
258 #ifndef O_NOLINK
259 # define O_NOLINK 0
260 #endif
261
262 #ifndef O_NOLINKS
263 # define O_NOLINKS 0
264 #endif
265
266 #ifndef O_NOTRANS
267 # define O_NOTRANS 0
268 #endif
269
270 #ifndef O_RSYNC
271 # define O_RSYNC 0
272 #endif
273
274 #ifndef O_SEARCH
275 # define O_SEARCH O_RDONLY /* This is often close enough in older systems.  */
276 #endif
277
278 #ifndef O_SYNC
279 # define O_SYNC 0
280 #endif
281
282 #ifndef O_TTY_INIT
283 # define O_TTY_INIT 0
284 #endif
285
286 #if ~O_ACCMODE & (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH)
287 # undef O_ACCMODE
288 # define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH)
289 #endif
290
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
297 #endif
298
299 #if defined __BEOS__ || defined __HAIKU__
300   /* BeOS 5 and Haiku have O_BINARY and O_TEXT, but they have no effect.  */
301 # undef O_BINARY
302 # undef O_TEXT
303 #endif
304
305 #ifndef O_BINARY
306 # define O_BINARY 0
307 # define O_TEXT 0
308 #endif
309
310 /* Fix up the AT_* macros.  */
311
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
317 # undef AT_FDCWD
318 #endif
319
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.  */
323 #ifndef AT_FDCWD
324 # define AT_FDCWD (-3041965)
325 #endif
326
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
331 #endif
332
333 #ifndef AT_REMOVEDIR
334 # define AT_REMOVEDIR 1
335 #endif
336
337 /* Solaris 9 lacks these two, so just pick unique values.  */
338 #ifndef AT_SYMLINK_FOLLOW
339 # define AT_SYMLINK_FOLLOW 2
340 #endif
341
342 #ifndef AT_EACCESS
343 # define AT_EACCESS 4
344 #endif
345
346
347 #endif /* _@GUARD_PREFIX@_FCNTL_H */
348 #endif /* _@GUARD_PREFIX@_FCNTL_H */
349 #endif