1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* Like <fcntl.h>, but with non-working flags defined to 0.
3
4   Copyright (C) 2006-2010 Free Software Foundation, Inc.
5
6   This program is free software: you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 3 of the License, or
9   (at your option) any later version.
10
11   This program is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
18
19/* written by Paul Eggert */
20
21#if __GNUC__ >= 3
22#pragma GCC system_header
23#endif
24
25#if defined __need_system_fcntl_h
26/* Special invocation convention.  */
27
28#include <sys/types.h>
29#ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems.  */
30# include <sys/stat.h>
31# include <unistd.h>
32#endif
33#include_next <fcntl.h>
34
35#else
36/* Normal invocation convention.  */
37
38#ifndef _GL_FCNTL_H
39
40#include <sys/types.h>
41#ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems.  */
42# include <sys/stat.h>
43# include <unistd.h>
44#endif
45/* The include_next requires a split double-inclusion guard.  */
46#include_next <fcntl.h>
47
48#ifndef _GL_FCNTL_H
49#define _GL_FCNTL_H
50
51
52/* The definition of GL_LINK_WARNING is copied here.  */
53/* GL_LINK_WARNING("literal string") arranges to emit the literal string as
54   a linker warning on most glibc systems.
55   We use a linker warning rather than a preprocessor warning, because
56   #warning cannot be used inside macros.  */
57#ifndef GL_LINK_WARNING
58  /* This works on platforms with GNU ld and ELF object format.
59     Testing __GLIBC__ is sufficient for asserting that GNU ld is in use.
60     Testing __ELF__ guarantees the ELF object format.
61     Testing __GNUC__ is necessary for the compound expression syntax.  */
62# if defined __GLIBC__ && defined __ELF__ && defined __GNUC__
63#  define GL_LINK_WARNING(message) \
64     GL_LINK_WARNING1 (__FILE__, __LINE__, message)
65#  define GL_LINK_WARNING1(file, line, message) \
66     GL_LINK_WARNING2 (file, line, message)  /* macroexpand file and line */
67#  define GL_LINK_WARNING2(file, line, message) \
68     GL_LINK_WARNING3 (file ":" #line ": warning: " message)
69#  define GL_LINK_WARNING3(message) \
70     ({ static const char warning[sizeof (message)]             \
71          __attribute__ ((__unused__,                           \
72                          __section__ (".gnu.warning"),         \
73                          __aligned__ (1)))                     \
74          = message "\n";                                       \
75        (void)0;                                                \
76     })
77# else
78#  define GL_LINK_WARNING(message) ((void) 0)
79# endif
80#endif
81
82/* The definition of _GL_ARG_NONNULL is copied here.  */
83/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
84   that the values passed as arguments n, ..., m must be non-NULL pointers.
85   n = 1 stands for the first argument, n = 2 for the second argument etc.  */
86#ifndef _GL_ARG_NONNULL
87# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
88#  define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
89# else
90#  define _GL_ARG_NONNULL(params)
91# endif
92#endif
93
94
95/* Declare overridden functions.  */
96
97#ifdef __cplusplus
98extern "C" {
99#endif
100
101#if 1
102# if 1
103#  undef fcntl
104#  define fcntl rpl_fcntl
105# endif
106# if !1 || 1
107extern int fcntl (int fd, int action, ...);
108# endif
109#elif defined GNULIB_POSIXCHECK
110# undef fcntl
111# define fcntl \
112    (GL_LINK_WARNING ("fcntl is not always POSIX compliant - " \
113                      "use gnulib module fcntl for portability"), \
114     fcntl)
115#endif
116
117#if 1
118# if 1
119#  undef open
120#  define open rpl_open
121extern int open (const char *filename, int flags, ...) _GL_ARG_NONNULL ((1));
122# endif
123#elif defined GNULIB_POSIXCHECK
124# undef open
125# define open \
126    (GL_LINK_WARNING ("open is not always POSIX compliant - " \
127                      "use gnulib module open for portability"), \
128     open)
129#endif
130
131#if 1
132# if 1
133#  undef openat
134#  define openat rpl_openat
135# endif
136# if !1 || 1
137extern int openat (int fd, char const *file, int flags, /* mode_t mode */ ...)
138     _GL_ARG_NONNULL ((2));
139# endif
140#elif defined GNULIB_POSIXCHECK
141# undef openat
142# define openat \
143    (GL_LINK_WARNING ("openat is not portable - " \
144                      "use gnulib module openat for portability"), \
145     openat)
146#endif
147
148#ifdef __cplusplus
149}
150#endif
151
152/* Fix up the FD_* macros, only known to be missing on mingw.  */
153
154#ifndef FD_CLOEXEC
155# define FD_CLOEXEC 1
156#endif
157
158/* Fix up the supported F_* macros.  Intentionally leave other F_*
159   macros undefined.  Only known to be missing on mingw.  */
160
161#ifndef F_DUPFD_CLOEXEC
162# define F_DUPFD_CLOEXEC 0x40000000
163/* Witness variable: 1 if gnulib defined F_DUPFD_CLOEXEC, 0 otherwise.  */
164# define GNULIB_defined_F_DUPFD_CLOEXEC 1
165#else
166# define GNULIB_defined_F_DUPFD_CLOEXEC 0
167#endif
168
169#ifndef F_DUPFD
170# define F_DUPFD 1
171#endif
172
173#ifndef F_GETFD
174# define F_GETFD 2
175#endif
176
177/* Fix up the O_* macros.  */
178
179#if !defined O_DIRECT && defined O_DIRECTIO
180/* Tru64 spells it `O_DIRECTIO'.  */
181# define O_DIRECT O_DIRECTIO
182#endif
183
184#if !defined O_CLOEXEC && defined O_NOINHERIT
185/* Mingw spells it `O_NOINHERIT'.  Intentionally leave it
186   undefined if not available.  */
187# define O_CLOEXEC O_NOINHERIT
188#endif
189
190#ifndef O_DIRECT
191# define O_DIRECT 0
192#endif
193
194#ifndef O_DIRECTORY
195# define O_DIRECTORY 0
196#endif
197
198#ifndef O_DSYNC
199# define O_DSYNC 0
200#endif
201
202#ifndef O_NDELAY
203# define O_NDELAY 0
204#endif
205
206#ifndef O_NOATIME
207# define O_NOATIME 0
208#endif
209
210#ifndef O_NONBLOCK
211# define O_NONBLOCK O_NDELAY
212#endif
213
214#ifndef O_NOCTTY
215# define O_NOCTTY 0
216#endif
217
218#ifndef O_NOFOLLOW
219# define O_NOFOLLOW 0
220#endif
221
222#ifndef O_NOLINKS
223# define O_NOLINKS 0
224#endif
225
226#ifndef O_RSYNC
227# define O_RSYNC 0
228#endif
229
230#ifndef O_SYNC
231# define O_SYNC 0
232#endif
233
234#ifndef O_TTY_INIT
235# define O_TTY_INIT 0
236#endif
237
238/* For systems that distinguish between text and binary I/O.
239   O_BINARY is usually declared in fcntl.h  */
240#if !defined O_BINARY && defined _O_BINARY
241  /* For MSC-compatible compilers.  */
242# define O_BINARY _O_BINARY
243# define O_TEXT _O_TEXT
244#endif
245
246#if defined __BEOS__ || defined __HAIKU__
247  /* BeOS 5 and Haiku have O_BINARY and O_TEXT, but they have no effect.  */
248# undef O_BINARY
249# undef O_TEXT
250#endif
251
252#ifndef O_BINARY
253# define O_BINARY 0
254# define O_TEXT 0
255#endif
256
257/* Fix up the AT_* macros.  */
258
259/* Work around a bug in Solaris 9 and 10: AT_FDCWD is positive.  Its
260   value exceeds INT_MAX, so its use as an int doesn't conform to the
261   C standard, and GCC and Sun C complain in some cases.  If the bug
262   is present, undef AT_FDCWD here, so it can be redefined below.  */
263#if 0 < AT_FDCWD && AT_FDCWD == 0xffd19553
264# undef AT_FDCWD
265#endif
266
267/* Use the same bit pattern as Solaris 9, but with the proper
268   signedness.  The bit pattern is important, in case this actually is
269   Solaris with the above workaround.  */
270#ifndef AT_FDCWD
271# define AT_FDCWD (-3041965)
272#endif
273
274/* Use the same values as Solaris 9.  This shouldn't matter, but
275   there's no real reason to differ.  */
276#ifndef AT_SYMLINK_NOFOLLOW
277# define AT_SYMLINK_NOFOLLOW 4096
278#endif
279
280#ifndef AT_REMOVEDIR
281# define AT_REMOVEDIR 1
282#endif
283
284/* Solaris 9 lacks these two, so just pick unique values.  */
285#ifndef AT_SYMLINK_FOLLOW
286# define AT_SYMLINK_FOLLOW 2
287#endif
288
289#ifndef AT_EACCESS
290# define AT_EACCESS 4
291#endif
292
293
294#endif /* _GL_FCNTL_H */
295#endif /* _GL_FCNTL_H */
296#endif
297