New module 'open'.
[gnulib.git] / lib / fcntl.in.h
1 /* Like <fcntl.h>, but with non-working flags defined to 0.
2
3    Copyright (C) 2006-2007 Free Software Foundation, Inc.
4
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 2, or (at your option)
8    any later version.
9
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, write to the Free Software Foundation,
17    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
18
19 /* written by Paul Eggert */
20
21 #ifndef _GL_FCNTL_H
22
23 #include <sys/types.h>
24 #include <sys/stat.h>
25 #include <unistd.h>
26 /* The include_next requires a split double-inclusion guard.  */
27 #@INCLUDE_NEXT@ @NEXT_FCNTL_H@
28
29 #ifndef _GL_FCNTL_H
30 #define _GL_FCNTL_H
31
32
33 /* Declare overridden functions.  */
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 #if (@GNULIB_OPEN@ && @REPLACE_OPEN@) || defined FCHDIR_REPLACEMENT
40 # define open rpl_open
41 extern int open (const char *filename, int flags, ...);
42 #endif
43
44 #ifdef __cplusplus
45 }
46 #endif
47
48
49 /* Fix up the O_* macros.  */
50
51 #if !defined O_DIRECT && defined O_DIRECTIO
52 /* Tru64 spells it `O_DIRECTIO'.  */
53 # define O_DIRECT O_DIRECTIO
54 #endif
55
56 #ifndef O_DIRECT
57 # define O_DIRECT 0
58 #endif
59
60 #ifndef O_DIRECTORY
61 # define O_DIRECTORY 0
62 #endif
63
64 #ifndef O_DSYNC
65 # define O_DSYNC 0
66 #endif
67
68 #ifndef O_NDELAY
69 # define O_NDELAY 0
70 #endif
71
72 #ifndef O_NOATIME
73 # define O_NOATIME 0
74 #endif
75
76 #ifndef O_NONBLOCK
77 # define O_NONBLOCK O_NDELAY
78 #endif
79
80 #ifndef O_NOCTTY
81 # define O_NOCTTY 0
82 #endif
83
84 #ifndef O_NOFOLLOW
85 # define O_NOFOLLOW 0
86 #endif
87
88 #ifndef O_NOLINKS
89 # define O_NOLINKS 0
90 #endif
91
92 #ifndef O_RSYNC
93 # define O_RSYNC 0
94 #endif
95
96 #ifndef O_SYNC
97 # define O_SYNC 0
98 #endif
99
100 /* For systems that distinguish between text and binary I/O.
101    O_BINARY is usually declared in fcntl.h  */
102 #if !defined O_BINARY && defined _O_BINARY
103   /* For MSC-compatible compilers.  */
104 # define O_BINARY _O_BINARY
105 # define O_TEXT _O_TEXT
106 #endif
107
108 #ifdef __BEOS__
109   /* BeOS 5 has O_BINARY and O_TEXT, but they have no effect.  */
110 # undef O_BINARY
111 # undef O_TEXT
112 #endif
113
114 #ifndef O_BINARY
115 # define O_BINARY 0
116 # define O_TEXT 0
117 #endif
118
119
120 #endif /* _GL_FCNTL_H */
121 #endif /* _GL_FCNTL_H */