761e853153bac15195a8b7830c592d199b2f5308
[gnulib.git] / lib / fcntl.in.h
1 /* Like <fcntl.h>, but with non-working flags defined to 0.
2
3    Copyright (C) 2006-2008 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 3 of the License, or
8    (at your option) 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, see <http://www.gnu.org/licenses/>.  */
17
18 /* written by Paul Eggert */
19
20 @PRAGMA_SYSTEM_HEADER@
21
22 #if defined __need_system_fcntl_h
23 /* Special invocation convention.  */
24
25 #include <sys/types.h>
26 #include <sys/stat.h>
27 #include <unistd.h>
28 #@INCLUDE_NEXT@ @NEXT_FCNTL_H@
29
30 #else
31 /* Normal invocation convention.  */
32
33 #ifndef _GL_FCNTL_H
34
35 #include <sys/types.h>
36 #include <sys/stat.h>
37 #include <unistd.h>
38 /* The include_next requires a split double-inclusion guard.  */
39 #@INCLUDE_NEXT@ @NEXT_FCNTL_H@
40
41 #ifndef _GL_FCNTL_H
42 #define _GL_FCNTL_H
43
44
45 /* Declare overridden functions.  */
46
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50
51 #if @GNULIB_OPEN@
52 # if @REPLACE_OPEN@
53 #  undef open
54 #  define open rpl_open
55 extern int open (const char *filename, int flags, ...);
56 # endif
57 #endif
58
59 #ifdef FCHDIR_REPLACEMENT
60 /* gnulib internal function.  */
61 extern void _gl_register_fd (int fd, const char *filename);
62 #endif
63
64 #ifdef __cplusplus
65 }
66 #endif
67
68
69 /* Fix up the O_* macros.  */
70
71 #if !defined O_DIRECT && defined O_DIRECTIO
72 /* Tru64 spells it `O_DIRECTIO'.  */
73 # define O_DIRECT O_DIRECTIO
74 #endif
75
76 #ifndef O_DIRECT
77 # define O_DIRECT 0
78 #endif
79
80 #ifndef O_DIRECTORY
81 # define O_DIRECTORY 0
82 #endif
83
84 #ifndef O_DSYNC
85 # define O_DSYNC 0
86 #endif
87
88 #ifndef O_NDELAY
89 # define O_NDELAY 0
90 #endif
91
92 #ifndef O_NOATIME
93 # define O_NOATIME 0
94 #endif
95
96 #ifndef O_NONBLOCK
97 # define O_NONBLOCK O_NDELAY
98 #endif
99
100 #ifndef O_NOCTTY
101 # define O_NOCTTY 0
102 #endif
103
104 #ifndef O_NOFOLLOW
105 # define O_NOFOLLOW 0
106 #endif
107
108 #ifndef O_NOLINKS
109 # define O_NOLINKS 0
110 #endif
111
112 #ifndef O_RSYNC
113 # define O_RSYNC 0
114 #endif
115
116 #ifndef O_SYNC
117 # define O_SYNC 0
118 #endif
119
120 /* For systems that distinguish between text and binary I/O.
121    O_BINARY is usually declared in fcntl.h  */
122 #if !defined O_BINARY && defined _O_BINARY
123   /* For MSC-compatible compilers.  */
124 # define O_BINARY _O_BINARY
125 # define O_TEXT _O_TEXT
126 #endif
127
128 #ifdef __BEOS__
129   /* BeOS 5 has O_BINARY and O_TEXT, but they have no effect.  */
130 # undef O_BINARY
131 # undef O_TEXT
132 #endif
133
134 #ifndef O_BINARY
135 # define O_BINARY 0
136 # define O_TEXT 0
137 #endif
138
139
140 #endif /* _GL_FCNTL_H */
141 #endif /* _GL_FCNTL_H */
142 #endif