Back to index

nagios-plugins  1.4.16
fcntl.in.h
Go to the documentation of this file.
00001 /* Like <fcntl.h>, but with non-working flags defined to 0.
00002 
00003    Copyright (C) 2006-2010 Free Software Foundation, Inc.
00004 
00005    This program is free software: you can redistribute it and/or modify
00006    it under the terms of the GNU General Public License as published by
00007    the Free Software Foundation; either version 3 of the License, or
00008    (at your option) any later version.
00009 
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.
00014 
00015    You should have received a copy of the GNU General Public License
00016    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00017 
00018 /* written by Paul Eggert */
00019 
00020 #if __GNUC__ >= 3
00021 @PRAGMA_SYSTEM_HEADER@
00022 #endif
00023 
00024 #if defined __need_system_fcntl_h
00025 /* Special invocation convention.  */
00026 
00027 #include <sys/types.h>
00028 #ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems.  */
00029 # include <sys/stat.h>
00030 #endif
00031 #@INCLUDE_NEXT@ @NEXT_FCNTL_H@
00032 
00033 #else
00034 /* Normal invocation convention.  */
00035 
00036 #ifndef _GL_FCNTL_H
00037 
00038 #include <sys/types.h>
00039 #ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems.  */
00040 # include <sys/stat.h>
00041 #endif
00042 /* The include_next requires a split double-inclusion guard.  */
00043 #@INCLUDE_NEXT@ @NEXT_FCNTL_H@
00044 
00045 #ifndef _GL_FCNTL_H
00046 #define _GL_FCNTL_H
00047 
00048 #ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems.  */
00049 # include <unistd.h>
00050 #endif
00051 
00052 
00053 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
00054 
00055 /* The definition of _GL_ARG_NONNULL is copied here.  */
00056 
00057 /* The definition of _GL_WARN_ON_USE is copied here.  */
00058 
00059 
00060 /* Declare overridden functions.  */
00061 
00062 #if @GNULIB_FCNTL@
00063 # if @REPLACE_FCNTL@
00064 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00065 #   undef fcntl
00066 #   define fcntl rpl_fcntl
00067 #  endif
00068 _GL_FUNCDECL_RPL (fcntl, int, (int fd, int action, ...));
00069 _GL_CXXALIAS_RPL (fcntl, int, (int fd, int action, ...));
00070 # else
00071 #  if !@HAVE_FCNTL@
00072 _GL_FUNCDECL_SYS (fcntl, int, (int fd, int action, ...));
00073 #  endif
00074 _GL_CXXALIAS_SYS (fcntl, int, (int fd, int action, ...));
00075 # endif
00076 _GL_CXXALIASWARN (fcntl);
00077 #elif defined GNULIB_POSIXCHECK
00078 # undef fcntl
00079 # if HAVE_RAW_DECL_FCNTL
00080 _GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - "
00081                  "use gnulib module fcntl for portability");
00082 # endif
00083 #endif
00084 
00085 #if @GNULIB_OPEN@
00086 # if @REPLACE_OPEN@
00087 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00088 #   undef open
00089 #   define open rpl_open
00090 #  endif
00091 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
00092                              _GL_ARG_NONNULL ((1)));
00093 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
00094 # else
00095 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
00096 # endif
00097 _GL_CXXALIASWARN (open);
00098 #elif defined GNULIB_POSIXCHECK
00099 # undef open
00100 /* Assume open is always declared.  */
00101 _GL_WARN_ON_USE (open, "open is not always POSIX compliant - "
00102                  "use gnulib module open for portability");
00103 #endif
00104 
00105 #if @GNULIB_OPENAT@
00106 # if @REPLACE_OPENAT@
00107 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00108 #   undef openat
00109 #   define openat rpl_openat
00110 #  endif
00111 _GL_FUNCDECL_RPL (openat, int,
00112                   (int fd, char const *file, int flags, /* mode_t mode */ ...)
00113                   _GL_ARG_NONNULL ((2)));
00114 _GL_CXXALIAS_RPL (openat, int,
00115                   (int fd, char const *file, int flags, /* mode_t mode */ ...));
00116 # else
00117 #  if !@HAVE_OPENAT@
00118 _GL_FUNCDECL_SYS (openat, int,
00119                   (int fd, char const *file, int flags, /* mode_t mode */ ...)
00120                   _GL_ARG_NONNULL ((2)));
00121 #  endif
00122 _GL_CXXALIAS_SYS (openat, int,
00123                   (int fd, char const *file, int flags, /* mode_t mode */ ...));
00124 # endif
00125 _GL_CXXALIASWARN (openat);
00126 #elif defined GNULIB_POSIXCHECK
00127 # undef openat
00128 # if HAVE_RAW_DECL_OPENAT
00129 _GL_WARN_ON_USE (openat, "openat is not portable - "
00130                  "use gnulib module openat for portability");
00131 # endif
00132 #endif
00133 
00134 
00135 /* Fix up the FD_* macros, only known to be missing on mingw.  */
00136 
00137 #ifndef FD_CLOEXEC
00138 # define FD_CLOEXEC 1
00139 #endif
00140 
00141 /* Fix up the supported F_* macros.  Intentionally leave other F_*
00142    macros undefined.  Only known to be missing on mingw.  */
00143 
00144 #ifndef F_DUPFD_CLOEXEC
00145 # define F_DUPFD_CLOEXEC 0x40000000
00146 /* Witness variable: 1 if gnulib defined F_DUPFD_CLOEXEC, 0 otherwise.  */
00147 # define GNULIB_defined_F_DUPFD_CLOEXEC 1
00148 #else
00149 # define GNULIB_defined_F_DUPFD_CLOEXEC 0
00150 #endif
00151 
00152 #ifndef F_DUPFD
00153 # define F_DUPFD 1
00154 #endif
00155 
00156 #ifndef F_GETFD
00157 # define F_GETFD 2
00158 #endif
00159 
00160 /* Fix up the O_* macros.  */
00161 
00162 #if !defined O_DIRECT && defined O_DIRECTIO
00163 /* Tru64 spells it `O_DIRECTIO'.  */
00164 # define O_DIRECT O_DIRECTIO
00165 #endif
00166 
00167 #if !defined O_CLOEXEC && defined O_NOINHERIT
00168 /* Mingw spells it `O_NOINHERIT'.  Intentionally leave it
00169    undefined if not available.  */
00170 # define O_CLOEXEC O_NOINHERIT
00171 #endif
00172 
00173 #ifndef O_DIRECT
00174 # define O_DIRECT 0
00175 #endif
00176 
00177 #ifndef O_DIRECTORY
00178 # define O_DIRECTORY 0
00179 #endif
00180 
00181 #ifndef O_DSYNC
00182 # define O_DSYNC 0
00183 #endif
00184 
00185 #ifndef O_NDELAY
00186 # define O_NDELAY 0
00187 #endif
00188 
00189 #ifndef O_NOATIME
00190 # define O_NOATIME 0
00191 #endif
00192 
00193 #ifndef O_NONBLOCK
00194 # define O_NONBLOCK O_NDELAY
00195 #endif
00196 
00197 #ifndef O_NOCTTY
00198 # define O_NOCTTY 0
00199 #endif
00200 
00201 #ifndef O_NOFOLLOW
00202 # define O_NOFOLLOW 0
00203 #endif
00204 
00205 #ifndef O_NOLINKS
00206 # define O_NOLINKS 0
00207 #endif
00208 
00209 #ifndef O_RSYNC
00210 # define O_RSYNC 0
00211 #endif
00212 
00213 #ifndef O_SYNC
00214 # define O_SYNC 0
00215 #endif
00216 
00217 #ifndef O_TTY_INIT
00218 # define O_TTY_INIT 0
00219 #endif
00220 
00221 /* For systems that distinguish between text and binary I/O.
00222    O_BINARY is usually declared in fcntl.h  */
00223 #if !defined O_BINARY && defined _O_BINARY
00224   /* For MSC-compatible compilers.  */
00225 # define O_BINARY _O_BINARY
00226 # define O_TEXT _O_TEXT
00227 #endif
00228 
00229 #if defined __BEOS__ || defined __HAIKU__
00230   /* BeOS 5 and Haiku have O_BINARY and O_TEXT, but they have no effect.  */
00231 # undef O_BINARY
00232 # undef O_TEXT
00233 #endif
00234 
00235 #ifndef O_BINARY
00236 # define O_BINARY 0
00237 # define O_TEXT 0
00238 #endif
00239 
00240 /* Fix up the AT_* macros.  */
00241 
00242 /* Work around a bug in Solaris 9 and 10: AT_FDCWD is positive.  Its
00243    value exceeds INT_MAX, so its use as an int doesn't conform to the
00244    C standard, and GCC and Sun C complain in some cases.  If the bug
00245    is present, undef AT_FDCWD here, so it can be redefined below.  */
00246 #if 0 < AT_FDCWD && AT_FDCWD == 0xffd19553
00247 # undef AT_FDCWD
00248 #endif
00249 
00250 /* Use the same bit pattern as Solaris 9, but with the proper
00251    signedness.  The bit pattern is important, in case this actually is
00252    Solaris with the above workaround.  */
00253 #ifndef AT_FDCWD
00254 # define AT_FDCWD (-3041965)
00255 #endif
00256 
00257 /* Use the same values as Solaris 9.  This shouldn't matter, but
00258    there's no real reason to differ.  */
00259 #ifndef AT_SYMLINK_NOFOLLOW
00260 # define AT_SYMLINK_NOFOLLOW 4096
00261 #endif
00262 
00263 #ifndef AT_REMOVEDIR
00264 # define AT_REMOVEDIR 1
00265 #endif
00266 
00267 /* Solaris 9 lacks these two, so just pick unique values.  */
00268 #ifndef AT_SYMLINK_FOLLOW
00269 # define AT_SYMLINK_FOLLOW 2
00270 #endif
00271 
00272 #ifndef AT_EACCESS
00273 # define AT_EACCESS 4
00274 #endif
00275 
00276 
00277 #endif /* _GL_FCNTL_H */
00278 #endif /* _GL_FCNTL_H */
00279 #endif