|
version 1.1, 2012/05/29 09:29:43
|
version 1.1.1.2, 2021/03/17 13:38:46
|
|
Line 1
|
Line 1
|
| /* Like <fcntl.h>, but with non-working flags defined to 0. |
/* Like <fcntl.h>, but with non-working flags defined to 0. |
| |
|
| Copyright (C) 2006-2011 Free Software Foundation, Inc. | Copyright (C) 2006-2019 Free Software Foundation, Inc. |
| |
|
| This program is free software: you can redistribute it and/or modify |
This program is free software: you can redistribute it and/or modify |
| it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
|
Line 13
|
Line 13
|
| GNU General Public License for more details. |
GNU General Public License for more details. |
| |
|
| You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License |
| along with this program. If not, see <http://www.gnu.org/licenses/>. */ | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
| |
|
| /* written by Paul Eggert */ |
/* written by Paul Eggert */ |
| |
|
|
Line 25
|
Line 25
|
| #if defined __need_system_fcntl_h |
#if defined __need_system_fcntl_h |
| /* Special invocation convention. */ |
/* Special invocation convention. */ |
| |
|
| |
/* Needed before <sys/stat.h>. |
| |
May also define off_t to a 64-bit type on native Windows. */ |
| #include <sys/types.h> |
#include <sys/types.h> |
| /* On some systems other than glibc, <sys/stat.h> is a prerequisite of |
/* On some systems other than glibc, <sys/stat.h> is a prerequisite of |
| <fcntl.h>. On glibc systems, we would like to avoid namespace pollution. |
<fcntl.h>. On glibc systems, we would like to avoid namespace pollution. |
|
Line 32
|
Line 34
|
| extern "C" { ... } block, which leads to errors in C++ mode with the |
extern "C" { ... } block, which leads to errors in C++ mode with the |
| overridden <sys/stat.h> from gnulib. These errors are known to be gone |
overridden <sys/stat.h> from gnulib. These errors are known to be gone |
| with g++ version >= 4.3. */ |
with g++ version >= 4.3. */ |
| #if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) | #if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && (defined __ICC || !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))) |
| # include <sys/stat.h> |
# include <sys/stat.h> |
| #endif |
#endif |
| #@INCLUDE_NEXT@ @NEXT_FCNTL_H@ |
#@INCLUDE_NEXT@ @NEXT_FCNTL_H@ |
|
Line 42
|
Line 44
|
| |
|
| #ifndef _@GUARD_PREFIX@_FCNTL_H |
#ifndef _@GUARD_PREFIX@_FCNTL_H |
| |
|
| |
/* Needed before <sys/stat.h>. |
| |
May also define off_t to a 64-bit type on native Windows. */ |
| #include <sys/types.h> |
#include <sys/types.h> |
| /* On some systems other than glibc, <sys/stat.h> is a prerequisite of |
/* On some systems other than glibc, <sys/stat.h> is a prerequisite of |
| <fcntl.h>. On glibc systems, we would like to avoid namespace pollution. |
<fcntl.h>. On glibc systems, we would like to avoid namespace pollution. |
|
Line 49
|
Line 53
|
| extern "C" { ... } block, which leads to errors in C++ mode with the |
extern "C" { ... } block, which leads to errors in C++ mode with the |
| overridden <sys/stat.h> from gnulib. These errors are known to be gone |
overridden <sys/stat.h> from gnulib. These errors are known to be gone |
| with g++ version >= 4.3. */ |
with g++ version >= 4.3. */ |
| #if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) | #if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && (defined __ICC || !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))) |
| # include <sys/stat.h> |
# include <sys/stat.h> |
| #endif |
#endif |
| /* The include_next requires a split double-inclusion guard. */ |
/* The include_next requires a split double-inclusion guard. */ |
|
Line 62
|
Line 66
|
| # include <unistd.h> |
# include <unistd.h> |
| #endif |
#endif |
| |
|
| |
/* Native Windows platforms declare open(), creat() in <io.h>. */ |
| |
#if (@GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \ |
| |
&& (defined _WIN32 && ! defined __CYGWIN__) |
| |
# include <io.h> |
| |
#endif |
| |
|
| |
|
| /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ |
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ |
| |
|
| /* The definition of _GL_ARG_NONNULL is copied here. */ |
/* The definition of _GL_ARG_NONNULL is copied here. */ |
|
Line 176 _GL_WARN_ON_USE (openat, "openat is not portable - "
|
Line 186 _GL_WARN_ON_USE (openat, "openat is not portable - "
|
| |
|
| /* Fix up the O_* macros. */ |
/* Fix up the O_* macros. */ |
| |
|
| |
/* AIX 7.1 with XL C 12.1 defines O_CLOEXEC, O_NOFOLLOW, and O_TTY_INIT |
| |
to values outside 'int' range, so omit these misdefinitions. |
| |
But avoid namespace pollution on non-AIX systems. */ |
| |
#ifdef _AIX |
| |
# include <limits.h> |
| |
# if defined O_CLOEXEC && ! (INT_MIN <= O_CLOEXEC && O_CLOEXEC <= INT_MAX) |
| |
# undef O_CLOEXEC |
| |
# endif |
| |
# if defined O_NOFOLLOW && ! (INT_MIN <= O_NOFOLLOW && O_NOFOLLOW <= INT_MAX) |
| |
# undef O_NOFOLLOW |
| |
# endif |
| |
# if defined O_TTY_INIT && ! (INT_MIN <= O_TTY_INIT && O_TTY_INIT <= INT_MAX) |
| |
# undef O_TTY_INIT |
| |
# endif |
| |
#endif |
| |
|
| #if !defined O_DIRECT && defined O_DIRECTIO |
#if !defined O_DIRECT && defined O_DIRECTIO |
| /* Tru64 spells it `O_DIRECTIO'. */ | /* Tru64 spells it 'O_DIRECTIO'. */ |
| # define O_DIRECT O_DIRECTIO |
# define O_DIRECT O_DIRECTIO |
| #endif |
#endif |
| |
|
| #if !defined O_CLOEXEC && defined O_NOINHERIT |
#if !defined O_CLOEXEC && defined O_NOINHERIT |
| /* Mingw spells it `O_NOINHERIT'. */ | /* Mingw spells it 'O_NOINHERIT'. */ |
| # define O_CLOEXEC O_NOINHERIT |
# define O_CLOEXEC O_NOINHERIT |
| #endif |
#endif |
| |
|
| #ifndef O_CLOEXEC |
#ifndef O_CLOEXEC |
| # define O_CLOEXEC 0 | # define O_CLOEXEC 0x40000000 /* Try to not collide with system O_* flags. */ |
| | # define GNULIB_defined_O_CLOEXEC 1 |
| | #else |
| | # define GNULIB_defined_O_CLOEXEC 0 |
| #endif |
#endif |
| |
|
| #ifndef O_DIRECT |
#ifndef O_DIRECT |
|
Line 206 _GL_WARN_ON_USE (openat, "openat is not portable - "
|
Line 235 _GL_WARN_ON_USE (openat, "openat is not portable - "
|
| # define O_EXEC O_RDONLY /* This is often close enough in older systems. */ |
# define O_EXEC O_RDONLY /* This is often close enough in older systems. */ |
| #endif |
#endif |
| |
|
| |
#ifndef O_IGNORE_CTTY |
| |
# define O_IGNORE_CTTY 0 |
| |
#endif |
| |
|
| #ifndef O_NDELAY |
#ifndef O_NDELAY |
| # define O_NDELAY 0 |
# define O_NDELAY 0 |
| #endif |
#endif |
|
Line 239 _GL_WARN_ON_USE (openat, "openat is not portable - "
|
Line 272 _GL_WARN_ON_USE (openat, "openat is not portable - "
|
| # define O_NOFOLLOW 0 |
# define O_NOFOLLOW 0 |
| #endif |
#endif |
| |
|
| |
#ifndef O_NOLINK |
| |
# define O_NOLINK 0 |
| |
#endif |
| |
|
| #ifndef O_NOLINKS |
#ifndef O_NOLINKS |
| # define O_NOLINKS 0 |
# define O_NOLINKS 0 |
| #endif |
#endif |
| |
|
| |
#ifndef O_NOTRANS |
| |
# define O_NOTRANS 0 |
| |
#endif |
| |
|
| #ifndef O_RSYNC |
#ifndef O_RSYNC |
| # define O_RSYNC 0 |
# define O_RSYNC 0 |
| #endif |
#endif |
|
Line 259 _GL_WARN_ON_USE (openat, "openat is not portable - "
|
Line 300 _GL_WARN_ON_USE (openat, "openat is not portable - "
|
| # define O_TTY_INIT 0 |
# define O_TTY_INIT 0 |
| #endif |
#endif |
| |
|
| #if O_ACCMODE != (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH) | #if ~O_ACCMODE & (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH) |
| # undef O_ACCMODE |
# undef O_ACCMODE |
| # define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH) |
# define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH) |
| #endif |
#endif |