fcntl.h 25 KB

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