Import upstream version 1.26
[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-2011 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 #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>
39 #endif
40 #@INCLUDE_NEXT@ @NEXT_FCNTL_H@
41
42 #else
43 /* Normal invocation convention.  */
44
45 #ifndef _GL_FCNTL_H
46
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>
56 #endif
57 /* The include_next requires a split double-inclusion guard.  */
58 #@INCLUDE_NEXT@ @NEXT_FCNTL_H@
59
60 #ifndef _GL_FCNTL_H
61 #define _GL_FCNTL_H
62
63 #ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems.  */
64 # include <unistd.h>
65 #endif
66
67
68 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
69
70 /* The definition of _GL_ARG_NONNULL is copied here.  */
71
72 /* The definition of _GL_WARN_ON_USE is copied here.  */
73
74
75 /* Declare overridden functions.  */
76
77 #if @GNULIB_FCNTL@
78 # if @REPLACE_FCNTL@
79 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
80 #   undef fcntl
81 #   define fcntl rpl_fcntl
82 #  endif
83 _GL_FUNCDECL_RPL (fcntl, int, (int fd, int action, ...));
84 _GL_CXXALIAS_RPL (fcntl, int, (int fd, int action, ...));
85 # else
86 #  if !@HAVE_FCNTL@
87 _GL_FUNCDECL_SYS (fcntl, int, (int fd, int action, ...));
88 #  endif
89 _GL_CXXALIAS_SYS (fcntl, int, (int fd, int action, ...));
90 # endif
91 _GL_CXXALIASWARN (fcntl);
92 #elif defined GNULIB_POSIXCHECK
93 # undef fcntl
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");
97 # endif
98 #endif
99
100 #if @GNULIB_OPEN@
101 # if @REPLACE_OPEN@
102 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
103 #   undef open
104 #   define open rpl_open
105 #  endif
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, ...));
109 # else
110 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
111 # endif
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.  */
114 # if !defined __hpux
115 _GL_CXXALIASWARN (open);
116 # endif
117 #elif defined GNULIB_POSIXCHECK
118 # undef open
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");
122 #endif
123
124 #if @GNULIB_OPENAT@
125 # if @REPLACE_OPENAT@
126 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
127 #   undef openat
128 #   define openat rpl_openat
129 #  endif
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 */ ...));
135 # else
136 #  if !@HAVE_OPENAT@
137 _GL_FUNCDECL_SYS (openat, int,
138                   (int fd, char const *file, int flags, /* mode_t mode */ ...)
139                   _GL_ARG_NONNULL ((2)));
140 #  endif
141 _GL_CXXALIAS_SYS (openat, int,
142                   (int fd, char const *file, int flags, /* mode_t mode */ ...));
143 # endif
144 _GL_CXXALIASWARN (openat);
145 #elif defined GNULIB_POSIXCHECK
146 # undef openat
147 # if HAVE_RAW_DECL_OPENAT
148 _GL_WARN_ON_USE (openat, "openat is not portable - "
149                  "use gnulib module openat for portability");
150 # endif
151 #endif
152
153
154 /* Fix up the FD_* macros, only known to be missing on mingw.  */
155
156 #ifndef FD_CLOEXEC
157 # define FD_CLOEXEC 1
158 #endif
159
160 /* Fix up the supported F_* macros.  Intentionally leave other F_*
161    macros undefined.  Only known to be missing on mingw.  */
162
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
167 #else
168 # define GNULIB_defined_F_DUPFD_CLOEXEC 0
169 #endif
170
171 #ifndef F_DUPFD
172 # define F_DUPFD 1
173 #endif
174
175 #ifndef F_GETFD
176 # define F_GETFD 2
177 #endif
178
179 /* Fix up the O_* macros.  */
180
181 #if !defined O_DIRECT && defined O_DIRECTIO
182 /* Tru64 spells it `O_DIRECTIO'.  */
183 # define O_DIRECT O_DIRECTIO
184 #endif
185
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
190 #endif
191
192 #ifndef O_CLOEXEC
193 # define O_CLOEXEC 0
194 #endif
195
196 #ifndef O_DIRECT
197 # define O_DIRECT 0
198 #endif
199
200 #ifndef O_DIRECTORY
201 # define O_DIRECTORY 0
202 #endif
203
204 #ifndef O_DSYNC
205 # define O_DSYNC 0
206 #endif
207
208 #ifndef O_EXEC
209 # define O_EXEC O_RDONLY /* This is often close enough in older systems.  */
210 #endif
211
212 #ifndef O_NDELAY
213 # define O_NDELAY 0
214 #endif
215
216 #ifndef O_NOATIME
217 # define O_NOATIME 0
218 #endif
219
220 #ifndef O_NONBLOCK
221 # define O_NONBLOCK O_NDELAY
222 #endif
223
224 #ifndef O_NOCTTY
225 # define O_NOCTTY 0
226 #endif
227
228 #ifndef O_NOFOLLOW
229 # define O_NOFOLLOW 0
230 #endif
231
232 #ifndef O_NOLINKS
233 # define O_NOLINKS 0
234 #endif
235
236 #ifndef O_RSYNC
237 # define O_RSYNC 0
238 #endif
239
240 #ifndef O_SEARCH
241 # define O_SEARCH O_RDONLY /* This is often close enough in older systems.  */
242 #endif
243
244 #ifndef O_SYNC
245 # define O_SYNC 0
246 #endif
247
248 #ifndef O_TTY_INIT
249 # define O_TTY_INIT 0
250 #endif
251
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
258 #endif
259
260 #if defined __BEOS__ || defined __HAIKU__
261   /* BeOS 5 and Haiku have O_BINARY and O_TEXT, but they have no effect.  */
262 # undef O_BINARY
263 # undef O_TEXT
264 #endif
265
266 #ifndef O_BINARY
267 # define O_BINARY 0
268 # define O_TEXT 0
269 #endif
270
271 /* Fix up the AT_* macros.  */
272
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
278 # undef AT_FDCWD
279 #endif
280
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.  */
284 #ifndef AT_FDCWD
285 # define AT_FDCWD (-3041965)
286 #endif
287
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
292 #endif
293
294 #ifndef AT_REMOVEDIR
295 # define AT_REMOVEDIR 1
296 #endif
297
298 /* Solaris 9 lacks these two, so just pick unique values.  */
299 #ifndef AT_SYMLINK_FOLLOW
300 # define AT_SYMLINK_FOLLOW 2
301 #endif
302
303 #ifndef AT_EACCESS
304 # define AT_EACCESS 4
305 #endif
306
307
308 #endif /* _GL_FCNTL_H */
309 #endif /* _GL_FCNTL_H */
310 #endif