1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 2 /* Like <fcntl.h>, but with non-working flags defined to 0. 3 4 Copyright (C) 2006-2011 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 26 #if defined __need_system_fcntl_h 27 /* Special invocation convention. */ 28 29 #include <sys/types.h> 30 /* On some systems other than glibc, <sys/stat.h> is a prerequisite of 31 <fcntl.h>. On glibc systems, we would like to avoid namespace pollution. 32 But on glibc systems, <fcntl.h> includes <sys/stat.h> inside an 33 extern "C" { ... } block, which leads to errors in C++ mode with the 34 overridden <sys/stat.h> from gnulib. These errors are known to be gone 35 with g++ version >= 4.3. */ 36 #if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) 37 # include <sys/stat.h> 38 #endif 39 #include_next <fcntl.h> 40 41 #else 42 /* Normal invocation convention. */ 43 44 #ifndef _GL_FCNTL_H 45 46 #include <sys/types.h> 47 /* On some systems other than glibc, <sys/stat.h> is a prerequisite of 48 <fcntl.h>. On glibc systems, we would like to avoid namespace pollution. 49 But on glibc systems, <fcntl.h> includes <sys/stat.h> inside an 50 extern "C" { ... } block, which leads to errors in C++ mode with the 51 overridden <sys/stat.h> from gnulib. These errors are known to be gone 52 with g++ version >= 4.3. */ 53 #if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) 54 # include <sys/stat.h> 55 #endif 56 /* The include_next requires a split double-inclusion guard. */ 57 #include_next <fcntl.h> 58 59 #ifndef _GL_FCNTL_H 60 #define _GL_FCNTL_H 61 62 #ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems. */ 63 # include <unistd.h> 64 #endif 65 66 67 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 68 #ifndef _GL_CXXDEFS_H 69 #define _GL_CXXDEFS_H 70 71 /* The three most frequent use cases of these macros are: 72 73 * For providing a substitute for a function that is missing on some 74 platforms, but is declared and works fine on the platforms on which 75 it exists: 76 77 #if @GNULIB_FOO@ 78 # if !@HAVE_FOO@ 79 _GL_FUNCDECL_SYS (foo, ...); 80 # endif 81 _GL_CXXALIAS_SYS (foo, ...); 82 _GL_CXXALIASWARN (foo); 83 #elif defined GNULIB_POSIXCHECK 84 ... 85 #endif 86 87 * For providing a replacement for a function that exists on all platforms, 88 but is broken/insufficient and needs to be replaced on some platforms: 89 90 #if @GNULIB_FOO@ 91 # if @REPLACE_FOO@ 92 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 93 # undef foo 94 # define foo rpl_foo 95 # endif 96 _GL_FUNCDECL_RPL (foo, ...); 97 _GL_CXXALIAS_RPL (foo, ...); 98 # else 99 _GL_CXXALIAS_SYS (foo, ...); 100 # endif 101 _GL_CXXALIASWARN (foo); 102 #elif defined GNULIB_POSIXCHECK 103 ... 104 #endif 105 106 * For providing a replacement for a function that exists on some platforms 107 but is broken/insufficient and needs to be replaced on some of them and 108 is additionally either missing or undeclared on some other platforms: 109 110 #if @GNULIB_FOO@ 111 # if @REPLACE_FOO@ 112 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 113 # undef foo 114 # define foo rpl_foo 115 # endif 116 _GL_FUNCDECL_RPL (foo, ...); 117 _GL_CXXALIAS_RPL (foo, ...); 118 # else 119 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ 120 _GL_FUNCDECL_SYS (foo, ...); 121 # endif 122 _GL_CXXALIAS_SYS (foo, ...); 123 # endif 124 _GL_CXXALIASWARN (foo); 125 #elif defined GNULIB_POSIXCHECK 126 ... 127 #endif 128 */ 129 130 /* _GL_EXTERN_C declaration; 131 performs the declaration with C linkage. */ 132 #if defined __cplusplus 133 # define _GL_EXTERN_C extern "C" 134 #else 135 # define _GL_EXTERN_C extern 136 #endif 137 138 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); 139 declares a replacement function, named rpl_func, with the given prototype, 140 consisting of return type, parameters, and attributes. 141 Example: 142 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) 143 _GL_ARG_NONNULL ((1))); 144 */ 145 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ 146 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) 147 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ 148 _GL_EXTERN_C rettype rpl_func parameters_and_attributes 149 150 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); 151 declares the system function, named func, with the given prototype, 152 consisting of return type, parameters, and attributes. 153 Example: 154 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) 155 _GL_ARG_NONNULL ((1))); 156 */ 157 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ 158 _GL_EXTERN_C rettype func parameters_and_attributes 159 160 /* _GL_CXXALIAS_RPL (func, rettype, parameters); 161 declares a C++ alias called GNULIB_NAMESPACE::func 162 that redirects to rpl_func, if GNULIB_NAMESPACE is defined. 163 Example: 164 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); 165 */ 166 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ 167 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) 168 #if defined __cplusplus && defined GNULIB_NAMESPACE 169 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 170 namespace GNULIB_NAMESPACE \ 171 { \ 172 rettype (*const func) parameters = ::rpl_func; \ 173 } \ 174 _GL_EXTERN_C int _gl_cxxalias_dummy 175 #else 176 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 177 _GL_EXTERN_C int _gl_cxxalias_dummy 178 #endif 179 180 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); 181 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); 182 except that the C function rpl_func may have a slightly different 183 declaration. A cast is used to silence the "invalid conversion" error 184 that would otherwise occur. */ 185 #if defined __cplusplus && defined GNULIB_NAMESPACE 186 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 187 namespace GNULIB_NAMESPACE \ 188 { \ 189 rettype (*const func) parameters = \ 190 reinterpret_cast<rettype(*)parameters>(::rpl_func); \ 191 } \ 192 _GL_EXTERN_C int _gl_cxxalias_dummy 193 #else 194 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 195 _GL_EXTERN_C int _gl_cxxalias_dummy 196 #endif 197 198 /* _GL_CXXALIAS_SYS (func, rettype, parameters); 199 declares a C++ alias called GNULIB_NAMESPACE::func 200 that redirects to the system provided function func, if GNULIB_NAMESPACE 201 is defined. 202 Example: 203 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); 204 */ 205 #if defined __cplusplus && defined GNULIB_NAMESPACE 206 /* If we were to write 207 rettype (*const func) parameters = ::func; 208 like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls 209 better (remove an indirection through a 'static' pointer variable), 210 but then the _GL_CXXALIASWARN macro below would cause a warning not only 211 for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */ 212 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 213 namespace GNULIB_NAMESPACE \ 214 { \ 215 static rettype (*func) parameters = ::func; \ 216 } \ 217 _GL_EXTERN_C int _gl_cxxalias_dummy 218 #else 219 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 220 _GL_EXTERN_C int _gl_cxxalias_dummy 221 #endif 222 223 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); 224 is like _GL_CXXALIAS_SYS (func, rettype, parameters); 225 except that the C function func may have a slightly different declaration. 226 A cast is used to silence the "invalid conversion" error that would 227 otherwise occur. */ 228 #if defined __cplusplus && defined GNULIB_NAMESPACE 229 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 230 namespace GNULIB_NAMESPACE \ 231 { \ 232 static rettype (*func) parameters = \ 233 reinterpret_cast<rettype(*)parameters>(::func); \ 234 } \ 235 _GL_EXTERN_C int _gl_cxxalias_dummy 236 #else 237 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 238 _GL_EXTERN_C int _gl_cxxalias_dummy 239 #endif 240 241 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); 242 is like _GL_CXXALIAS_SYS (func, rettype, parameters); 243 except that the C function is picked among a set of overloaded functions, 244 namely the one with rettype2 and parameters2. Two consecutive casts 245 are used to silence the "cannot find a match" and "invalid conversion" 246 errors that would otherwise occur. */ 247 #if defined __cplusplus && defined GNULIB_NAMESPACE 248 /* The outer cast must be a reinterpret_cast. 249 The inner cast: When the function is defined as a set of overloaded 250 functions, it works as a static_cast<>, choosing the designated variant. 251 When the function is defined as a single variant, it works as a 252 reinterpret_cast<>. The parenthesized cast syntax works both ways. */ 253 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 254 namespace GNULIB_NAMESPACE \ 255 { \ 256 static rettype (*func) parameters = \ 257 reinterpret_cast<rettype(*)parameters>( \ 258 (rettype2(*)parameters2)(::func)); \ 259 } \ 260 _GL_EXTERN_C int _gl_cxxalias_dummy 261 #else 262 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 263 _GL_EXTERN_C int _gl_cxxalias_dummy 264 #endif 265 266 /* _GL_CXXALIASWARN (func); 267 causes a warning to be emitted when ::func is used but not when 268 GNULIB_NAMESPACE::func is used. func must be defined without overloaded 269 variants. */ 270 #if defined __cplusplus && defined GNULIB_NAMESPACE 271 # define _GL_CXXALIASWARN(func) \ 272 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) 273 # define _GL_CXXALIASWARN_1(func,namespace) \ 274 _GL_CXXALIASWARN_2 (func, namespace) 275 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 276 we enable the warning only when not optimizing. */ 277 # if !__OPTIMIZE__ 278 # define _GL_CXXALIASWARN_2(func,namespace) \ 279 _GL_WARN_ON_USE (func, \ 280 "The symbol ::" #func " refers to the system function. " \ 281 "Use " #namespace "::" #func " instead.") 282 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 283 # define _GL_CXXALIASWARN_2(func,namespace) \ 284 extern __typeof__ (func) func 285 # else 286 # define _GL_CXXALIASWARN_2(func,namespace) \ 287 _GL_EXTERN_C int _gl_cxxalias_dummy 288 # endif 289 #else 290 # define _GL_CXXALIASWARN(func) \ 291 _GL_EXTERN_C int _gl_cxxalias_dummy 292 #endif 293 294 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); 295 causes a warning to be emitted when the given overloaded variant of ::func 296 is used but not when GNULIB_NAMESPACE::func is used. */ 297 #if defined __cplusplus && defined GNULIB_NAMESPACE 298 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 299 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ 300 GNULIB_NAMESPACE) 301 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ 302 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) 303 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 304 we enable the warning only when not optimizing. */ 305 # if !__OPTIMIZE__ 306 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 307 _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ 308 "The symbol ::" #func " refers to the system function. " \ 309 "Use " #namespace "::" #func " instead.") 310 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 311 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 312 extern __typeof__ (func) func 313 # else 314 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 315 _GL_EXTERN_C int _gl_cxxalias_dummy 316 # endif 317 #else 318 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 319 _GL_EXTERN_C int _gl_cxxalias_dummy 320 #endif 321 322 #endif /* _GL_CXXDEFS_H */ 323 324 /* The definition of _GL_ARG_NONNULL is copied here. */ 325 /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools 326 that the values passed as arguments n, ..., m must be non-NULL pointers. 327 n = 1 stands for the first argument, n = 2 for the second argument etc. */ 328 #ifndef _GL_ARG_NONNULL 329 # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 330 # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) 331 # else 332 # define _GL_ARG_NONNULL(params) 333 # endif 334 #endif 335 336 /* The definition of _GL_WARN_ON_USE is copied here. */ 337 #ifndef _GL_WARN_ON_USE 338 339 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 340 /* A compiler attribute is available in gcc versions 4.3.0 and later. */ 341 # define _GL_WARN_ON_USE(function, message) \ 342 extern __typeof__ (function) function __attribute__ ((__warning__ (message))) 343 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 344 /* Verify the existence of the function. */ 345 # define _GL_WARN_ON_USE(function, message) \ 346 extern __typeof__ (function) function 347 # else /* Unsupported. */ 348 # define _GL_WARN_ON_USE(function, message) \ 349 _GL_WARN_EXTERN_C int _gl_warn_on_use 350 # endif 351 #endif 352 353 /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") 354 is like _GL_WARN_ON_USE (function, "string"), except that the function is 355 declared with the given prototype, consisting of return type, parameters, 356 and attributes. 357 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does 358 not work in this case. */ 359 #ifndef _GL_WARN_ON_USE_CXX 360 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 361 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 362 extern rettype function parameters_and_attributes \ 363 __attribute__ ((__warning__ (msg))) 364 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 365 /* Verify the existence of the function. */ 366 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 367 extern rettype function parameters_and_attributes 368 # else /* Unsupported. */ 369 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 370 _GL_WARN_EXTERN_C int _gl_warn_on_use 371 # endif 372 #endif 373 374 /* _GL_WARN_EXTERN_C declaration; 375 performs the declaration with C linkage. */ 376 #ifndef _GL_WARN_EXTERN_C 377 # if defined __cplusplus 378 # define _GL_WARN_EXTERN_C extern "C" 379 # else 380 # define _GL_WARN_EXTERN_C extern 381 # endif 382 #endif 383 384 385 /* Declare overridden functions. */ 386 387 #if 1 388 # if 1 389 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 390 # undef fcntl 391 # define fcntl rpl_fcntl 392 # endif 393 _GL_FUNCDECL_RPL (fcntl, int, (int fd, int action, ...)); 394 _GL_CXXALIAS_RPL (fcntl, int, (int fd, int action, ...)); 395 # else 396 # if !1 397 _GL_FUNCDECL_SYS (fcntl, int, (int fd, int action, ...)); 398 # endif 399 _GL_CXXALIAS_SYS (fcntl, int, (int fd, int action, ...)); 400 # endif 401 _GL_CXXALIASWARN (fcntl); 402 #elif defined GNULIB_POSIXCHECK 403 # undef fcntl 404 # if HAVE_RAW_DECL_FCNTL 405 _GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - " 406 "use gnulib module fcntl for portability"); 407 # endif 408 #endif 409 410 #if 1 411 # if 0 412 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 413 # undef open 414 # define open rpl_open 415 # endif 416 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) 417 _GL_ARG_NONNULL ((1))); 418 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); 419 # else 420 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); 421 # endif 422 /* On HP-UX 11, in C++ mode, open() is defined as an inline function with a 423 default argument. _GL_CXXALIASWARN does not work in this case. */ 424 # if !defined __hpux 425 _GL_CXXALIASWARN (open); 426 # endif 427 #elif defined GNULIB_POSIXCHECK 428 # undef open 429 /* Assume open is always declared. */ 430 _GL_WARN_ON_USE (open, "open is not always POSIX compliant - " 431 "use gnulib module open for portability"); 432 #endif 433 434 #if 0 435 # if 0 436 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 437 # undef openat 438 # define openat rpl_openat 439 # endif 440 _GL_FUNCDECL_RPL (openat, int, 441 (int fd, char const *file, int flags, /* mode_t mode */ ...) 442 _GL_ARG_NONNULL ((2))); 443 _GL_CXXALIAS_RPL (openat, int, 444 (int fd, char const *file, int flags, /* mode_t mode */ ...)); 445 # else 446 # if !1 447 _GL_FUNCDECL_SYS (openat, int, 448 (int fd, char const *file, int flags, /* mode_t mode */ ...) 449 _GL_ARG_NONNULL ((2))); 450 # endif 451 _GL_CXXALIAS_SYS (openat, int, 452 (int fd, char const *file, int flags, /* mode_t mode */ ...)); 453 # endif 454 _GL_CXXALIASWARN (openat); 455 #elif defined GNULIB_POSIXCHECK 456 # undef openat 457 # if HAVE_RAW_DECL_OPENAT 458 _GL_WARN_ON_USE (openat, "openat is not portable - " 459 "use gnulib module openat for portability"); 460 # endif 461 #endif 462 463 464 /* Fix up the FD_* macros, only known to be missing on mingw. */ 465 466 #ifndef FD_CLOEXEC 467 # define FD_CLOEXEC 1 468 #endif 469 470 /* Fix up the supported F_* macros. Intentionally leave other F_* 471 macros undefined. Only known to be missing on mingw. */ 472 473 #ifndef F_DUPFD_CLOEXEC 474 # define F_DUPFD_CLOEXEC 0x40000000 475 /* Witness variable: 1 if gnulib defined F_DUPFD_CLOEXEC, 0 otherwise. */ 476 # define GNULIB_defined_F_DUPFD_CLOEXEC 1 477 #else 478 # define GNULIB_defined_F_DUPFD_CLOEXEC 0 479 #endif 480 481 #ifndef F_DUPFD 482 # define F_DUPFD 1 483 #endif 484 485 #ifndef F_GETFD 486 # define F_GETFD 2 487 #endif 488 489 /* Fix up the O_* macros. */ 490 491 #if !defined O_DIRECT && defined O_DIRECTIO 492 /* Tru64 spells it `O_DIRECTIO'. */ 493 # define O_DIRECT O_DIRECTIO 494 #endif 495 496 #if !defined O_CLOEXEC && defined O_NOINHERIT 497 /* Mingw spells it `O_NOINHERIT'. */ 498 # define O_CLOEXEC O_NOINHERIT 499 #endif 500 501 #ifndef O_CLOEXEC 502 # define O_CLOEXEC 0 503 #endif 504 505 #ifndef O_DIRECT 506 # define O_DIRECT 0 507 #endif 508 509 #ifndef O_DIRECTORY 510 # define O_DIRECTORY 0 511 #endif 512 513 #ifndef O_DSYNC 514 # define O_DSYNC 0 515 #endif 516 517 #ifndef O_EXEC 518 # define O_EXEC O_RDONLY /* This is often close enough in older systems. */ 519 #endif 520 521 #ifndef O_NDELAY 522 # define O_NDELAY 0 523 #endif 524 525 #ifndef O_NOATIME 526 # define O_NOATIME 0 527 #endif 528 529 #ifndef O_NONBLOCK 530 # define O_NONBLOCK O_NDELAY 531 #endif 532 533 /* If the gnulib module 'nonblocking' is in use, guarantee a working non-zero 534 value of O_NONBLOCK. Otherwise, O_NONBLOCK is defined (above) to O_NDELAY 535 or to 0 as fallback. */ 536 #if 0 537 # if O_NONBLOCK 538 # define GNULIB_defined_O_NONBLOCK 0 539 # else 540 # define GNULIB_defined_O_NONBLOCK 1 541 # undef O_NONBLOCK 542 # define O_NONBLOCK 0x40000000 543 # endif 544 #endif 545 546 #ifndef O_NOCTTY 547 # define O_NOCTTY 0 548 #endif 549 550 #ifndef O_NOFOLLOW 551 # define O_NOFOLLOW 0 552 #endif 553 554 #ifndef O_NOLINKS 555 # define O_NOLINKS 0 556 #endif 557 558 #ifndef O_RSYNC 559 # define O_RSYNC 0 560 #endif 561 562 #ifndef O_SEARCH 563 # define O_SEARCH O_RDONLY /* This is often close enough in older systems. */ 564 #endif 565 566 #ifndef O_SYNC 567 # define O_SYNC 0 568 #endif 569 570 #ifndef O_TTY_INIT 571 # define O_TTY_INIT 0 572 #endif 573 574 #if O_ACCMODE != (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH) 575 # undef O_ACCMODE 576 # define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH) 577 #endif 578 579 /* For systems that distinguish between text and binary I/O. 580 O_BINARY is usually declared in fcntl.h */ 581 #if !defined O_BINARY && defined _O_BINARY 582 /* For MSC-compatible compilers. */ 583 # define O_BINARY _O_BINARY 584 # define O_TEXT _O_TEXT 585 #endif 586 587 #if defined __BEOS__ || defined __HAIKU__ 588 /* BeOS 5 and Haiku have O_BINARY and O_TEXT, but they have no effect. */ 589 # undef O_BINARY 590 # undef O_TEXT 591 #endif 592 593 #ifndef O_BINARY 594 # define O_BINARY 0 595 # define O_TEXT 0 596 #endif 597 598 /* Fix up the AT_* macros. */ 599 600 /* Work around a bug in Solaris 9 and 10: AT_FDCWD is positive. Its 601 value exceeds INT_MAX, so its use as an int doesn't conform to the 602 C standard, and GCC and Sun C complain in some cases. If the bug 603 is present, undef AT_FDCWD here, so it can be redefined below. */ 604 #if 0 < AT_FDCWD && AT_FDCWD == 0xffd19553 605 # undef AT_FDCWD 606 #endif 607 608 /* Use the same bit pattern as Solaris 9, but with the proper 609 signedness. The bit pattern is important, in case this actually is 610 Solaris with the above workaround. */ 611 #ifndef AT_FDCWD 612 # define AT_FDCWD (-3041965) 613 #endif 614 615 /* Use the same values as Solaris 9. This shouldn't matter, but 616 there's no real reason to differ. */ 617 #ifndef AT_SYMLINK_NOFOLLOW 618 # define AT_SYMLINK_NOFOLLOW 4096 619 #endif 620 621 #ifndef AT_REMOVEDIR 622 # define AT_REMOVEDIR 1 623 #endif 624 625 /* Solaris 9 lacks these two, so just pick unique values. */ 626 #ifndef AT_SYMLINK_FOLLOW 627 # define AT_SYMLINK_FOLLOW 2 628 #endif 629 630 #ifndef AT_EACCESS 631 # define AT_EACCESS 4 632 #endif 633 634 635 #endif /* _GL_FCNTL_H */ 636 #endif /* _GL_FCNTL_H */ 637 #endif 638