1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2 /* Provide a more complete sys/stat.h header file.
3 Copyright (C) 2005-2021 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-2021 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_MDA (func, rettype, parameters);
202 is to be used when func is a Microsoft deprecated alias, on native Windows.
203 It declares a C++ alias called GNULIB_NAMESPACE::func
204 that redirects to _func, if GNULIB_NAMESPACE is defined.
205 Example:
206 _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
207 */
208 #define _GL_CXXALIAS_MDA(func,rettype,parameters) \
209 _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters)
210
211 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
212 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
213 except that the C function rpl_func may have a slightly different
214 declaration. A cast is used to silence the "invalid conversion" error
215 that would otherwise occur. */
216 #if defined __cplusplus && defined GNULIB_NAMESPACE
217 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
218 namespace GNULIB_NAMESPACE \
219 { \
220 static const struct _gl_ ## func ## _wrapper \
221 { \
222 typedef rettype (*type) parameters; \
223 \
224 inline operator type () const \
225 { \
226 return reinterpret_cast<type>(::rpl_func); \
227 } \
228 } func = {}; \
229 } \
230 _GL_EXTERN_C int _gl_cxxalias_dummy
231 #else
232 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
233 _GL_EXTERN_C int _gl_cxxalias_dummy
234 #endif
235
236 /* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters);
237 is like _GL_CXXALIAS_MDA (func, rettype, parameters);
238 except that the C function func may have a slightly different declaration.
239 A cast is used to silence the "invalid conversion" error that would
240 otherwise occur. */
241 #define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \
242 _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters)
243
244 /* _GL_CXXALIAS_SYS (func, rettype, parameters);
245 declares a C++ alias called GNULIB_NAMESPACE::func
246 that redirects to the system provided function func, if GNULIB_NAMESPACE
247 is defined.
248 Example:
249 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
250
251 Wrapping func in an object with an inline conversion operator
252 avoids a reference to func unless GNULIB_NAMESPACE::func is
253 actually used in the program. */
254 #if defined __cplusplus && defined GNULIB_NAMESPACE
255 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
256 namespace GNULIB_NAMESPACE \
257 { \
258 static const struct _gl_ ## func ## _wrapper \
259 { \
260 typedef rettype (*type) parameters; \
261 \
262 inline operator type () const \
263 { \
264 return ::func; \
265 } \
266 } func = {}; \
267 } \
268 _GL_EXTERN_C int _gl_cxxalias_dummy
269 #else
270 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
271 _GL_EXTERN_C int _gl_cxxalias_dummy
272 #endif
273
274 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
275 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
276 except that the C function func may have a slightly different declaration.
277 A cast is used to silence the "invalid conversion" error that would
278 otherwise occur. */
279 #if defined __cplusplus && defined GNULIB_NAMESPACE
280 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
281 namespace GNULIB_NAMESPACE \
282 { \
283 static const struct _gl_ ## func ## _wrapper \
284 { \
285 typedef rettype (*type) parameters; \
286 \
287 inline operator type () const \
288 { \
289 return reinterpret_cast<type>(::func); \
290 } \
291 } func = {}; \
292 } \
293 _GL_EXTERN_C int _gl_cxxalias_dummy
294 #else
295 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
296 _GL_EXTERN_C int _gl_cxxalias_dummy
297 #endif
298
299 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
300 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
301 except that the C function is picked among a set of overloaded functions,
302 namely the one with rettype2 and parameters2. Two consecutive casts
303 are used to silence the "cannot find a match" and "invalid conversion"
304 errors that would otherwise occur. */
305 #if defined __cplusplus && defined GNULIB_NAMESPACE
306 /* The outer cast must be a reinterpret_cast.
307 The inner cast: When the function is defined as a set of overloaded
308 functions, it works as a static_cast<>, choosing the designated variant.
309 When the function is defined as a single variant, it works as a
310 reinterpret_cast<>. The parenthesized cast syntax works both ways. */
311 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
312 namespace GNULIB_NAMESPACE \
313 { \
314 static const struct _gl_ ## func ## _wrapper \
315 { \
316 typedef rettype (*type) parameters; \
317 \
318 inline operator type () const \
319 { \
320 return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \
321 } \
322 } func = {}; \
323 } \
324 _GL_EXTERN_C int _gl_cxxalias_dummy
325 #else
326 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
327 _GL_EXTERN_C int _gl_cxxalias_dummy
328 #endif
329
330 /* _GL_CXXALIASWARN (func);
331 causes a warning to be emitted when ::func is used but not when
332 GNULIB_NAMESPACE::func is used. func must be defined without overloaded
333 variants. */
334 #if defined __cplusplus && defined GNULIB_NAMESPACE
335 # define _GL_CXXALIASWARN(func) \
336 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
337 # define _GL_CXXALIASWARN_1(func,namespace) \
338 _GL_CXXALIASWARN_2 (func, namespace)
339 /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
340 we enable the warning only when not optimizing. */
341 # if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
342 # define _GL_CXXALIASWARN_2(func,namespace) \
343 _GL_WARN_ON_USE (func, \
344 "The symbol ::" #func " refers to the system function. " \
345 "Use " #namespace "::" #func " instead.")
346 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
347 # define _GL_CXXALIASWARN_2(func,namespace) \
348 extern __typeof__ (func) func
349 # else
350 # define _GL_CXXALIASWARN_2(func,namespace) \
351 _GL_EXTERN_C int _gl_cxxalias_dummy
352 # endif
353 #else
354 # define _GL_CXXALIASWARN(func) \
355 _GL_EXTERN_C int _gl_cxxalias_dummy
356 #endif
357
358 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
359 causes a warning to be emitted when the given overloaded variant of ::func
360 is used but not when GNULIB_NAMESPACE::func is used. */
361 #if defined __cplusplus && defined GNULIB_NAMESPACE
362 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
363 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
364 GNULIB_NAMESPACE)
365 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
366 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
367 /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
368 we enable the warning only when not optimizing. */
369 # if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
370 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
371 _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \
372 "The symbol ::" #func " refers to the system function. " \
373 "Use " #namespace "::" #func " instead.")
374 # else
375 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
376 _GL_EXTERN_C int _gl_cxxalias_dummy
377 # endif
378 #else
379 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
380 _GL_EXTERN_C int _gl_cxxalias_dummy
381 #endif
382
383 #endif /* _GL_CXXDEFS_H */
384
385 /* The definition of _GL_ARG_NONNULL is copied here. */
386 /* A C macro for declaring that specific arguments must not be NULL.
387 Copyright (C) 2009-2021 Free Software Foundation, Inc.
388
389 This program is free software: you can redistribute it and/or modify it
390 under the terms of the GNU General Public License as published
391 by the Free Software Foundation; either version 3 of the License, or
392 (at your option) any later version.
393
394 This program is distributed in the hope that it will be useful,
395 but WITHOUT ANY WARRANTY; without even the implied warranty of
396 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
397 General Public License for more details.
398
399 You should have received a copy of the GNU General Public License
400 along with this program. If not, see <https://www.gnu.org/licenses/>. */
401
402 /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
403 that the values passed as arguments n, ..., m must be non-NULL pointers.
404 n = 1 stands for the first argument, n = 2 for the second argument etc. */
405 #ifndef _GL_ARG_NONNULL
406 # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__
407 # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
408 # else
409 # define _GL_ARG_NONNULL(params)
410 # endif
411 #endif
412
413 /* The definition of _GL_WARN_ON_USE is copied here. */
414 /* A C macro for emitting warnings if a function is used.
415 Copyright (C) 2010-2021 Free Software Foundation, Inc.
416
417 This program is free software: you can redistribute it and/or modify it
418 under the terms of the GNU General Public License as published
419 by the Free Software Foundation; either version 3 of the License, or
420 (at your option) any later version.
421
422 This program is distributed in the hope that it will be useful,
423 but WITHOUT ANY WARRANTY; without even the implied warranty of
424 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
425 General Public License for more details.
426
427 You should have received a copy of the GNU General Public License
428 along with this program. If not, see <https://www.gnu.org/licenses/>. */
429
430 /* _GL_WARN_ON_USE (function, "literal string") issues a declaration
431 for FUNCTION which will then trigger a compiler warning containing
432 the text of "literal string" anywhere that function is called, if
433 supported by the compiler. If the compiler does not support this
434 feature, the macro expands to an unused extern declaration.
435
436 _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the
437 attribute used in _GL_WARN_ON_USE. If the compiler does not support
438 this feature, it expands to empty.
439
440 These macros are useful for marking a function as a potential
441 portability trap, with the intent that "literal string" include
442 instructions on the replacement function that should be used
443 instead.
444 _GL_WARN_ON_USE is for functions with 'extern' linkage.
445 _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline'
446 linkage.
447
448 However, one of the reasons that a function is a portability trap is
449 if it has the wrong signature. Declaring FUNCTION with a different
450 signature in C is a compilation error, so this macro must use the
451 same type as any existing declaration so that programs that avoid
452 the problematic FUNCTION do not fail to compile merely because they
453 included a header that poisoned the function. But this implies that
454 _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already
455 have a declaration. Use of this macro implies that there must not
456 be any other macro hiding the declaration of FUNCTION; but
457 undefining FUNCTION first is part of the poisoning process anyway
458 (although for symbols that are provided only via a macro, the result
459 is a compilation error rather than a warning containing
460 "literal string"). Also note that in C++, it is only safe to use if
461 FUNCTION has no overloads.
462
463 For an example, it is possible to poison 'getline' by:
464 - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
465 [getline]) in configure.ac, which potentially defines
466 HAVE_RAW_DECL_GETLINE
467 - adding this code to a header that wraps the system <stdio.h>:
468 #undef getline
469 #if HAVE_RAW_DECL_GETLINE
470 _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
471 "not universally present; use the gnulib module getline");
472 #endif
473
474 It is not possible to directly poison global variables. But it is
475 possible to write a wrapper accessor function, and poison that
476 (less common usage, like &environ, will cause a compilation error
477 rather than issue the nice warning, but the end result of informing
478 the developer about their portability problem is still achieved):
479 #if HAVE_RAW_DECL_ENVIRON
480 static char ***
481 rpl_environ (void) { return &environ; }
482 _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
483 # undef environ
484 # define environ (*rpl_environ ())
485 #endif
486 or better (avoiding contradictory use of 'static' and 'extern'):
487 #if HAVE_RAW_DECL_ENVIRON
488 static char ***
489 _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared")
490 rpl_environ (void) { return &environ; }
491 # undef environ
492 # define environ (*rpl_environ ())
493 #endif
494 */
495 #ifndef _GL_WARN_ON_USE
496
497 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
498 /* A compiler attribute is available in gcc versions 4.3.0 and later. */
499 # define _GL_WARN_ON_USE(function, message) \
500 extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
501 # define _GL_WARN_ON_USE_ATTRIBUTE(message) \
502 __attribute__ ((__warning__ (message)))
503 # elif __clang_major__ >= 4
504 /* Another compiler attribute is available in clang. */
505 # define _GL_WARN_ON_USE(function, message) \
506 extern __typeof__ (function) function \
507 __attribute__ ((__diagnose_if__ (1, message, "warning")))
508 # define _GL_WARN_ON_USE_ATTRIBUTE(message) \
509 __attribute__ ((__diagnose_if__ (1, message, "warning")))
510 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
511 /* Verify the existence of the function. */
512 # define _GL_WARN_ON_USE(function, message) \
513 extern __typeof__ (function) function
514 # define _GL_WARN_ON_USE_ATTRIBUTE(message)
515 # else /* Unsupported. */
516 # define _GL_WARN_ON_USE(function, message) \
517 _GL_WARN_EXTERN_C int _gl_warn_on_use
518 # define _GL_WARN_ON_USE_ATTRIBUTE(message)
519 # endif
520 #endif
521
522 /* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message")
523 is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the
524 function is declared with the given prototype, consisting of return type,
525 parameters, and attributes.
526 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
527 not work in this case. */
528 #ifndef _GL_WARN_ON_USE_CXX
529 # if !defined __cplusplus
530 # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
531 _GL_WARN_ON_USE (function, msg)
532 # else
533 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
534 /* A compiler attribute is available in gcc versions 4.3.0 and later. */
535 # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
536 extern rettype_gcc function parameters_and_attributes \
537 __attribute__ ((__warning__ (msg)))
538 # elif __clang_major__ >= 4
539 /* Another compiler attribute is available in clang. */
540 # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
541 extern rettype_clang function parameters_and_attributes \
542 __attribute__ ((__diagnose_if__ (1, msg, "warning")))
543 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
544 /* Verify the existence of the function. */
545 # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
546 extern rettype_gcc function parameters_and_attributes
547 # else /* Unsupported. */
548 # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
549 _GL_WARN_EXTERN_C int _gl_warn_on_use
550 # endif
551 # endif
552 #endif
553
554 /* _GL_WARN_EXTERN_C declaration;
555 performs the declaration with C linkage. */
556 #ifndef _GL_WARN_EXTERN_C
557 # if defined __cplusplus
558 # define _GL_WARN_EXTERN_C extern "C"
559 # else
560 # define _GL_WARN_EXTERN_C extern
561 # endif
562 #endif
563
564 /* Before doing "#define mknod rpl_mknod" below, we need to include all
565 headers that may declare mknod(). OS/2 kLIBC declares mknod() in
566 <unistd.h>, not in <sys/stat.h>. */
567 #ifdef __KLIBC__
568 # include <unistd.h>
569 #endif
570
571 /* Before doing "#define mkdir rpl_mkdir" below, we need to include all
572 headers that may declare mkdir(). Native Windows platforms declare mkdir
573 in <io.h> and/or <direct.h>, not in <sys/stat.h>. */
574 #if defined _WIN32 && ! defined __CYGWIN__
575 # include <io.h> /* mingw32, mingw64 */
576 # include <direct.h> /* mingw64, MSVC 9 */
577 #endif
578
579 /* Native Windows platforms declare umask() in <io.h>. */
580 #if 0 && (defined _WIN32 && ! defined __CYGWIN__)
581 # include <io.h>
582 #endif
583
584 /* Large File Support on native Windows. */
585 #if 0
586 # define stat _stati64
587 #endif
588
589 /* Optionally, override 'struct stat' on native Windows. */
590 #if 0
591
592 # undef stat
593 # if 1
594 # define stat rpl_stat
595 # else
596 /* Provoke a clear link error if stat() is used as a function and
597 module 'stat' is not in use. */
598 # define stat stat_used_without_requesting_gnulib_module_stat
599 # endif
600
601 # if !GNULIB_defined_struct_stat
602 struct stat
603 {
604 dev_t st_dev;
605 ino_t st_ino;
606 mode_t st_mode;
607 nlink_t st_nlink;
608 # if 0
609 uid_t st_uid;
610 # else /* uid_t is not defined by default on native Windows. */
611 short st_uid;
612 # endif
613 # if 0
614 gid_t st_gid;
615 # else /* gid_t is not defined by default on native Windows. */
616 short st_gid;
617 # endif
618 dev_t st_rdev;
619 off_t st_size;
620 # if 0
621 blksize_t st_blksize;
622 blkcnt_t st_blocks;
623 # endif
624
625 # if 0
626 struct timespec st_atim;
627 struct timespec st_mtim;
628 struct timespec st_ctim;
629 # else
630 time_t st_atime;
631 time_t st_mtime;
632 time_t st_ctime;
633 # endif
634 };
635 # if 0
636 # define st_atime st_atim.tv_sec
637 # define st_mtime st_mtim.tv_sec
638 # define st_ctime st_ctim.tv_sec
639 /* Indicator, for gnulib internal purposes. */
640 # define _GL_WINDOWS_STAT_TIMESPEC 1
641 # endif
642 # define GNULIB_defined_struct_stat 1
643 # endif
644
645 /* Other possible values of st_mode. */
646 # if 0
647 # define _S_IFBLK 0x6000
648 # endif
649 # if 0
650 # define _S_IFLNK 0xA000
651 # endif
652 # if 0
653 # define _S_IFSOCK 0xC000
654 # endif
655
656 #endif
657
658 #ifndef S_IFIFO
659 # ifdef _S_IFIFO
660 # define S_IFIFO _S_IFIFO
661 # endif
662 #endif
663
664 #ifndef S_IFMT
665 # define S_IFMT 0170000
666 #endif
667
668 #if STAT_MACROS_BROKEN
669 # undef S_ISBLK
670 # undef S_ISCHR
671 # undef S_ISDIR
672 # undef S_ISFIFO
673 # undef S_ISLNK
674 # undef S_ISNAM
675 # undef S_ISMPB
676 # undef S_ISMPC
677 # undef S_ISNWK
678 # undef S_ISREG
679 # undef S_ISSOCK
680 #endif
681
682 #ifndef S_ISBLK
683 # ifdef S_IFBLK
684 # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
685 # else
686 # define S_ISBLK(m) 0
687 # endif
688 #endif
689
690 #ifndef S_ISCHR
691 # ifdef S_IFCHR
692 # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
693 # else
694 # define S_ISCHR(m) 0
695 # endif
696 #endif
697
698 #ifndef S_ISDIR
699 # ifdef S_IFDIR
700 # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
701 # else
702 # define S_ISDIR(m) 0
703 # endif
704 #endif
705
706 #ifndef S_ISDOOR /* Solaris 2.5 and up */
707 # define S_ISDOOR(m) 0
708 #endif
709
710 #ifndef S_ISFIFO
711 # ifdef S_IFIFO
712 # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
713 # else
714 # define S_ISFIFO(m) 0
715 # endif
716 #endif
717
718 #ifndef S_ISLNK
719 # ifdef S_IFLNK
720 # define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
721 # else
722 # define S_ISLNK(m) 0
723 # endif
724 #endif
725
726 #ifndef S_ISMPB /* V7 */
727 # ifdef S_IFMPB
728 # define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
729 # define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
730 # else
731 # define S_ISMPB(m) 0
732 # define S_ISMPC(m) 0
733 # endif
734 #endif
735
736 #ifndef S_ISMPX /* AIX */
737 # define S_ISMPX(m) 0
738 #endif
739
740 #ifndef S_ISNAM /* Xenix */
741 # ifdef S_IFNAM
742 # define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
743 # else
744 # define S_ISNAM(m) 0
745 # endif
746 #endif
747
748 #ifndef S_ISNWK /* HP/UX */
749 # ifdef S_IFNWK
750 # define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
751 # else
752 # define S_ISNWK(m) 0
753 # endif
754 #endif
755
756 #ifndef S_ISPORT /* Solaris 10 and up */
757 # define S_ISPORT(m) 0
758 #endif
759
760 #ifndef S_ISREG
761 # ifdef S_IFREG
762 # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
763 # else
764 # define S_ISREG(m) 0
765 # endif
766 #endif
767
768 #ifndef S_ISSOCK
769 # ifdef S_IFSOCK
770 # define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
771 # else
772 # define S_ISSOCK(m) 0
773 # endif
774 #endif
775
776
777 #ifndef S_TYPEISMQ
778 # define S_TYPEISMQ(p) 0
779 #endif
780
781 #ifndef S_TYPEISTMO
782 # define S_TYPEISTMO(p) 0
783 #endif
784
785
786 #ifndef S_TYPEISSEM
787 # ifdef S_INSEM
788 # define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
789 # else
790 # define S_TYPEISSEM(p) 0
791 # endif
792 #endif
793
794 #ifndef S_TYPEISSHM
795 # ifdef S_INSHD
796 # define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
797 # else
798 # define S_TYPEISSHM(p) 0
799 # endif
800 #endif
801
802 /* high performance ("contiguous data") */
803 #ifndef S_ISCTG
804 # define S_ISCTG(p) 0
805 #endif
806
807 /* Cray DMF (data migration facility): off line, with data */
808 #ifndef S_ISOFD
809 # define S_ISOFD(p) 0
810 #endif
811
812 /* Cray DMF (data migration facility): off line, with no data */
813 #ifndef S_ISOFL
814 # define S_ISOFL(p) 0
815 #endif
816
817 /* 4.4BSD whiteout */
818 #ifndef S_ISWHT
819 # define S_ISWHT(m) 0
820 #endif
821
822 /* If any of the following are undefined,
823 define them to their de facto standard values. */
824 #if !S_ISUID
825 # define S_ISUID 04000
826 #endif
827 #if !S_ISGID
828 # define S_ISGID 02000
829 #endif
830
831 /* S_ISVTX is a common extension to POSIX. */
832 #ifndef S_ISVTX
833 # define S_ISVTX 01000
834 #endif
835
836 #if !S_IRUSR && S_IREAD
837 # define S_IRUSR S_IREAD
838 #endif
839 #if !S_IRUSR
840 # define S_IRUSR 00400
841 #endif
842 #if !S_IRGRP
843 # define S_IRGRP (S_IRUSR >> 3)
844 #endif
845 #if !S_IROTH
846 # define S_IROTH (S_IRUSR >> 6)
847 #endif
848
849 #if !S_IWUSR && S_IWRITE
850 # define S_IWUSR S_IWRITE
851 #endif
852 #if !S_IWUSR
853 # define S_IWUSR 00200
854 #endif
855 #if !S_IWGRP
856 # define S_IWGRP (S_IWUSR >> 3)
857 #endif
858 #if !S_IWOTH
859 # define S_IWOTH (S_IWUSR >> 6)
860 #endif
861
862 #if !S_IXUSR && S_IEXEC
863 # define S_IXUSR S_IEXEC
864 #endif
865 #if !S_IXUSR
866 # define S_IXUSR 00100
867 #endif
868 #if !S_IXGRP
869 # define S_IXGRP (S_IXUSR >> 3)
870 #endif
871 #if !S_IXOTH
872 # define S_IXOTH (S_IXUSR >> 6)
873 #endif
874
875 #if !S_IRWXU
876 # define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
877 #endif
878 #if !S_IRWXG
879 # define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
880 #endif
881 #if !S_IRWXO
882 # define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
883 #endif
884
885 /* Although S_IXUGO and S_IRWXUGO are not specified by POSIX and are
886 not implemented in GNU/Linux, some Gnulib-using apps use the macros. */
887 #if !S_IXUGO
888 # define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
889 #endif
890 #ifndef S_IRWXUGO
891 # define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
892 #endif
893
894 /* Macros for futimens and utimensat. */
895 #ifndef UTIME_NOW
896 # define UTIME_NOW (-1)
897 # define UTIME_OMIT (-2)
898 #endif
899
900
901 #if 1
902 /* On native Windows, map 'chmod' to '_chmod', so that -loldnames is not
903 required. In C++ with GNULIB_NAMESPACE, avoid differences between
904 platforms by defining GNULIB_NAMESPACE::chmod always. */
905 # if defined _WIN32 && !defined __CYGWIN__
906 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
907 # undef chmod
908 # define chmod _chmod
909 # endif
910 /* Need to cast, because in mingw the last argument is 'int mode'. */
911 _GL_CXXALIAS_MDA_CAST (chmod, int, (const char *filename, mode_t mode));
912 # else
913 _GL_CXXALIAS_SYS (chmod, int, (const char *filename, mode_t mode));
914 # endif
915 _GL_CXXALIASWARN (chmod);
916 #endif
917
918
919 #if 1
920 # if 0
921 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
922 # undef fchmodat
923 # define fchmodat rpl_fchmodat
924 # endif
925 _GL_FUNCDECL_RPL (fchmodat, int,
926 (int fd, char const *file, mode_t mode, int flag)
927 _GL_ARG_NONNULL ((2)));
928 _GL_CXXALIAS_RPL (fchmodat, int,
929 (int fd, char const *file, mode_t mode, int flag));
930 # else
931 # if !1
932 _GL_FUNCDECL_SYS (fchmodat, int,
933 (int fd, char const *file, mode_t mode, int flag)
934 _GL_ARG_NONNULL ((2)));
935 # endif
936 _GL_CXXALIAS_SYS (fchmodat, int,
937 (int fd, char const *file, mode_t mode, int flag));
938 # endif
939 _GL_CXXALIASWARN (fchmodat);
940 #elif defined GNULIB_POSIXCHECK
941 # undef fchmodat
942 # if HAVE_RAW_DECL_FCHMODAT
943 _GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
944 "use gnulib module openat for portability");
945 # endif
946 #endif
947
948
949 #if 1
950 # if 0
951 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
952 # undef fstat
953 # define fstat rpl_fstat
954 # endif
955 _GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2)));
956 _GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
957 # else
958 _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
959 # endif
960 # if __GLIBC__ >= 2
961 _GL_CXXALIASWARN (fstat);
962 # endif
963 #elif 0
964 # undef fstat
965 # define fstat fstat_used_without_requesting_gnulib_module_fstat
966 #elif 0
967 /* Above, we define stat to _stati64. */
968 # define fstat _fstati64
969 #elif defined GNULIB_POSIXCHECK
970 # undef fstat
971 # if HAVE_RAW_DECL_FSTAT
972 _GL_WARN_ON_USE (fstat, "fstat has portability problems - "
973 "use gnulib module fstat for portability");
974 # endif
975 #endif
976
977
978 #if 1
979 # if 0
980 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
981 # undef fstatat
982 # define fstatat rpl_fstatat
983 # endif
984 _GL_FUNCDECL_RPL (fstatat, int,
985 (int fd, char const *restrict name, struct stat *restrict st,
986 int flags)
987 _GL_ARG_NONNULL ((2, 3)));
988 _GL_CXXALIAS_RPL (fstatat, int,
989 (int fd, char const *restrict name, struct stat *restrict st,
990 int flags));
991 # else
992 # if !1
993 _GL_FUNCDECL_SYS (fstatat, int,
994 (int fd, char const *restrict name, struct stat *restrict st,
995 int flags)
996 _GL_ARG_NONNULL ((2, 3)));
997 # endif
998 _GL_CXXALIAS_SYS (fstatat, int,
999 (int fd, char const *restrict name, struct stat *restrict st,
1000 int flags));
1001 # endif
1002 _GL_CXXALIASWARN (fstatat);
1003 #elif 0
1004 # undef fstatat
1005 # define fstatat fstatat_used_without_requesting_gnulib_module_fstatat
1006 #elif defined GNULIB_POSIXCHECK
1007 # undef fstatat
1008 # if HAVE_RAW_DECL_FSTATAT
1009 _GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
1010 "use gnulib module openat for portability");
1011 # endif
1012 #endif
1013
1014
1015 #if 1
1016 /* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our futimens
1017 implementation relies on futimesat, which on Solaris 10 makes an invocation
1018 to futimens that is meant to invoke the libc's futimens(), not gnulib's
1019 futimens(). */
1020 # if 0 || (!1 && defined __sun)
1021 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1022 # undef futimens
1023 # define futimens rpl_futimens
1024 # endif
1025 _GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2]));
1026 _GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2]));
1027 # else
1028 # if !1
1029 _GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2]));
1030 # endif
1031 _GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2]));
1032 # endif
1033 # if 1
1034 _GL_CXXALIASWARN (futimens);
1035 # endif
1036 #elif defined GNULIB_POSIXCHECK
1037 # undef futimens
1038 # if HAVE_RAW_DECL_FUTIMENS
1039 _GL_WARN_ON_USE (futimens, "futimens is not portable - "
1040 "use gnulib module futimens for portability");
1041 # endif
1042 #endif
1043
1044
1045 #if 0
1046 # if !1
1047 _GL_FUNCDECL_SYS (getumask, mode_t, (void));
1048 # endif
1049 _GL_CXXALIAS_SYS (getumask, mode_t, (void));
1050 # if 1
1051 _GL_CXXALIASWARN (getumask);
1052 # endif
1053 #elif defined GNULIB_POSIXCHECK
1054 # undef getumask
1055 # if HAVE_RAW_DECL_GETUMASK
1056 _GL_WARN_ON_USE (getumask, "getumask is not portable - "
1057 "use gnulib module getumask for portability");
1058 # endif
1059 #endif
1060
1061
1062 #if 1
1063 /* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
1064 denotes a symbolic link. */
1065 # if !1 || defined __hpux
1066 _GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode)
1067 _GL_ARG_NONNULL ((1)));
1068 # endif
1069 _GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode));
1070 _GL_CXXALIASWARN (lchmod);
1071 #elif defined GNULIB_POSIXCHECK
1072 # undef lchmod
1073 # if HAVE_RAW_DECL_LCHMOD
1074 _GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
1075 "use gnulib module lchmod for portability");
1076 # endif
1077 #endif
1078
1079
1080 #if 1
1081 # if ! 1
1082 /* mingw does not support symlinks, therefore it does not have lstat. But
1083 without links, stat does just fine. */
1084 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1085 # define lstat stat
1086 # endif
1087 _GL_CXXALIAS_RPL_1 (lstat, stat, int,
1088 (const char *restrict name, struct stat *restrict buf));
1089 # elif 0
1090 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1091 # undef lstat
1092 # define lstat rpl_lstat
1093 # endif
1094 _GL_FUNCDECL_RPL (lstat, int,
1095 (const char *restrict name, struct stat *restrict buf)
1096 _GL_ARG_NONNULL ((1, 2)));
1097 _GL_CXXALIAS_RPL (lstat, int,
1098 (const char *restrict name, struct stat *restrict buf));
1099 # else
1100 _GL_CXXALIAS_SYS (lstat, int,
1101 (const char *restrict name, struct stat *restrict buf));
1102 # endif
1103 # if 1
1104 _GL_CXXALIASWARN (lstat);
1105 # endif
1106 #elif 0
1107 # undef lstat
1108 # define lstat lstat_used_without_requesting_gnulib_module_lstat
1109 #elif defined GNULIB_POSIXCHECK
1110 # undef lstat
1111 # if HAVE_RAW_DECL_LSTAT
1112 _GL_WARN_ON_USE (lstat, "lstat is unportable - "
1113 "use gnulib module lstat for portability");
1114 # endif
1115 #endif
1116
1117
1118 #if 1
1119 # if 0
1120 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1121 # undef mkdir
1122 # define mkdir rpl_mkdir
1123 # endif
1124 _GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode)
1125 _GL_ARG_NONNULL ((1)));
1126 _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
1127 # elif defined _WIN32 && !defined __CYGWIN__
1128 /* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
1129 Additionally, it declares _mkdir (and depending on compile flags, an
1130 alias mkdir), only in the nonstandard includes <direct.h> and <io.h>,
1131 which are included above. */
1132 # if !GNULIB_defined_rpl_mkdir
1133 static int
rpl_mkdir(char const * name,mode_t mode)1134 rpl_mkdir (char const *name, mode_t mode)
1135 {
1136 return _mkdir (name);
1137 }
1138 # define GNULIB_defined_rpl_mkdir 1
1139 # endif
1140 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1141 # undef mkdir
1142 # define mkdir rpl_mkdir
1143 # endif
1144 _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
1145 # else
1146 _GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
1147 # endif
1148 _GL_CXXALIASWARN (mkdir);
1149 #elif defined GNULIB_POSIXCHECK
1150 # undef mkdir
1151 # if HAVE_RAW_DECL_MKDIR
1152 _GL_WARN_ON_USE (mkdir, "mkdir does not always support two parameters - "
1153 "use gnulib module mkdir for portability");
1154 # endif
1155 #elif 1
1156 /* On native Windows, map 'mkdir' to '_mkdir', so that -loldnames is not
1157 required. In C++ with GNULIB_NAMESPACE, avoid differences between
1158 platforms by defining GNULIB_NAMESPACE::mkdir always. */
1159 # if defined _WIN32 && !defined __CYGWIN__
1160 # if !GNULIB_defined_rpl_mkdir
1161 static int
rpl_mkdir(char const * name,mode_t mode)1162 rpl_mkdir (char const *name, mode_t mode)
1163 {
1164 return _mkdir (name);
1165 }
1166 # define GNULIB_defined_rpl_mkdir 1
1167 # endif
1168 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1169 # undef mkdir
1170 # define mkdir rpl_mkdir
1171 # endif
1172 _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
1173 # else
1174 _GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
1175 # endif
1176 _GL_CXXALIASWARN (mkdir);
1177 #endif
1178
1179
1180 #if 1
1181 # if !1
1182 _GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)
1183 _GL_ARG_NONNULL ((2)));
1184 # endif
1185 _GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode));
1186 _GL_CXXALIASWARN (mkdirat);
1187 #elif defined GNULIB_POSIXCHECK
1188 # undef mkdirat
1189 # if HAVE_RAW_DECL_MKDIRAT
1190 _GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
1191 "use gnulib module openat for portability");
1192 # endif
1193 #endif
1194
1195
1196 #if 1
1197 # if 0
1198 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1199 # undef mkfifo
1200 # define mkfifo rpl_mkfifo
1201 # endif
1202 _GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode)
1203 _GL_ARG_NONNULL ((1)));
1204 _GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode));
1205 # else
1206 # if !1
1207 _GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode)
1208 _GL_ARG_NONNULL ((1)));
1209 # endif
1210 _GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode));
1211 # endif
1212 _GL_CXXALIASWARN (mkfifo);
1213 #elif defined GNULIB_POSIXCHECK
1214 # undef mkfifo
1215 # if HAVE_RAW_DECL_MKFIFO
1216 _GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
1217 "use gnulib module mkfifo for portability");
1218 # endif
1219 #endif
1220
1221
1222 #if 1
1223 # if 0
1224 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1225 # undef mkfifoat
1226 # define mkfifoat rpl_mkfifoat
1227 # endif
1228 _GL_FUNCDECL_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode)
1229 _GL_ARG_NONNULL ((2)));
1230 _GL_CXXALIAS_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode));
1231 # else
1232 # if !1
1233 _GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)
1234 _GL_ARG_NONNULL ((2)));
1235 # endif
1236 _GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode));
1237 # endif
1238 _GL_CXXALIASWARN (mkfifoat);
1239 #elif defined GNULIB_POSIXCHECK
1240 # undef mkfifoat
1241 # if HAVE_RAW_DECL_MKFIFOAT
1242 _GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
1243 "use gnulib module mkfifoat for portability");
1244 # endif
1245 #endif
1246
1247
1248 #if 1
1249 # if 0
1250 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1251 # undef mknod
1252 # define mknod rpl_mknod
1253 # endif
1254 _GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)
1255 _GL_ARG_NONNULL ((1)));
1256 _GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev));
1257 # else
1258 # if !1
1259 _GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev)
1260 _GL_ARG_NONNULL ((1)));
1261 # endif
1262 /* Need to cast, because on OSF/1 5.1, the third parameter is '...'. */
1263 _GL_CXXALIAS_SYS_CAST (mknod, int, (char const *file, mode_t mode, dev_t dev));
1264 # endif
1265 _GL_CXXALIASWARN (mknod);
1266 #elif defined GNULIB_POSIXCHECK
1267 # undef mknod
1268 # if HAVE_RAW_DECL_MKNOD
1269 _GL_WARN_ON_USE (mknod, "mknod is not portable - "
1270 "use gnulib module mknod for portability");
1271 # endif
1272 #endif
1273
1274
1275 #if 1
1276 # if 0
1277 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1278 # undef mknodat
1279 # define mknodat rpl_mknodat
1280 # endif
1281 _GL_FUNCDECL_RPL (mknodat, int,
1282 (int fd, char const *file, mode_t mode, dev_t dev)
1283 _GL_ARG_NONNULL ((2)));
1284 _GL_CXXALIAS_RPL (mknodat, int,
1285 (int fd, char const *file, mode_t mode, dev_t dev));
1286 # else
1287 # if !1
1288 _GL_FUNCDECL_SYS (mknodat, int,
1289 (int fd, char const *file, mode_t mode, dev_t dev)
1290 _GL_ARG_NONNULL ((2)));
1291 # endif
1292 _GL_CXXALIAS_SYS (mknodat, int,
1293 (int fd, char const *file, mode_t mode, dev_t dev));
1294 # endif
1295 _GL_CXXALIASWARN (mknodat);
1296 #elif defined GNULIB_POSIXCHECK
1297 # undef mknodat
1298 # if HAVE_RAW_DECL_MKNODAT
1299 _GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
1300 "use gnulib module mkfifoat for portability");
1301 # endif
1302 #endif
1303
1304
1305 #if 1
1306 # if 0
1307 # if !0
1308 /* We can't use the object-like #define stat rpl_stat, because of
1309 struct stat. This means that rpl_stat will not be used if the user
1310 does (stat)(a,b). Oh well. */
1311 # if defined _AIX && defined stat && defined _LARGE_FILES
1312 /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
1313 so we have to replace stat64() instead of stat(). */
1314 # undef stat64
1315 # define stat64(name, st) rpl_stat (name, st)
1316 # elif 0
1317 /* Above, we define stat to _stati64. */
1318 # if defined __MINGW32__ && defined _stati64
1319 # ifndef _USE_32BIT_TIME_T
1320 /* The system headers define _stati64 to _stat64. */
1321 # undef _stat64
1322 # define _stat64(name, st) rpl_stat (name, st)
1323 # endif
1324 # elif defined _MSC_VER && defined _stati64
1325 # ifdef _USE_32BIT_TIME_T
1326 /* The system headers define _stati64 to _stat32i64. */
1327 # undef _stat32i64
1328 # define _stat32i64(name, st) rpl_stat (name, st)
1329 # else
1330 /* The system headers define _stati64 to _stat64. */
1331 # undef _stat64
1332 # define _stat64(name, st) rpl_stat (name, st)
1333 # endif
1334 # else
1335 # undef _stati64
1336 # define _stati64(name, st) rpl_stat (name, st)
1337 # endif
1338 # elif defined __MINGW32__ && defined stat
1339 # ifdef _USE_32BIT_TIME_T
1340 /* The system headers define stat to _stat32i64. */
1341 # undef _stat32i64
1342 # define _stat32i64(name, st) rpl_stat (name, st)
1343 # else
1344 /* The system headers define stat to _stat64. */
1345 # undef _stat64
1346 # define _stat64(name, st) rpl_stat (name, st)
1347 # endif
1348 # elif defined _MSC_VER && defined stat
1349 # ifdef _USE_32BIT_TIME_T
1350 /* The system headers define stat to _stat32. */
1351 # undef _stat32
1352 # define _stat32(name, st) rpl_stat (name, st)
1353 # else
1354 /* The system headers define stat to _stat64i32. */
1355 # undef _stat64i32
1356 # define _stat64i32(name, st) rpl_stat (name, st)
1357 # endif
1358 # else /* !(_AIX || __MINGW32__ || _MSC_VER) */
1359 # undef stat
1360 # define stat(name, st) rpl_stat (name, st)
1361 # endif /* !_LARGE_FILES */
1362 # endif /* !0 */
1363 _GL_EXTERN_C int stat (const char *restrict name, struct stat *restrict buf)
1364 _GL_ARG_NONNULL ((1, 2));
1365 # endif
1366 #elif 0
1367 /* see above:
1368 #define stat stat_used_without_requesting_gnulib_module_stat
1369 */
1370 #elif defined GNULIB_POSIXCHECK
1371 # undef stat
1372 # if HAVE_RAW_DECL_STAT
1373 _GL_WARN_ON_USE (stat, "stat is unportable - "
1374 "use gnulib module stat for portability");
1375 # endif
1376 #endif
1377
1378
1379 #if 1
1380 /* On native Windows, map 'umask' to '_umask', so that -loldnames is not
1381 required. In C++ with GNULIB_NAMESPACE, avoid differences between
1382 platforms by defining GNULIB_NAMESPACE::umask always. */
1383 # if defined _WIN32 && !defined __CYGWIN__
1384 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1385 # undef umask
1386 # define umask _umask
1387 # endif
1388 /* Need to cast, because in mingw the last argument is 'int mode'. */
1389 _GL_CXXALIAS_MDA_CAST (umask, mode_t, (mode_t mask));
1390 # else
1391 _GL_CXXALIAS_SYS (umask, mode_t, (mode_t mask));
1392 # endif
1393 _GL_CXXALIASWARN (umask);
1394 #endif
1395
1396
1397 #if 1
1398 /* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat
1399 implementation relies on futimesat, which on Solaris 10 makes an invocation
1400 to utimensat that is meant to invoke the libc's utimensat(), not gnulib's
1401 utimensat(). */
1402 # if 0 || (!1 && defined __sun)
1403 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1404 # undef utimensat
1405 # define utimensat rpl_utimensat
1406 # endif
1407 _GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name,
1408 struct timespec const times[2], int flag)
1409 _GL_ARG_NONNULL ((2)));
1410 _GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name,
1411 struct timespec const times[2], int flag));
1412 # else
1413 # if !1
1414 _GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name,
1415 struct timespec const times[2], int flag)
1416 _GL_ARG_NONNULL ((2)));
1417 # endif
1418 _GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name,
1419 struct timespec const times[2], int flag));
1420 # endif
1421 # if 1
1422 _GL_CXXALIASWARN (utimensat);
1423 # endif
1424 #elif defined GNULIB_POSIXCHECK
1425 # undef utimensat
1426 # if HAVE_RAW_DECL_UTIMENSAT
1427 _GL_WARN_ON_USE (utimensat, "utimensat is not portable - "
1428 "use gnulib module utimensat for portability");
1429 # endif
1430 #endif
1431
1432
1433 #endif /* _GL_SYS_STAT_H */
1434 #endif /* _GL_SYS_STAT_H */
1435 #endif
1436