fcntl.h 22 KB

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