1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 #if __GNUC__ >= 3
21 @PRAGMA_SYSTEM_HEADER@
22 #endif
23 @PRAGMA_COLUMNS@
24
25 #if defined __need_system_fcntl_h
26
27
28
29
30 #include <sys/types.h>
31
32
33
34
35
36
37 #if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && (defined __ICC || !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))))
38 # include <sys/stat.h>
39 #endif
40 #@INCLUDE_NEXT@ @NEXT_FCNTL_H@
41
42
43 #if (@GNULIB_CREAT@ || @GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \
44 && (defined _WIN32 && ! defined __CYGWIN__)
45 # include <io.h>
46 #endif
47
48 #else
49
50
51 #ifndef _@GUARD_PREFIX@_FCNTL_H
52
53
54
55 #include <sys/types.h>
56
57
58
59
60
61
62 #if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && (defined __ICC || !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))))
63 # include <sys/stat.h>
64 #endif
65
66 #@INCLUDE_NEXT@ @NEXT_FCNTL_H@
67
68
69 #if (@GNULIB_CREAT@ || @GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \
70 && (defined _WIN32 && ! defined __CYGWIN__)
71 # include <io.h>
72 #endif
73
74 #ifndef _@GUARD_PREFIX@_FCNTL_H
75 #define _@GUARD_PREFIX@_FCNTL_H
76
77
78 #if !_GL_CONFIG_H_INCLUDED
79 #error "Please include config.h first."
80 #endif
81
82 #ifndef __GLIBC__
83 # include <unistd.h>
84 #endif
85
86
87
88
89
90
91
92
93
94
95
96 #if @GNULIB_CREAT@
97 # if @REPLACE_CREAT@
98 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
99 # undef creat
100 # define creat rpl_creat
101 # endif
102 _GL_FUNCDECL_RPL (creat, int, (const char *filename, mode_t mode)
103 _GL_ARG_NONNULL ((1)));
104 _GL_CXXALIAS_RPL (creat, int, (const char *filename, mode_t mode));
105 # elif defined _WIN32 && !defined __CYGWIN__
106 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
107 # undef creat
108 # define creat _creat
109 # endif
110 _GL_CXXALIAS_MDA (creat, int, (const char *filename, mode_t mode));
111 # else
112 _GL_CXXALIAS_SYS (creat, int, (const char *filename, mode_t mode));
113 # endif
114 _GL_CXXALIASWARN (creat);
115 #elif defined GNULIB_POSIXCHECK
116 # undef creat
117
118 _GL_WARN_ON_USE (creat, "creat is not always POSIX compliant - "
119 "use gnulib module creat for portability");
120 #elif @GNULIB_MDA_CREAT@
121
122
123
124 # if defined _WIN32 && !defined __CYGWIN__
125 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
126 # undef creat
127 # define creat _creat
128 # endif
129
130 _GL_CXXALIAS_MDA_CAST (creat, int, (const char *filename, mode_t mode));
131 # else
132 _GL_CXXALIAS_SYS (creat, int, (const char *filename, mode_t mode));
133 # endif
134 _GL_CXXALIASWARN (creat);
135 #endif
136
137 #if @GNULIB_FCNTL@
138 # if @REPLACE_FCNTL@
139 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
140 # undef fcntl
141 # define fcntl rpl_fcntl
142 # endif
143 _GL_FUNCDECL_RPL (fcntl, int, (int fd, int action, ...));
144 _GL_CXXALIAS_RPL (fcntl, int, (int fd, int action, ...));
145 # if !GNULIB_defined_rpl_fcntl
146 # define GNULIB_defined_rpl_fcntl 1
147 # endif
148 # else
149 # if !@HAVE_FCNTL@
150 _GL_FUNCDECL_SYS (fcntl, int, (int fd, int action, ...));
151 # if !GNULIB_defined_fcntl
152 # define GNULIB_defined_fcntl 1
153 # endif
154 # endif
155 _GL_CXXALIAS_SYS (fcntl, int, (int fd, int action, ...));
156 # endif
157 _GL_CXXALIASWARN (fcntl);
158 #elif defined GNULIB_POSIXCHECK
159 # undef fcntl
160 # if HAVE_RAW_DECL_FCNTL
161 _GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - "
162 "use gnulib module fcntl for portability");
163 # endif
164 #endif
165
166 #if @GNULIB_OPEN@
167 # if @REPLACE_OPEN@
168 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
169 # undef open
170 # define open rpl_open
171 # endif
172 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
173 _GL_ARG_NONNULL ((1)));
174 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
175 # elif defined _WIN32 && !defined __CYGWIN__
176 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
177 # undef open
178 # define open _open
179 # endif
180 _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
181 # else
182 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
183 # endif
184
185
186 # if !defined __hpux
187 _GL_CXXALIASWARN (open);
188 # endif
189 #elif defined GNULIB_POSIXCHECK
190 # undef open
191
192 _GL_WARN_ON_USE (open, "open is not always POSIX compliant - "
193 "use gnulib module open for portability");
194 #elif @GNULIB_MDA_OPEN@
195
196
197
198 # if defined _WIN32 && !defined __CYGWIN__
199 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
200 # undef open
201 # define open _open
202 # endif
203 _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
204 # else
205 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
206 # endif
207 # if !defined __hpux
208 _GL_CXXALIASWARN (open);
209 # endif
210 #endif
211
212 #if @GNULIB_OPENAT@
213 # if @REPLACE_OPENAT@
214 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
215 # undef openat
216 # define openat rpl_openat
217 # endif
218 _GL_FUNCDECL_RPL (openat, int,
219 (int fd, char const *file, int flags, ...)
220 _GL_ARG_NONNULL ((2)));
221 _GL_CXXALIAS_RPL (openat, int,
222 (int fd, char const *file, int flags, ...));
223 # else
224 # if !@HAVE_OPENAT@
225 _GL_FUNCDECL_SYS (openat, int,
226 (int fd, char const *file, int flags, ...)
227 _GL_ARG_NONNULL ((2)));
228 # endif
229 _GL_CXXALIAS_SYS (openat, int,
230 (int fd, char const *file, int flags, ...));
231 # endif
232 _GL_CXXALIASWARN (openat);
233 #elif defined GNULIB_POSIXCHECK
234 # undef openat
235 # if HAVE_RAW_DECL_OPENAT
236 _GL_WARN_ON_USE (openat, "openat is not portable - "
237 "use gnulib module openat for portability");
238 # endif
239 #endif
240
241
242
243
244 #ifndef FD_CLOEXEC
245 # define FD_CLOEXEC 1
246 #endif
247
248
249
250
251 #ifndef F_DUPFD_CLOEXEC
252 # define F_DUPFD_CLOEXEC 0x40000000
253
254 # define GNULIB_defined_F_DUPFD_CLOEXEC 1
255 #else
256 # define GNULIB_defined_F_DUPFD_CLOEXEC 0
257 #endif
258
259 #ifndef F_DUPFD
260 # define F_DUPFD 1
261 #endif
262
263 #ifndef F_GETFD
264 # define F_GETFD 2
265 #endif
266
267
268
269
270
271
272 #ifdef _AIX
273 # include <limits.h>
274 # if defined O_CLOEXEC && ! (INT_MIN <= O_CLOEXEC && O_CLOEXEC <= INT_MAX)
275 # undef O_CLOEXEC
276 # endif
277 # if defined O_NOFOLLOW && ! (INT_MIN <= O_NOFOLLOW && O_NOFOLLOW <= INT_MAX)
278 # undef O_NOFOLLOW
279 # endif
280 # if defined O_TTY_INIT && ! (INT_MIN <= O_TTY_INIT && O_TTY_INIT <= INT_MAX)
281 # undef O_TTY_INIT
282 # endif
283 #endif
284
285 #if !defined O_DIRECT && defined O_DIRECTIO
286
287 # define O_DIRECT O_DIRECTIO
288 #endif
289
290 #if !defined O_CLOEXEC && defined O_NOINHERIT
291
292 # define O_CLOEXEC O_NOINHERIT
293 #endif
294
295 #ifndef O_CLOEXEC
296 # define O_CLOEXEC 0x40000000
297 # define GNULIB_defined_O_CLOEXEC 1
298 #else
299 # define GNULIB_defined_O_CLOEXEC 0
300 #endif
301
302 #ifndef O_DIRECT
303 # define O_DIRECT 0
304 #endif
305
306 #ifndef O_DIRECTORY
307 # define O_DIRECTORY 0
308 #endif
309
310 #ifndef O_DSYNC
311 # define O_DSYNC 0
312 #endif
313
314 #ifndef O_EXEC
315 # define O_EXEC O_RDONLY
316 #endif
317
318 #ifndef O_IGNORE_CTTY
319 # define O_IGNORE_CTTY 0
320 #endif
321
322 #ifndef O_NDELAY
323 # define O_NDELAY 0
324 #endif
325
326 #ifndef O_NOATIME
327 # define O_NOATIME 0
328 #endif
329
330 #ifndef O_NONBLOCK
331 # define O_NONBLOCK O_NDELAY
332 #endif
333
334
335
336
337 #if @GNULIB_NONBLOCKING@
338 # if O_NONBLOCK
339 # define GNULIB_defined_O_NONBLOCK 0
340 # else
341 # define GNULIB_defined_O_NONBLOCK 1
342 # undef O_NONBLOCK
343 # define O_NONBLOCK 0x40000000
344 # endif
345 #endif
346
347 #ifndef O_NOCTTY
348 # define O_NOCTTY 0
349 #endif
350
351 #ifndef O_NOFOLLOW
352 # define O_NOFOLLOW 0
353 #endif
354
355 #ifndef O_NOLINK
356 # define O_NOLINK 0
357 #endif
358
359 #ifndef O_NOLINKS
360 # define O_NOLINKS 0
361 #endif
362
363 #ifndef O_NOTRANS
364 # define O_NOTRANS 0
365 #endif
366
367 #ifndef O_RSYNC
368 # define O_RSYNC 0
369 #endif
370
371 #ifndef O_SEARCH
372 # define O_SEARCH O_RDONLY
373 #endif
374
375 #ifndef O_SYNC
376 # define O_SYNC 0
377 #endif
378
379 #ifndef O_TTY_INIT
380 # define O_TTY_INIT 0
381 #endif
382
383 #if ~O_ACCMODE & (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH)
384 # undef O_ACCMODE
385 # define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH)
386 #endif
387
388
389
390 #if !defined O_BINARY && defined _O_BINARY
391
392 # define O_BINARY _O_BINARY
393 # define O_TEXT _O_TEXT
394 #endif
395
396 #if defined __BEOS__ || defined __HAIKU__
397
398 # undef O_BINARY
399 # undef O_TEXT
400 #endif
401
402 #ifndef O_BINARY
403 # define O_BINARY 0
404 # define O_TEXT 0
405 #endif
406
407
408
409
410
411
412
413 #if 0 < AT_FDCWD && AT_FDCWD == 0xffd19553
414 # undef AT_FDCWD
415 #endif
416
417
418
419
420 #ifndef AT_FDCWD
421 # define AT_FDCWD (-3041965)
422 #endif
423
424
425
426 #ifndef AT_SYMLINK_NOFOLLOW
427 # define AT_SYMLINK_NOFOLLOW 4096
428 #endif
429
430 #ifndef AT_REMOVEDIR
431 # define AT_REMOVEDIR 1
432 #endif
433
434
435 #ifndef AT_SYMLINK_FOLLOW
436 # define AT_SYMLINK_FOLLOW 2
437 #endif
438
439 #ifndef AT_EACCESS
440 # define AT_EACCESS 4
441 #endif
442
443
444 #ifndef AT_NO_AUTOMOUNT
445 # define AT_NO_AUTOMOUNT 0
446 #endif
447
448 #endif
449 #endif
450 #endif