1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2 /* Provide a more complete sys/stat.h header file.
3    Copyright (C) 2005-2018 Free Software Foundation, Inc.
4 
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 3, or (at your option)
8    any later version.
9 
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14 
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, see <https://www.gnu.org/licenses/>.  */
17 
18 /* Written by Eric Blake, Paul Eggert, and Jim Meyering.  */
19 
20 /* This file is supposed to be used on platforms where <sys/stat.h> is
21    incomplete.  It is intended to provide definitions and prototypes
22    needed by an application.  Start with what the system provides.  */
23 
24 #if __GNUC__ >= 3
25 #pragma GCC system_header
26 #endif
27 
28 
29 #if defined __need_system_sys_stat_h
30 /* Special invocation convention.  */
31 
32 #include_next <sys/stat.h>
33 
34 #else
35 /* Normal invocation convention.  */
36 
37 #ifndef _GL_SYS_STAT_H
38 
39 /* Get nlink_t.
40    May also define off_t to a 64-bit type on native Windows.  */
41 #include <sys/types.h>
42 
43 /* Get struct timespec.  */
44 #include <time.h>
45 
46 /* The include_next requires a split double-inclusion guard.  */
47 #include_next <sys/stat.h>
48 
49 #ifndef _GL_SYS_STAT_H
50 #define _GL_SYS_STAT_H
51 
52 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
53 /* C++ compatible function declaration macros.
54    Copyright (C) 2010-2018 Free Software Foundation, Inc.
55 
56    This program is free software: you can redistribute it and/or modify it
57    under the terms of the GNU General Public License as published
58    by the Free Software Foundation; either version 3 of the License, or
59    (at your option) any later version.
60 
61    This program is distributed in the hope that it will be useful,
62    but WITHOUT ANY WARRANTY; without even the implied warranty of
63    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
64    General Public License for more details.
65 
66    You should have received a copy of the GNU General Public License
67    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
68 
69 #ifndef _GL_CXXDEFS_H
70 #define _GL_CXXDEFS_H
71 
72 /* Begin/end the GNULIB_NAMESPACE namespace.  */
73 #if defined __cplusplus && defined GNULIB_NAMESPACE
74 # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
75 # define _GL_END_NAMESPACE }
76 #else
77 # define _GL_BEGIN_NAMESPACE
78 # define _GL_END_NAMESPACE
79 #endif
80 
81 /* The three most frequent use cases of these macros are:
82 
83    * For providing a substitute for a function that is missing on some
84      platforms, but is declared and works fine on the platforms on which
85      it exists:
86 
87        #if @GNULIB_FOO@
88        # if !@HAVE_FOO@
89        _GL_FUNCDECL_SYS (foo, ...);
90        # endif
91        _GL_CXXALIAS_SYS (foo, ...);
92        _GL_CXXALIASWARN (foo);
93        #elif defined GNULIB_POSIXCHECK
94        ...
95        #endif
96 
97    * For providing a replacement for a function that exists on all platforms,
98      but is broken/insufficient and needs to be replaced on some platforms:
99 
100        #if @GNULIB_FOO@
101        # if @REPLACE_FOO@
102        #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
103        #   undef foo
104        #   define foo rpl_foo
105        #  endif
106        _GL_FUNCDECL_RPL (foo, ...);
107        _GL_CXXALIAS_RPL (foo, ...);
108        # else
109        _GL_CXXALIAS_SYS (foo, ...);
110        # endif
111        _GL_CXXALIASWARN (foo);
112        #elif defined GNULIB_POSIXCHECK
113        ...
114        #endif
115 
116    * For providing a replacement for a function that exists on some platforms
117      but is broken/insufficient and needs to be replaced on some of them and
118      is additionally either missing or undeclared on some other platforms:
119 
120        #if @GNULIB_FOO@
121        # if @REPLACE_FOO@
122        #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
123        #   undef foo
124        #   define foo rpl_foo
125        #  endif
126        _GL_FUNCDECL_RPL (foo, ...);
127        _GL_CXXALIAS_RPL (foo, ...);
128        # else
129        #  if !@HAVE_FOO@   or   if !@HAVE_DECL_FOO@
130        _GL_FUNCDECL_SYS (foo, ...);
131        #  endif
132        _GL_CXXALIAS_SYS (foo, ...);
133        # endif
134        _GL_CXXALIASWARN (foo);
135        #elif defined GNULIB_POSIXCHECK
136        ...
137        #endif
138 */
139 
140 /* _GL_EXTERN_C declaration;
141    performs the declaration with C linkage.  */
142 #if defined __cplusplus
143 # define _GL_EXTERN_C extern "C"
144 #else
145 # define _GL_EXTERN_C extern
146 #endif
147 
148 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
149    declares a replacement function, named rpl_func, with the given prototype,
150    consisting of return type, parameters, and attributes.
151    Example:
152      _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
153                                   _GL_ARG_NONNULL ((1)));
154  */
155 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
156   _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
157 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
158   _GL_EXTERN_C rettype rpl_func parameters_and_attributes
159 
160 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
161    declares the system function, named func, with the given prototype,
162    consisting of return type, parameters, and attributes.
163    Example:
164      _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
165                                   _GL_ARG_NONNULL ((1)));
166  */
167 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
168   _GL_EXTERN_C rettype func parameters_and_attributes
169 
170 /* _GL_CXXALIAS_RPL (func, rettype, parameters);
171    declares a C++ alias called GNULIB_NAMESPACE::func
172    that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
173    Example:
174      _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
175 
176    Wrapping rpl_func in an object with an inline conversion operator
177    avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
178    actually used in the program.  */
179 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
180   _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
181 #if defined __cplusplus && defined GNULIB_NAMESPACE
182 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
183     namespace GNULIB_NAMESPACE                                \
184     {                                                         \
185       static const struct _gl_ ## func ## _wrapper            \
186       {                                                       \
187         typedef rettype (*type) parameters;                   \
188                                                               \
189         inline operator type () const                         \
190         {                                                     \
191           return ::rpl_func;                                  \
192         }                                                     \
193       } func = {};                                            \
194     }                                                         \
195     _GL_EXTERN_C int _gl_cxxalias_dummy
196 #else
197 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
198     _GL_EXTERN_C int _gl_cxxalias_dummy
199 #endif
200 
201 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
202    is like  _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
203    except that the C function rpl_func may have a slightly different
204    declaration.  A cast is used to silence the "invalid conversion" error
205    that would otherwise occur.  */
206 #if defined __cplusplus && defined GNULIB_NAMESPACE
207 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
208     namespace GNULIB_NAMESPACE                                     \
209     {                                                              \
210       static const struct _gl_ ## func ## _wrapper                 \
211       {                                                            \
212         typedef rettype (*type) parameters;                        \
213                                                                    \
214         inline operator type () const                              \
215         {                                                          \
216           return reinterpret_cast<type>(::rpl_func);               \
217         }                                                          \
218       } func = {};                                                 \
219     }                                                              \
220     _GL_EXTERN_C int _gl_cxxalias_dummy
221 #else
222 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
223     _GL_EXTERN_C int _gl_cxxalias_dummy
224 #endif
225 
226 /* _GL_CXXALIAS_SYS (func, rettype, parameters);
227    declares a C++ alias called GNULIB_NAMESPACE::func
228    that redirects to the system provided function func, if GNULIB_NAMESPACE
229    is defined.
230    Example:
231      _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
232 
233    Wrapping func in an object with an inline conversion operator
234    avoids a reference to func unless GNULIB_NAMESPACE::func is
235    actually used in the program.  */
236 #if defined __cplusplus && defined GNULIB_NAMESPACE
237 # define _GL_CXXALIAS_SYS(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 ::func;                                      \
247         }                                                     \
248       } func = {};                                            \
249     }                                                         \
250     _GL_EXTERN_C int _gl_cxxalias_dummy
251 #else
252 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
253     _GL_EXTERN_C int _gl_cxxalias_dummy
254 #endif
255 
256 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
257    is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
258    except that the C function func may have a slightly different declaration.
259    A cast is used to silence the "invalid conversion" error that would
260    otherwise occur.  */
261 #if defined __cplusplus && defined GNULIB_NAMESPACE
262 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
263     namespace GNULIB_NAMESPACE                          \
264     {                                                   \
265       static const struct _gl_ ## func ## _wrapper      \
266       {                                                 \
267         typedef rettype (*type) parameters;             \
268                                                         \
269         inline operator type () const                   \
270         {                                               \
271           return reinterpret_cast<type>(::func);        \
272         }                                               \
273       } func = {};                                      \
274     }                                                   \
275     _GL_EXTERN_C int _gl_cxxalias_dummy
276 #else
277 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
278     _GL_EXTERN_C int _gl_cxxalias_dummy
279 #endif
280 
281 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
282    is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
283    except that the C function is picked among a set of overloaded functions,
284    namely the one with rettype2 and parameters2.  Two consecutive casts
285    are used to silence the "cannot find a match" and "invalid conversion"
286    errors that would otherwise occur.  */
287 #if defined __cplusplus && defined GNULIB_NAMESPACE
288   /* The outer cast must be a reinterpret_cast.
289      The inner cast: When the function is defined as a set of overloaded
290      functions, it works as a static_cast<>, choosing the designated variant.
291      When the function is defined as a single variant, it works as a
292      reinterpret_cast<>. The parenthesized cast syntax works both ways.  */
293 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
294     namespace GNULIB_NAMESPACE                                                \
295     {                                                                         \
296       static const struct _gl_ ## func ## _wrapper                            \
297       {                                                                       \
298         typedef rettype (*type) parameters;                                   \
299                                                                               \
300         inline operator type () const                                         \
301         {                                                                     \
302           return reinterpret_cast<type>((rettype2 (*) parameters2)(::func));  \
303         }                                                                     \
304       } func = {};                                                            \
305     }                                                                         \
306     _GL_EXTERN_C int _gl_cxxalias_dummy
307 #else
308 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
309     _GL_EXTERN_C int _gl_cxxalias_dummy
310 #endif
311 
312 /* _GL_CXXALIASWARN (func);
313    causes a warning to be emitted when ::func is used but not when
314    GNULIB_NAMESPACE::func is used.  func must be defined without overloaded
315    variants.  */
316 #if defined __cplusplus && defined GNULIB_NAMESPACE
317 # define _GL_CXXALIASWARN(func) \
318    _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
319 # define _GL_CXXALIASWARN_1(func,namespace) \
320    _GL_CXXALIASWARN_2 (func, namespace)
321 /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
322    we enable the warning only when not optimizing.  */
323 # if !__OPTIMIZE__
324 #  define _GL_CXXALIASWARN_2(func,namespace) \
325     _GL_WARN_ON_USE (func, \
326                      "The symbol ::" #func " refers to the system function. " \
327                      "Use " #namespace "::" #func " instead.")
328 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
329 #  define _GL_CXXALIASWARN_2(func,namespace) \
330      extern __typeof__ (func) func
331 # else
332 #  define _GL_CXXALIASWARN_2(func,namespace) \
333      _GL_EXTERN_C int _gl_cxxalias_dummy
334 # endif
335 #else
336 # define _GL_CXXALIASWARN(func) \
337     _GL_EXTERN_C int _gl_cxxalias_dummy
338 #endif
339 
340 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
341    causes a warning to be emitted when the given overloaded variant of ::func
342    is used but not when GNULIB_NAMESPACE::func is used.  */
343 #if defined __cplusplus && defined GNULIB_NAMESPACE
344 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
345    _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
346                         GNULIB_NAMESPACE)
347 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
348    _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
349 /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
350    we enable the warning only when not optimizing.  */
351 # if !__OPTIMIZE__
352 #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
353     _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
354                          "The symbol ::" #func " refers to the system function. " \
355                          "Use " #namespace "::" #func " instead.")
356 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
357 #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
358      extern __typeof__ (func) func
359 # else
360 #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
361      _GL_EXTERN_C int _gl_cxxalias_dummy
362 # endif
363 #else
364 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
365     _GL_EXTERN_C int _gl_cxxalias_dummy
366 #endif
367 
368 #endif /* _GL_CXXDEFS_H */
369 
370 /* The definition of _GL_ARG_NONNULL is copied here.  */
371 /* A C macro for declaring that specific arguments must not be NULL.
372    Copyright (C) 2009-2018 Free Software Foundation, Inc.
373 
374    This program is free software: you can redistribute it and/or modify it
375    under the terms of the GNU General Public License as published
376    by the Free Software Foundation; either version 3 of the License, or
377    (at your option) any later version.
378 
379    This program is distributed in the hope that it will be useful,
380    but WITHOUT ANY WARRANTY; without even the implied warranty of
381    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
382    General Public License for more details.
383 
384    You should have received a copy of the GNU General Public License
385    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
386 
387 /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
388    that the values passed as arguments n, ..., m must be non-NULL pointers.
389    n = 1 stands for the first argument, n = 2 for the second argument etc.  */
390 #ifndef _GL_ARG_NONNULL
391 # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
392 #  define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
393 # else
394 #  define _GL_ARG_NONNULL(params)
395 # endif
396 #endif
397 
398 /* The definition of _GL_WARN_ON_USE is copied here.  */
399 /* A C macro for emitting warnings if a function is used.
400    Copyright (C) 2010-2018 Free Software Foundation, Inc.
401 
402    This program is free software: you can redistribute it and/or modify it
403    under the terms of the GNU General Public License as published
404    by the Free Software Foundation; either version 3 of the License, or
405    (at your option) any later version.
406 
407    This program is distributed in the hope that it will be useful,
408    but WITHOUT ANY WARRANTY; without even the implied warranty of
409    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
410    General Public License for more details.
411 
412    You should have received a copy of the GNU General Public License
413    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
414 
415 /* _GL_WARN_ON_USE (function, "literal string") issues a declaration
416    for FUNCTION which will then trigger a compiler warning containing
417    the text of "literal string" anywhere that function is called, if
418    supported by the compiler.  If the compiler does not support this
419    feature, the macro expands to an unused extern declaration.
420 
421    _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the
422    attribute used in _GL_WARN_ON_USE.  If the compiler does not support
423    this feature, it expands to empty.
424 
425    These macros are useful for marking a function as a potential
426    portability trap, with the intent that "literal string" include
427    instructions on the replacement function that should be used
428    instead.
429    _GL_WARN_ON_USE is for functions with 'extern' linkage.
430    _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline'
431    linkage.
432 
433    However, one of the reasons that a function is a portability trap is
434    if it has the wrong signature.  Declaring FUNCTION with a different
435    signature in C is a compilation error, so this macro must use the
436    same type as any existing declaration so that programs that avoid
437    the problematic FUNCTION do not fail to compile merely because they
438    included a header that poisoned the function.  But this implies that
439    _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already
440    have a declaration.  Use of this macro implies that there must not
441    be any other macro hiding the declaration of FUNCTION; but
442    undefining FUNCTION first is part of the poisoning process anyway
443    (although for symbols that are provided only via a macro, the result
444    is a compilation error rather than a warning containing
445    "literal string").  Also note that in C++, it is only safe to use if
446    FUNCTION has no overloads.
447 
448    For an example, it is possible to poison 'getline' by:
449    - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
450      [getline]) in configure.ac, which potentially defines
451      HAVE_RAW_DECL_GETLINE
452    - adding this code to a header that wraps the system <stdio.h>:
453      #undef getline
454      #if HAVE_RAW_DECL_GETLINE
455      _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
456        "not universally present; use the gnulib module getline");
457      #endif
458 
459    It is not possible to directly poison global variables.  But it is
460    possible to write a wrapper accessor function, and poison that
461    (less common usage, like &environ, will cause a compilation error
462    rather than issue the nice warning, but the end result of informing
463    the developer about their portability problem is still achieved):
464      #if HAVE_RAW_DECL_ENVIRON
465      static char ***
466      rpl_environ (void) { return &environ; }
467      _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
468      # undef environ
469      # define environ (*rpl_environ ())
470      #endif
471    or better (avoiding contradictory use of 'static' and 'extern'):
472      #if HAVE_RAW_DECL_ENVIRON
473      static char ***
474      _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared")
475      rpl_environ (void) { return &environ; }
476      # undef environ
477      # define environ (*rpl_environ ())
478      #endif
479    */
480 #ifndef _GL_WARN_ON_USE
481 
482 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
483 /* A compiler attribute is available in gcc versions 4.3.0 and later.  */
484 #  define _GL_WARN_ON_USE(function, message) \
485 extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
486 #  define _GL_WARN_ON_USE_ATTRIBUTE(message) \
487   __attribute__ ((__warning__ (message)))
488 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
489 /* Verify the existence of the function.  */
490 #  define _GL_WARN_ON_USE(function, message) \
491 extern __typeof__ (function) function
492 #  define _GL_WARN_ON_USE_ATTRIBUTE(message)
493 # else /* Unsupported.  */
494 #  define _GL_WARN_ON_USE(function, message) \
495 _GL_WARN_EXTERN_C int _gl_warn_on_use
496 #  define _GL_WARN_ON_USE_ATTRIBUTE(message)
497 # endif
498 #endif
499 
500 /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
501    is like _GL_WARN_ON_USE (function, "string"), except that the function is
502    declared with the given prototype, consisting of return type, parameters,
503    and attributes.
504    This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
505    not work in this case.  */
506 #ifndef _GL_WARN_ON_USE_CXX
507 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
508 #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
509 extern rettype function parameters_and_attributes \
510      __attribute__ ((__warning__ (msg)))
511 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
512 /* Verify the existence of the function.  */
513 #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
514 extern rettype function parameters_and_attributes
515 # else /* Unsupported.  */
516 #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
517 _GL_WARN_EXTERN_C int _gl_warn_on_use
518 # endif
519 #endif
520 
521 /* _GL_WARN_EXTERN_C declaration;
522    performs the declaration with C linkage.  */
523 #ifndef _GL_WARN_EXTERN_C
524 # if defined __cplusplus
525 #  define _GL_WARN_EXTERN_C extern "C"
526 # else
527 #  define _GL_WARN_EXTERN_C extern
528 # endif
529 #endif
530 
531 /* Before doing "#define mkdir rpl_mkdir" below, we need to include all
532    headers that may declare mkdir().  Native Windows platforms declare mkdir
533    in <io.h> and/or <direct.h>, not in <unistd.h>.  */
534 #if defined _WIN32 && ! defined __CYGWIN__
535 # include <io.h>     /* mingw32, mingw64 */
536 # include <direct.h> /* mingw64, MSVC 9 */
537 #endif
538 
539 /* Native Windows platforms declare umask() in <io.h>.  */
540 #if 0 && (defined _WIN32 && ! defined __CYGWIN__)
541 # include <io.h>
542 #endif
543 
544 /* Large File Support on native Windows.  */
545 #if 0
546 # define stat _stati64
547 #endif
548 
549 /* Optionally, override 'struct stat' on native Windows.  */
550 #if 0
551 
552 # undef stat
553 # if 1
554 #  define stat rpl_stat
555 # else
556    /* Provoke a clear link error if stat() is used as a function and
557       module 'stat' is not in use.  */
558 #  define stat stat_used_without_requesting_gnulib_module_stat
559 # endif
560 
561 # if !GNULIB_defined_struct_stat
562 struct stat
563 {
564   dev_t st_dev;
565   ino_t st_ino;
566   mode_t st_mode;
567   nlink_t st_nlink;
568 #  if 0
569   uid_t st_uid;
570 #  else /* uid_t is not defined by default on native Windows.  */
571   short st_uid;
572 #  endif
573 #  if 0
574   gid_t st_gid;
575 #  else /* gid_t is not defined by default on native Windows.  */
576   short st_gid;
577 #  endif
578   dev_t st_rdev;
579   off_t st_size;
580 #  if 0
581   blksize_t st_blksize;
582   blkcnt_t st_blocks;
583 #  endif
584 
585 #  if 0
586   struct timespec st_atim;
587   struct timespec st_mtim;
588   struct timespec st_ctim;
589 #  else
590   time_t st_atime;
591   time_t st_mtime;
592   time_t st_ctime;
593 #  endif
594 };
595 #  if 0
596 #   define st_atime st_atim.tv_sec
597 #   define st_mtime st_mtim.tv_sec
598 #   define st_ctime st_ctim.tv_sec
599     /* Indicator, for gnulib internal purposes.  */
600 #   define _GL_WINDOWS_STAT_TIMESPEC 1
601 #  endif
602 #  define GNULIB_defined_struct_stat 1
603 # endif
604 
605 /* Other possible values of st_mode.  */
606 # if 0
607 #  define _S_IFBLK  0x6000
608 # endif
609 # if 0
610 #  define _S_IFLNK  0xA000
611 # endif
612 # if 0
613 #  define _S_IFSOCK 0xC000
614 # endif
615 
616 #endif
617 
618 #ifndef S_IFIFO
619 # ifdef _S_IFIFO
620 #  define S_IFIFO _S_IFIFO
621 # endif
622 #endif
623 
624 #ifndef S_IFMT
625 # define S_IFMT 0170000
626 #endif
627 
628 #if STAT_MACROS_BROKEN
629 # undef S_ISBLK
630 # undef S_ISCHR
631 # undef S_ISDIR
632 # undef S_ISFIFO
633 # undef S_ISLNK
634 # undef S_ISNAM
635 # undef S_ISMPB
636 # undef S_ISMPC
637 # undef S_ISNWK
638 # undef S_ISREG
639 # undef S_ISSOCK
640 #endif
641 
642 #ifndef S_ISBLK
643 # ifdef S_IFBLK
644 #  define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
645 # else
646 #  define S_ISBLK(m) 0
647 # endif
648 #endif
649 
650 #ifndef S_ISCHR
651 # ifdef S_IFCHR
652 #  define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
653 # else
654 #  define S_ISCHR(m) 0
655 # endif
656 #endif
657 
658 #ifndef S_ISDIR
659 # ifdef S_IFDIR
660 #  define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
661 # else
662 #  define S_ISDIR(m) 0
663 # endif
664 #endif
665 
666 #ifndef S_ISDOOR /* Solaris 2.5 and up */
667 # define S_ISDOOR(m) 0
668 #endif
669 
670 #ifndef S_ISFIFO
671 # ifdef S_IFIFO
672 #  define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
673 # else
674 #  define S_ISFIFO(m) 0
675 # endif
676 #endif
677 
678 #ifndef S_ISLNK
679 # ifdef S_IFLNK
680 #  define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
681 # else
682 #  define S_ISLNK(m) 0
683 # endif
684 #endif
685 
686 #ifndef S_ISMPB /* V7 */
687 # ifdef S_IFMPB
688 #  define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
689 #  define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
690 # else
691 #  define S_ISMPB(m) 0
692 #  define S_ISMPC(m) 0
693 # endif
694 #endif
695 
696 #ifndef S_ISMPX /* AIX */
697 # define S_ISMPX(m) 0
698 #endif
699 
700 #ifndef S_ISNAM /* Xenix */
701 # ifdef S_IFNAM
702 #  define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
703 # else
704 #  define S_ISNAM(m) 0
705 # endif
706 #endif
707 
708 #ifndef S_ISNWK /* HP/UX */
709 # ifdef S_IFNWK
710 #  define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
711 # else
712 #  define S_ISNWK(m) 0
713 # endif
714 #endif
715 
716 #ifndef S_ISPORT /* Solaris 10 and up */
717 # define S_ISPORT(m) 0
718 #endif
719 
720 #ifndef S_ISREG
721 # ifdef S_IFREG
722 #  define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
723 # else
724 #  define S_ISREG(m) 0
725 # endif
726 #endif
727 
728 #ifndef S_ISSOCK
729 # ifdef S_IFSOCK
730 #  define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
731 # else
732 #  define S_ISSOCK(m) 0
733 # endif
734 #endif
735 
736 
737 #ifndef S_TYPEISMQ
738 # define S_TYPEISMQ(p) 0
739 #endif
740 
741 #ifndef S_TYPEISTMO
742 # define S_TYPEISTMO(p) 0
743 #endif
744 
745 
746 #ifndef S_TYPEISSEM
747 # ifdef S_INSEM
748 #  define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
749 # else
750 #  define S_TYPEISSEM(p) 0
751 # endif
752 #endif
753 
754 #ifndef S_TYPEISSHM
755 # ifdef S_INSHD
756 #  define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
757 # else
758 #  define S_TYPEISSHM(p) 0
759 # endif
760 #endif
761 
762 /* high performance ("contiguous data") */
763 #ifndef S_ISCTG
764 # define S_ISCTG(p) 0
765 #endif
766 
767 /* Cray DMF (data migration facility): off line, with data  */
768 #ifndef S_ISOFD
769 # define S_ISOFD(p) 0
770 #endif
771 
772 /* Cray DMF (data migration facility): off line, with no data  */
773 #ifndef S_ISOFL
774 # define S_ISOFL(p) 0
775 #endif
776 
777 /* 4.4BSD whiteout */
778 #ifndef S_ISWHT
779 # define S_ISWHT(m) 0
780 #endif
781 
782 /* If any of the following are undefined,
783    define them to their de facto standard values.  */
784 #if !S_ISUID
785 # define S_ISUID 04000
786 #endif
787 #if !S_ISGID
788 # define S_ISGID 02000
789 #endif
790 
791 /* S_ISVTX is a common extension to POSIX.  */
792 #ifndef S_ISVTX
793 # define S_ISVTX 01000
794 #endif
795 
796 #if !S_IRUSR && S_IREAD
797 # define S_IRUSR S_IREAD
798 #endif
799 #if !S_IRUSR
800 # define S_IRUSR 00400
801 #endif
802 #if !S_IRGRP
803 # define S_IRGRP (S_IRUSR >> 3)
804 #endif
805 #if !S_IROTH
806 # define S_IROTH (S_IRUSR >> 6)
807 #endif
808 
809 #if !S_IWUSR && S_IWRITE
810 # define S_IWUSR S_IWRITE
811 #endif
812 #if !S_IWUSR
813 # define S_IWUSR 00200
814 #endif
815 #if !S_IWGRP
816 # define S_IWGRP (S_IWUSR >> 3)
817 #endif
818 #if !S_IWOTH
819 # define S_IWOTH (S_IWUSR >> 6)
820 #endif
821 
822 #if !S_IXUSR && S_IEXEC
823 # define S_IXUSR S_IEXEC
824 #endif
825 #if !S_IXUSR
826 # define S_IXUSR 00100
827 #endif
828 #if !S_IXGRP
829 # define S_IXGRP (S_IXUSR >> 3)
830 #endif
831 #if !S_IXOTH
832 # define S_IXOTH (S_IXUSR >> 6)
833 #endif
834 
835 #if !S_IRWXU
836 # define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
837 #endif
838 #if !S_IRWXG
839 # define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
840 #endif
841 #if !S_IRWXO
842 # define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
843 #endif
844 
845 /* S_IXUGO is a common extension to POSIX.  */
846 #if !S_IXUGO
847 # define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
848 #endif
849 
850 #ifndef S_IRWXUGO
851 # define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
852 #endif
853 
854 /* Macros for futimens and utimensat.  */
855 #ifndef UTIME_NOW
856 # define UTIME_NOW (-1)
857 # define UTIME_OMIT (-2)
858 #endif
859 
860 
861 #if 0
862 # if !1
863 _GL_FUNCDECL_SYS (fchmodat, int,
864                   (int fd, char const *file, mode_t mode, int flag)
865                   _GL_ARG_NONNULL ((2)));
866 # endif
867 _GL_CXXALIAS_SYS (fchmodat, int,
868                   (int fd, char const *file, mode_t mode, int flag));
869 _GL_CXXALIASWARN (fchmodat);
870 #elif defined GNULIB_POSIXCHECK
871 # undef fchmodat
872 # if HAVE_RAW_DECL_FCHMODAT
873 _GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
874                  "use gnulib module openat for portability");
875 # endif
876 #endif
877 
878 
879 #if 1
880 # if 0
881 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
882 #   undef fstat
883 #   define fstat rpl_fstat
884 #  endif
885 _GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2)));
886 _GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
887 # else
888 _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
889 # endif
890 _GL_CXXALIASWARN (fstat);
891 #elif 0
892 # undef fstat
893 # define fstat fstat_used_without_requesting_gnulib_module_fstat
894 #elif 0
895 /* Above, we define stat to _stati64.  */
896 # define fstat _fstati64
897 #elif defined GNULIB_POSIXCHECK
898 # undef fstat
899 # if HAVE_RAW_DECL_FSTAT
900 _GL_WARN_ON_USE (fstat, "fstat has portability problems - "
901                  "use gnulib module fstat for portability");
902 # endif
903 #endif
904 
905 
906 #if 0
907 # if 0
908 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
909 #   undef fstatat
910 #   define fstatat rpl_fstatat
911 #  endif
912 _GL_FUNCDECL_RPL (fstatat, int,
913                   (int fd, char const *name, struct stat *st, int flags)
914                   _GL_ARG_NONNULL ((2, 3)));
915 _GL_CXXALIAS_RPL (fstatat, int,
916                   (int fd, char const *name, struct stat *st, int flags));
917 # else
918 #  if !1
919 _GL_FUNCDECL_SYS (fstatat, int,
920                   (int fd, char const *name, struct stat *st, int flags)
921                   _GL_ARG_NONNULL ((2, 3)));
922 #  endif
923 _GL_CXXALIAS_SYS (fstatat, int,
924                   (int fd, char const *name, struct stat *st, int flags));
925 # endif
926 _GL_CXXALIASWARN (fstatat);
927 #elif 0
928 # undef fstatat
929 # define fstatat fstatat_used_without_requesting_gnulib_module_fstatat
930 #elif defined GNULIB_POSIXCHECK
931 # undef fstatat
932 # if HAVE_RAW_DECL_FSTATAT
933 _GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
934                  "use gnulib module openat for portability");
935 # endif
936 #endif
937 
938 
939 #if 0
940 /* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our futimens
941    implementation relies on futimesat, which on Solaris 10 makes an invocation
942    to futimens that is meant to invoke the libc's futimens(), not gnulib's
943    futimens().  */
944 # if 0 || (!1 && defined __sun)
945 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
946 #   undef futimens
947 #   define futimens rpl_futimens
948 #  endif
949 _GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2]));
950 _GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2]));
951 # else
952 #  if !1
953 _GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2]));
954 #  endif
955 _GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2]));
956 # endif
957 # if 1
958 _GL_CXXALIASWARN (futimens);
959 # endif
960 #elif defined GNULIB_POSIXCHECK
961 # undef futimens
962 # if HAVE_RAW_DECL_FUTIMENS
963 _GL_WARN_ON_USE (futimens, "futimens is not portable - "
964                  "use gnulib module futimens for portability");
965 # endif
966 #endif
967 
968 
969 #if 0
970 /* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
971    denotes a symbolic link.  */
972 # if !1
973 /* The lchmod replacement follows symbolic links.  Callers should take
974    this into account; lchmod should be applied only to arguments that
975    are known to not be symbolic links.  On hosts that lack lchmod,
976    this can lead to race conditions between the check and the
977    invocation of lchmod, but we know of no workarounds that are
978    reliable in general.  You might try requesting support for lchmod
979    from your operating system supplier.  */
980 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
981 #   define lchmod chmod
982 #  endif
983 /* Need to cast, because on mingw, the second parameter of chmod is
984                                                 int mode.  */
985 _GL_CXXALIAS_RPL_CAST_1 (lchmod, chmod, int,
986                          (const char *filename, mode_t mode));
987 # else
988 #  if 0 /* assume already declared */
989 _GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode)
990                                _GL_ARG_NONNULL ((1)));
991 #  endif
992 _GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode));
993 # endif
994 # if 1
995 _GL_CXXALIASWARN (lchmod);
996 # endif
997 #elif defined GNULIB_POSIXCHECK
998 # undef lchmod
999 # if HAVE_RAW_DECL_LCHMOD
1000 _GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
1001                  "use gnulib module lchmod for portability");
1002 # endif
1003 #endif
1004 
1005 
1006 #if 1
1007 # if ! 1
1008 /* mingw does not support symlinks, therefore it does not have lstat.  But
1009    without links, stat does just fine.  */
1010 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1011 #   define lstat stat
1012 #  endif
1013 _GL_CXXALIAS_RPL_1 (lstat, stat, int, (const char *name, struct stat *buf));
1014 # elif 0
1015 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1016 #   undef lstat
1017 #   define lstat rpl_lstat
1018 #  endif
1019 _GL_FUNCDECL_RPL (lstat, int, (const char *name, struct stat *buf)
1020                               _GL_ARG_NONNULL ((1, 2)));
1021 _GL_CXXALIAS_RPL (lstat, int, (const char *name, struct stat *buf));
1022 # else
1023 _GL_CXXALIAS_SYS (lstat, int, (const char *name, struct stat *buf));
1024 # endif
1025 # if 1
1026 _GL_CXXALIASWARN (lstat);
1027 # endif
1028 #elif 0
1029 # undef lstat
1030 # define lstat lstat_used_without_requesting_gnulib_module_lstat
1031 #elif defined GNULIB_POSIXCHECK
1032 # undef lstat
1033 # if HAVE_RAW_DECL_LSTAT
1034 _GL_WARN_ON_USE (lstat, "lstat is unportable - "
1035                  "use gnulib module lstat for portability");
1036 # endif
1037 #endif
1038 
1039 
1040 #if 0
1041 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1042 #  undef mkdir
1043 #  define mkdir rpl_mkdir
1044 # endif
1045 _GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode)
1046                               _GL_ARG_NONNULL ((1)));
1047 _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
1048 #else
1049 /* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
1050    Additionally, it declares _mkdir (and depending on compile flags, an
1051    alias mkdir), only in the nonstandard includes <direct.h> and <io.h>,
1052    which are included above.  */
1053 # if defined _WIN32 && ! defined __CYGWIN__
1054 
1055 #  if !GNULIB_defined_rpl_mkdir
1056 static int
1057 rpl_mkdir (char const *name, mode_t mode)
1058 {
1059   return _mkdir (name);
1060 }
1061 #   define GNULIB_defined_rpl_mkdir 1
1062 #  endif
1063 
1064 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1065 #   define mkdir rpl_mkdir
1066 #  endif
1067 _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
1068 # else
1069 _GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
1070 # endif
1071 #endif
1072 _GL_CXXALIASWARN (mkdir);
1073 
1074 
1075 #if 0
1076 # if !1
1077 _GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)
1078                                 _GL_ARG_NONNULL ((2)));
1079 # endif
1080 _GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode));
1081 _GL_CXXALIASWARN (mkdirat);
1082 #elif defined GNULIB_POSIXCHECK
1083 # undef mkdirat
1084 # if HAVE_RAW_DECL_MKDIRAT
1085 _GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
1086                  "use gnulib module openat for portability");
1087 # endif
1088 #endif
1089 
1090 
1091 #if 0
1092 # if 0
1093 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1094 #   undef mkfifo
1095 #   define mkfifo rpl_mkfifo
1096 #  endif
1097 _GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode)
1098                                _GL_ARG_NONNULL ((1)));
1099 _GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode));
1100 # else
1101 #  if !1
1102 _GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode)
1103                                _GL_ARG_NONNULL ((1)));
1104 #  endif
1105 _GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode));
1106 # endif
1107 _GL_CXXALIASWARN (mkfifo);
1108 #elif defined GNULIB_POSIXCHECK
1109 # undef mkfifo
1110 # if HAVE_RAW_DECL_MKFIFO
1111 _GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
1112                  "use gnulib module mkfifo for portability");
1113 # endif
1114 #endif
1115 
1116 
1117 #if 0
1118 # if !1
1119 _GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)
1120                                  _GL_ARG_NONNULL ((2)));
1121 # endif
1122 _GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode));
1123 _GL_CXXALIASWARN (mkfifoat);
1124 #elif defined GNULIB_POSIXCHECK
1125 # undef mkfifoat
1126 # if HAVE_RAW_DECL_MKFIFOAT
1127 _GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
1128                  "use gnulib module mkfifoat for portability");
1129 # endif
1130 #endif
1131 
1132 
1133 #if 0
1134 # if 0
1135 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1136 #   undef mknod
1137 #   define mknod rpl_mknod
1138 #  endif
1139 _GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)
1140                               _GL_ARG_NONNULL ((1)));
1141 _GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev));
1142 # else
1143 #  if !1
1144 _GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev)
1145                               _GL_ARG_NONNULL ((1)));
1146 #  endif
1147 /* Need to cast, because on OSF/1 5.1, the third parameter is '...'.  */
1148 _GL_CXXALIAS_SYS_CAST (mknod, int, (char const *file, mode_t mode, dev_t dev));
1149 # endif
1150 _GL_CXXALIASWARN (mknod);
1151 #elif defined GNULIB_POSIXCHECK
1152 # undef mknod
1153 # if HAVE_RAW_DECL_MKNOD
1154 _GL_WARN_ON_USE (mknod, "mknod is not portable - "
1155                  "use gnulib module mknod for portability");
1156 # endif
1157 #endif
1158 
1159 
1160 #if 0
1161 # if !1
1162 _GL_FUNCDECL_SYS (mknodat, int,
1163                   (int fd, char const *file, mode_t mode, dev_t dev)
1164                   _GL_ARG_NONNULL ((2)));
1165 # endif
1166 _GL_CXXALIAS_SYS (mknodat, int,
1167                   (int fd, char const *file, mode_t mode, dev_t dev));
1168 _GL_CXXALIASWARN (mknodat);
1169 #elif defined GNULIB_POSIXCHECK
1170 # undef mknodat
1171 # if HAVE_RAW_DECL_MKNODAT
1172 _GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
1173                  "use gnulib module mkfifoat for portability");
1174 # endif
1175 #endif
1176 
1177 
1178 #if 1
1179 # if 0
1180 #  if !0
1181     /* We can't use the object-like #define stat rpl_stat, because of
1182        struct stat.  This means that rpl_stat will not be used if the user
1183        does (stat)(a,b).  Oh well.  */
1184 #   if defined _AIX && defined stat && defined _LARGE_FILES
1185      /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
1186         so we have to replace stat64() instead of stat(). */
1187 #    undef stat64
1188 #    define stat64(name, st) rpl_stat (name, st)
1189 #   elif 0
1190      /* Above, we define stat to _stati64.  */
1191 #    if defined __MINGW32__ && defined _stati64
1192 #     ifndef _USE_32BIT_TIME_T
1193        /* The system headers define _stati64 to _stat64.  */
1194 #      undef _stat64
1195 #      define _stat64(name, st) rpl_stat (name, st)
1196 #     endif
1197 #    elif defined _MSC_VER && defined _stati64
1198 #     ifdef _USE_32BIT_TIME_T
1199        /* The system headers define _stati64 to _stat32i64.  */
1200 #      undef _stat32i64
1201 #      define _stat32i64(name, st) rpl_stat (name, st)
1202 #     else
1203        /* The system headers define _stati64 to _stat64.  */
1204 #      undef _stat64
1205 #      define _stat64(name, st) rpl_stat (name, st)
1206 #     endif
1207 #    else
1208 #     undef _stati64
1209 #     define _stati64(name, st) rpl_stat (name, st)
1210 #    endif
1211 #   elif defined __MINGW32__ && defined stat
1212 #    ifdef _USE_32BIT_TIME_T
1213       /* The system headers define stat to _stat32i64.  */
1214 #     undef _stat32i64
1215 #     define _stat32i64(name, st) rpl_stat (name, st)
1216 #    else
1217       /* The system headers define stat to _stat64.  */
1218 #     undef _stat64
1219 #     define _stat64(name, st) rpl_stat (name, st)
1220 #    endif
1221 #   elif defined _MSC_VER && defined stat
1222 #    ifdef _USE_32BIT_TIME_T
1223       /* The system headers define stat to _stat32.  */
1224 #     undef _stat32
1225 #     define _stat32(name, st) rpl_stat (name, st)
1226 #    else
1227       /* The system headers define stat to _stat64i32.  */
1228 #     undef _stat64i32
1229 #     define _stat64i32(name, st) rpl_stat (name, st)
1230 #    endif
1231 #   else /* !(_AIX || __MINGW32__ || _MSC_VER) */
1232 #    undef stat
1233 #    define stat(name, st) rpl_stat (name, st)
1234 #   endif /* !_LARGE_FILES */
1235 #  endif /* !0 */
1236 _GL_EXTERN_C int stat (const char *name, struct stat *buf)
1237                       _GL_ARG_NONNULL ((1, 2));
1238 # endif
1239 #elif 0
1240 /* see above:
1241   #define stat stat_used_without_requesting_gnulib_module_stat
1242  */
1243 #elif defined GNULIB_POSIXCHECK
1244 # undef stat
1245 # if HAVE_RAW_DECL_STAT
1246 _GL_WARN_ON_USE (stat, "stat is unportable - "
1247                  "use gnulib module stat for portability");
1248 # endif
1249 #endif
1250 
1251 
1252 #if 0
1253 /* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat
1254    implementation relies on futimesat, which on Solaris 10 makes an invocation
1255    to utimensat that is meant to invoke the libc's utimensat(), not gnulib's
1256    utimensat().  */
1257 # if 0 || (!1 && defined __sun)
1258 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1259 #   undef utimensat
1260 #   define utimensat rpl_utimensat
1261 #  endif
1262 _GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name,
1263                                    struct timespec const times[2], int flag)
1264                                   _GL_ARG_NONNULL ((2)));
1265 _GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name,
1266                                    struct timespec const times[2], int flag));
1267 # else
1268 #  if !1
1269 _GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name,
1270                                    struct timespec const times[2], int flag)
1271                                   _GL_ARG_NONNULL ((2)));
1272 #  endif
1273 _GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name,
1274                                    struct timespec const times[2], int flag));
1275 # endif
1276 # if 1
1277 _GL_CXXALIASWARN (utimensat);
1278 # endif
1279 #elif defined GNULIB_POSIXCHECK
1280 # undef utimensat
1281 # if HAVE_RAW_DECL_UTIMENSAT
1282 _GL_WARN_ON_USE (utimensat, "utimensat is not portable - "
1283                  "use gnulib module utimensat for portability");
1284 # endif
1285 #endif
1286 
1287 
1288 #endif /* _GL_SYS_STAT_H */
1289 #endif /* _GL_SYS_STAT_H */
1290 #endif
1291