comparison src/sysfile.h @ 410:de805c49cfc1 r21-2-35

Import from CVS: tag r21-2-35
author cvs
date Mon, 13 Aug 2007 11:19:21 +0200
parents 2f8bb876ab1d
children 697ef44129c6
comparison
equal deleted inserted replaced
409:301b9ebbdf3b 410:de805c49cfc1
22 22
23 #ifndef INCLUDED_sysfile_h_ 23 #ifndef INCLUDED_sysfile_h_
24 #define INCLUDED_sysfile_h_ 24 #define INCLUDED_sysfile_h_
25 25
26 #include <errno.h> 26 #include <errno.h>
27 #include <limits.h> 27
28 28 #ifndef WIN32_NATIVE
29 #ifndef WINDOWSNT
30 #include <sys/errno.h> /* <errno.h> does not always imply this */ 29 #include <sys/errno.h> /* <errno.h> does not always imply this */
31 #endif 30 #endif
32 31
33 #ifdef HAVE_UNISTD_H 32 #ifdef HAVE_UNISTD_H
34 #include <unistd.h> 33 #include <unistd.h>
42 /* Load sys/types.h if not already loaded. 41 /* Load sys/types.h if not already loaded.
43 In some systems loading it twice is suicidal. */ 42 In some systems loading it twice is suicidal. */
44 #ifndef makedev 43 #ifndef makedev
45 #include <sys/types.h> /* some typedefs are used in sys/file.h */ 44 #include <sys/types.h> /* some typedefs are used in sys/file.h */
46 #endif 45 #endif
46
47 #ifndef WIN32_NATIVE
47 #include <sys/file.h> 48 #include <sys/file.h>
49 #endif
50
48 #include <sys/stat.h> 51 #include <sys/stat.h>
52
53 #ifndef WIN32_NATIVE
49 #include <sys/param.h> 54 #include <sys/param.h>
50 55 #endif
51 #if defined (NeXT) || defined(__CYGWIN32__) 56
57 #if defined (NeXT) || defined(CYGWIN)
52 /* what is needed from here? Do others need it too? 58 /* what is needed from here? Do others need it too?
53 O_BINARY is in here under cygwin. */ 59 O_BINARY is in here under cygwin. */
54 # include <sys/fcntl.h> 60 # include <sys/fcntl.h>
55 #endif /* NeXT */ 61 #endif /* NeXT */
56 62
57 #ifdef WINDOWSNT 63 #ifdef WIN32_NATIVE
58 #include <io.h> 64 #include <io.h>
59 #include <direct.h> 65 #include <direct.h>
60 #endif 66 #endif
61 67
62 #ifndef STDERR_FILENO 68 #ifndef STDERR_FILENO
93 #define OPEN_TEXT (0) 99 #define OPEN_TEXT (0)
94 #endif 100 #endif
95 #endif 101 #endif
96 102
97 #ifndef CREAT_MODE 103 #ifndef CREAT_MODE
98 #ifdef WINDOWSNT 104 #ifdef WIN32_NATIVE
99 #define CREAT_MODE (S_IREAD | S_IWRITE) 105 #define CREAT_MODE (S_IREAD | S_IWRITE)
100 #else 106 #else
101 #define CREAT_MODE (0666) 107 #define CREAT_MODE (0666)
102 #endif 108 #endif
103 #endif 109 #endif
113 #ifndef READ_BINARY 119 #ifndef READ_BINARY
114 #ifdef O_BINARY 120 #ifdef O_BINARY
115 #define READ_BINARY "rb" 121 #define READ_BINARY "rb"
116 #else 122 #else
117 #define READ_BINARY "r" 123 #define READ_BINARY "r"
124 #endif
125 #endif
126
127 #ifndef READ_PLUS_TEXT
128 #ifdef O_TEXT
129 #define READ_PLUS_TEXT "r+t"
130 #else
131 #define READ_PLUS_TEXT "r+"
132 #endif
133 #endif
134
135 #ifndef READ_PLUS_BINARY
136 #ifdef O_BINARY
137 #define READ_PLUS_BINARY "r+b"
138 #else
139 #define READ_PLUS_BINARY "r+"
140 #endif
141 #endif
142
143 #ifndef WRITE_TEXT
144 #ifdef O_TEXT
145 #define WRITE_TEXT "wt"
146 #else
147 #define WRITE_TEXT "w"
118 #endif 148 #endif
119 #endif 149 #endif
120 150
121 #ifndef WRITE_BINARY 151 #ifndef WRITE_BINARY
122 #ifdef O_BINARY 152 #ifdef O_BINARY
221 /* MAXPATHLEN is deprecated, but, as of this writing, still used. */ 251 /* MAXPATHLEN is deprecated, but, as of this writing, still used. */
222 #ifndef MAXPATHLEN 252 #ifndef MAXPATHLEN
223 # define MAXPATHLEN 1024 253 # define MAXPATHLEN 1024
224 #endif 254 #endif
225 255
256 /* The following definitions are needed under Windows, at least */
226 #ifndef X_OK 257 #ifndef X_OK
227 # define X_OK 01 258 # define X_OK 1
259 #endif
260
261 #ifndef R_OK
262 # define R_OK 4
263 #endif
264
265 #ifndef W_OK
266 # define W_OK 2
267 #endif
268
269 #ifndef F_OK
270 # define F_OK 0
228 #endif 271 #endif
229 272
230 #ifndef FD_CLOEXEC 273 #ifndef FD_CLOEXEC
231 # define FD_CLOEXEC 1 274 # define FD_CLOEXEC 1
232 #endif 275 #endif