GDBserver
stat.h
Go to the documentation of this file.
1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2 /* Provide a more complete sys/stat header file.
3  Copyright (C) 2005-2016 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 <http://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 #ifndef _GL_CXXDEFS_H
54 #define _GL_CXXDEFS_H
55 
56 /* Begin/end the GNULIB_NAMESPACE namespace. */
57 #if defined __cplusplus && defined GNULIB_NAMESPACE
58 # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
59 # define _GL_END_NAMESPACE }
60 #else
61 # define _GL_BEGIN_NAMESPACE
62 # define _GL_END_NAMESPACE
63 #endif
64 
65 /* The three most frequent use cases of these macros are:
66 
67  * For providing a substitute for a function that is missing on some
68  platforms, but is declared and works fine on the platforms on which
69  it exists:
70 
71  #if @GNULIB_FOO@
72  # if !@HAVE_FOO@
73  _GL_FUNCDECL_SYS (foo, ...);
74  # endif
75  _GL_CXXALIAS_SYS (foo, ...);
76  _GL_CXXALIASWARN (foo);
77  #elif defined GNULIB_POSIXCHECK
78  ...
79  #endif
80 
81  * For providing a replacement for a function that exists on all platforms,
82  but is broken/insufficient and needs to be replaced on some platforms:
83 
84  #if @GNULIB_FOO@
85  # if @REPLACE_FOO@
86  # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
87  # undef foo
88  # define foo rpl_foo
89  # endif
90  _GL_FUNCDECL_RPL (foo, ...);
91  _GL_CXXALIAS_RPL (foo, ...);
92  # else
93  _GL_CXXALIAS_SYS (foo, ...);
94  # endif
95  _GL_CXXALIASWARN (foo);
96  #elif defined GNULIB_POSIXCHECK
97  ...
98  #endif
99 
100  * For providing a replacement for a function that exists on some platforms
101  but is broken/insufficient and needs to be replaced on some of them and
102  is additionally either missing or undeclared on some other platforms:
103 
104  #if @GNULIB_FOO@
105  # if @REPLACE_FOO@
106  # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
107  # undef foo
108  # define foo rpl_foo
109  # endif
110  _GL_FUNCDECL_RPL (foo, ...);
111  _GL_CXXALIAS_RPL (foo, ...);
112  # else
113  # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
114  _GL_FUNCDECL_SYS (foo, ...);
115  # endif
116  _GL_CXXALIAS_SYS (foo, ...);
117  # endif
118  _GL_CXXALIASWARN (foo);
119  #elif defined GNULIB_POSIXCHECK
120  ...
121  #endif
122 */
123 
124 /* _GL_EXTERN_C declaration;
125  performs the declaration with C linkage. */
126 #if defined __cplusplus
127 # define _GL_EXTERN_C extern "C"
128 #else
129 # define _GL_EXTERN_C extern
130 #endif
131 
132 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
133  declares a replacement function, named rpl_func, with the given prototype,
134  consisting of return type, parameters, and attributes.
135  Example:
136  _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
137  _GL_ARG_NONNULL ((1)));
138  */
139 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
140  _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
141 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
142  _GL_EXTERN_C rettype rpl_func parameters_and_attributes
143 
144 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
145  declares the system function, named func, with the given prototype,
146  consisting of return type, parameters, and attributes.
147  Example:
148  _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
149  _GL_ARG_NONNULL ((1)));
150  */
151 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
152  _GL_EXTERN_C rettype func parameters_and_attributes
153 
154 /* _GL_CXXALIAS_RPL (func, rettype, parameters);
155  declares a C++ alias called GNULIB_NAMESPACE::func
156  that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
157  Example:
158  _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
159 
160  Wrapping rpl_func in an object with an inline conversion operator
161  avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
162  actually used in the program. */
163 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
164  _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
165 #if defined __cplusplus && defined GNULIB_NAMESPACE
166 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
167  namespace GNULIB_NAMESPACE \
168  { \
169  static const struct _gl_ ## func ## _wrapper \
170  { \
171  typedef rettype (*type) parameters; \
172  inline type rpl () const { return ::rpl_func; } \
173  inline operator type () const { return rpl (); } \
174  } func = {}; \
175  } \
176  _GL_EXTERN_C int _gl_cxxalias_dummy
177 #else
178 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
179  _GL_EXTERN_C int _gl_cxxalias_dummy
180 #endif
181 
182 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
183  is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
184  except that the C function rpl_func may have a slightly different
185  declaration. A cast is used to silence the "invalid conversion" error
186  that would otherwise occur. */
187 #if defined __cplusplus && defined GNULIB_NAMESPACE
188 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
189  namespace GNULIB_NAMESPACE \
190  { \
191  static const struct _gl_ ## func ## _wrapper \
192  { \
193  typedef rettype (*type) parameters; \
194  inline type rpl () const \
195  { return reinterpret_cast<type>(::rpl_func); } \
196  inline operator type () const { return rpl (); } \
197  } func = {}; \
198  } \
199  _GL_EXTERN_C int _gl_cxxalias_dummy
200 #else
201 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
202  _GL_EXTERN_C int _gl_cxxalias_dummy
203 #endif
204 
205 /* _GL_CXXALIAS_SYS (func, rettype, parameters);
206  declares a C++ alias called GNULIB_NAMESPACE::func
207  that redirects to the system provided function func, if GNULIB_NAMESPACE
208  is defined.
209  Example:
210  _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
211 
212  Wrapping func in an object with an inline conversion operator
213  avoids a reference to func unless GNULIB_NAMESPACE::func is
214  actually used in the program. */
215 #if defined __cplusplus && defined GNULIB_NAMESPACE
216 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
217  namespace GNULIB_NAMESPACE \
218  { \
219  static const struct _gl_ ## func ## _wrapper \
220  { \
221  typedef rettype (*type) parameters; \
222  inline type rpl () const { return ::func; } \
223  inline operator type () const { return rpl (); } \
224  } func = {}; \
225  } \
226  _GL_EXTERN_C int _gl_cxxalias_dummy
227 #else
228 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
229  _GL_EXTERN_C int _gl_cxxalias_dummy
230 #endif
231 
232 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
233  is like _GL_CXXALIAS_SYS (func, rettype, parameters);
234  except that the C function func may have a slightly different declaration.
235  A cast is used to silence the "invalid conversion" error that would
236  otherwise occur. */
237 #if defined __cplusplus && defined GNULIB_NAMESPACE
238 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
239  namespace GNULIB_NAMESPACE \
240  { \
241  static const struct _gl_ ## func ## _wrapper \
242  { \
243  typedef rettype (*type) parameters; \
244  inline type rpl () const \
245  { return reinterpret_cast<type>(::func); } \
246  inline operator type () const { return rpl (); }\
247  } func = {}; \
248  } \
249  _GL_EXTERN_C int _gl_cxxalias_dummy
250 #else
251 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
252  _GL_EXTERN_C int _gl_cxxalias_dummy
253 #endif
254 
255 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
256  is like _GL_CXXALIAS_SYS (func, rettype, parameters);
257  except that the C function is picked among a set of overloaded functions,
258  namely the one with rettype2 and parameters2. Two consecutive casts
259  are used to silence the "cannot find a match" and "invalid conversion"
260  errors that would otherwise occur. */
261 #if defined __cplusplus && defined GNULIB_NAMESPACE
262  /* The outer cast must be a reinterpret_cast.
263  The inner cast: When the function is defined as a set of overloaded
264  functions, it works as a static_cast<>, choosing the designated variant.
265  When the function is defined as a single variant, it works as a
266  reinterpret_cast<>. The parenthesized cast syntax works both ways. */
267 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
268  namespace GNULIB_NAMESPACE \
269  { \
270  static const struct _gl_ ## func ## _wrapper \
271  { \
272  typedef rettype (*type) parameters; \
273  \
274  inline type rpl () const \
275  { return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); }\
276  \
277  inline operator type () const { return rpl (); } \
278  } func = {}; \
279  } \
280  _GL_EXTERN_C int _gl_cxxalias_dummy
281 #else
282 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
283  _GL_EXTERN_C int _gl_cxxalias_dummy
284 #endif
285 
286 /* _GL_CXXALIASWARN (func);
287  causes a warning to be emitted when ::func is used but not when
288  GNULIB_NAMESPACE::func is used. func must be defined without overloaded
289  variants. */
290 #if defined __cplusplus && defined GNULIB_NAMESPACE
291 # define _GL_CXXALIASWARN(func) \
292  _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
293 # define _GL_CXXALIASWARN_1(func,namespace) \
294  _GL_CXXALIASWARN_2 (func, namespace)
295 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
296  we enable the warning only when not optimizing. */
297 # if !__OPTIMIZE__
298 # define _GL_CXXALIASWARN_2(func,namespace) \
299  _GL_WARN_ON_USE (func, \
300  "The symbol ::" #func " refers to the system function. " \
301  "Use " #namespace "::" #func " instead.")
302 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
303 # define _GL_CXXALIASWARN_2(func,namespace) \
304  extern __typeof__ (func) func
305 # else
306 # define _GL_CXXALIASWARN_2(func,namespace) \
307  _GL_EXTERN_C int _gl_cxxalias_dummy
308 # endif
309 #else
310 # define _GL_CXXALIASWARN(func) \
311  _GL_EXTERN_C int _gl_cxxalias_dummy
312 #endif
313 
314 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
315  causes a warning to be emitted when the given overloaded variant of ::func
316  is used but not when GNULIB_NAMESPACE::func is used. */
317 #if defined __cplusplus && defined GNULIB_NAMESPACE
318 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
319  _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
320  GNULIB_NAMESPACE)
321 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
322  _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
323 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
324  we enable the warning only when not optimizing. */
325 # if !__OPTIMIZE__
326 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
327  _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
328  "The symbol ::" #func " refers to the system function. " \
329  "Use " #namespace "::" #func " instead.")
330 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
331 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
332  extern __typeof__ (func) func
333 # else
334 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
335  _GL_EXTERN_C int _gl_cxxalias_dummy
336 # endif
337 #else
338 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
339  _GL_EXTERN_C int _gl_cxxalias_dummy
340 #endif
341 
342 #endif /* _GL_CXXDEFS_H */
343 
344 /* The definition of _GL_ARG_NONNULL is copied here. */
345 /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
346  that the values passed as arguments n, ..., m must be non-NULL pointers.
347  n = 1 stands for the first argument, n = 2 for the second argument etc. */
348 #ifndef _GL_ARG_NONNULL
349 # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
350 # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
351 # else
352 # define _GL_ARG_NONNULL(params)
353 # endif
354 #endif
355 
356 /* The definition of _GL_WARN_ON_USE is copied here. */
357 #ifndef _GL_WARN_ON_USE
358 
359 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
360 /* A compiler attribute is available in gcc versions 4.3.0 and later. */
361 # define _GL_WARN_ON_USE(function, message) \
362 extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
363 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
364 /* Verify the existence of the function. */
365 # define _GL_WARN_ON_USE(function, message) \
366 extern __typeof__ (function) function
367 # else /* Unsupported. */
368 # define _GL_WARN_ON_USE(function, message) \
369 _GL_WARN_EXTERN_C int _gl_warn_on_use
370 # endif
371 #endif
372 
373 /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
374  is like _GL_WARN_ON_USE (function, "string"), except that the function is
375  declared with the given prototype, consisting of return type, parameters,
376  and attributes.
377  This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
378  not work in this case. */
379 #ifndef _GL_WARN_ON_USE_CXX
380 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
381 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
382 extern rettype function parameters_and_attributes \
383  __attribute__ ((__warning__ (msg)))
384 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
385 /* Verify the existence of the function. */
386 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
387 extern rettype function parameters_and_attributes
388 # else /* Unsupported. */
389 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
390 _GL_WARN_EXTERN_C int _gl_warn_on_use
391 # endif
392 #endif
393 
394 /* _GL_WARN_EXTERN_C declaration;
395  performs the declaration with C linkage. */
396 #ifndef _GL_WARN_EXTERN_C
397 # if defined __cplusplus
398 # define _GL_WARN_EXTERN_C extern "C"
399 # else
400 # define _GL_WARN_EXTERN_C extern
401 # endif
402 #endif
403 
404 /* Before doing "#define mkdir rpl_mkdir" below, we need to include all
405  headers that may declare mkdir(). Native Windows platforms declare mkdir
406  in <io.h> and/or <direct.h>, not in <unistd.h>. */
407 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
408 # include <io.h> /* mingw32, mingw64 */
409 # include <direct.h> /* mingw64, MSVC 9 */
410 #endif
411 
412 /* Native Windows platforms declare umask() in <io.h>. */
413 #if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
414 # include <io.h>
415 #endif
416 
417 /* Large File Support on native Windows. */
418 #if 0
419 # define stat _stati64
420 #endif
421 
422 #ifndef S_IFIFO
423 # ifdef _S_IFIFO
424 # define S_IFIFO _S_IFIFO
425 # endif
426 #endif
427 
428 #ifndef S_IFMT
429 # define S_IFMT 0170000
430 #endif
431 
432 #if STAT_MACROS_BROKEN
433 # undef S_ISBLK
434 # undef S_ISCHR
435 # undef S_ISDIR
436 # undef S_ISFIFO
437 # undef S_ISLNK
438 # undef S_ISNAM
439 # undef S_ISMPB
440 # undef S_ISMPC
441 # undef S_ISNWK
442 # undef S_ISREG
443 # undef S_ISSOCK
444 #endif
445 
446 #ifndef S_ISBLK
447 # ifdef S_IFBLK
448 # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
449 # else
450 # define S_ISBLK(m) 0
451 # endif
452 #endif
453 
454 #ifndef S_ISCHR
455 # ifdef S_IFCHR
456 # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
457 # else
458 # define S_ISCHR(m) 0
459 # endif
460 #endif
461 
462 #ifndef S_ISDIR
463 # ifdef S_IFDIR
464 # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
465 # else
466 # define S_ISDIR(m) 0
467 # endif
468 #endif
469 
470 #ifndef S_ISDOOR /* Solaris 2.5 and up */
471 # define S_ISDOOR(m) 0
472 #endif
473 
474 #ifndef S_ISFIFO
475 # ifdef S_IFIFO
476 # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
477 # else
478 # define S_ISFIFO(m) 0
479 # endif
480 #endif
481 
482 #ifndef S_ISLNK
483 # ifdef S_IFLNK
484 # define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
485 # else
486 # define S_ISLNK(m) 0
487 # endif
488 #endif
489 
490 #ifndef S_ISMPB /* V7 */
491 # ifdef S_IFMPB
492 # define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
493 # define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
494 # else
495 # define S_ISMPB(m) 0
496 # define S_ISMPC(m) 0
497 # endif
498 #endif
499 
500 #ifndef S_ISMPX /* AIX */
501 # define S_ISMPX(m) 0
502 #endif
503 
504 #ifndef S_ISNAM /* Xenix */
505 # ifdef S_IFNAM
506 # define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
507 # else
508 # define S_ISNAM(m) 0
509 # endif
510 #endif
511 
512 #ifndef S_ISNWK /* HP/UX */
513 # ifdef S_IFNWK
514 # define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
515 # else
516 # define S_ISNWK(m) 0
517 # endif
518 #endif
519 
520 #ifndef S_ISPORT /* Solaris 10 and up */
521 # define S_ISPORT(m) 0
522 #endif
523 
524 #ifndef S_ISREG
525 # ifdef S_IFREG
526 # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
527 # else
528 # define S_ISREG(m) 0
529 # endif
530 #endif
531 
532 #ifndef S_ISSOCK
533 # ifdef S_IFSOCK
534 # define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
535 # else
536 # define S_ISSOCK(m) 0
537 # endif
538 #endif
539 
540 
541 #ifndef S_TYPEISMQ
542 # define S_TYPEISMQ(p) 0
543 #endif
544 
545 #ifndef S_TYPEISTMO
546 # define S_TYPEISTMO(p) 0
547 #endif
548 
549 
550 #ifndef S_TYPEISSEM
551 # ifdef S_INSEM
552 # define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
553 # else
554 # define S_TYPEISSEM(p) 0
555 # endif
556 #endif
557 
558 #ifndef S_TYPEISSHM
559 # ifdef S_INSHD
560 # define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
561 # else
562 # define S_TYPEISSHM(p) 0
563 # endif
564 #endif
565 
566 /* high performance ("contiguous data") */
567 #ifndef S_ISCTG
568 # define S_ISCTG(p) 0
569 #endif
570 
571 /* Cray DMF (data migration facility): off line, with data */
572 #ifndef S_ISOFD
573 # define S_ISOFD(p) 0
574 #endif
575 
576 /* Cray DMF (data migration facility): off line, with no data */
577 #ifndef S_ISOFL
578 # define S_ISOFL(p) 0
579 #endif
580 
581 /* 4.4BSD whiteout */
582 #ifndef S_ISWHT
583 # define S_ISWHT(m) 0
584 #endif
585 
586 /* If any of the following are undefined,
587  define them to their de facto standard values. */
588 #if !S_ISUID
589 # define S_ISUID 04000
590 #endif
591 #if !S_ISGID
592 # define S_ISGID 02000
593 #endif
594 
595 /* S_ISVTX is a common extension to POSIX. */
596 #ifndef S_ISVTX
597 # define S_ISVTX 01000
598 #endif
599 
600 #if !S_IRUSR && S_IREAD
601 # define S_IRUSR S_IREAD
602 #endif
603 #if !S_IRUSR
604 # define S_IRUSR 00400
605 #endif
606 #if !S_IRGRP
607 # define S_IRGRP (S_IRUSR >> 3)
608 #endif
609 #if !S_IROTH
610 # define S_IROTH (S_IRUSR >> 6)
611 #endif
612 
613 #if !S_IWUSR && S_IWRITE
614 # define S_IWUSR S_IWRITE
615 #endif
616 #if !S_IWUSR
617 # define S_IWUSR 00200
618 #endif
619 #if !S_IWGRP
620 # define S_IWGRP (S_IWUSR >> 3)
621 #endif
622 #if !S_IWOTH
623 # define S_IWOTH (S_IWUSR >> 6)
624 #endif
625 
626 #if !S_IXUSR && S_IEXEC
627 # define S_IXUSR S_IEXEC
628 #endif
629 #if !S_IXUSR
630 # define S_IXUSR 00100
631 #endif
632 #if !S_IXGRP
633 # define S_IXGRP (S_IXUSR >> 3)
634 #endif
635 #if !S_IXOTH
636 # define S_IXOTH (S_IXUSR >> 6)
637 #endif
638 
639 #if !S_IRWXU
640 # define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
641 #endif
642 #if !S_IRWXG
643 # define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
644 #endif
645 #if !S_IRWXO
646 # define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
647 #endif
648 
649 /* S_IXUGO is a common extension to POSIX. */
650 #if !S_IXUGO
651 # define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
652 #endif
653 
654 #ifndef S_IRWXUGO
655 # define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
656 #endif
657 
658 /* Macros for futimens and utimensat. */
659 #ifndef UTIME_NOW
660 # define UTIME_NOW (-1)
661 # define UTIME_OMIT (-2)
662 #endif
663 
664 
665 #if 0
666 # if !1
667 _GL_FUNCDECL_SYS (fchmodat, int,
668  (int fd, char const *file, mode_t mode, int flag)
669  _GL_ARG_NONNULL ((2)));
670 # endif
671 _GL_CXXALIAS_SYS (fchmodat, int,
672  (int fd, char const *file, mode_t mode, int flag));
673 _GL_CXXALIASWARN (fchmodat);
674 #elif defined GNULIB_POSIXCHECK
675 # undef fchmodat
676 # if HAVE_RAW_DECL_FCHMODAT
677 _GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
678  "use gnulib module openat for portability");
679 # endif
680 #endif
681 
682 
683 #if 1
684 # if 0
685 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
686 # undef fstat
687 # define fstat rpl_fstat
688 # endif
689 _GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2)));
690 _GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
691 # else
692 _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
693 # endif
694 _GL_CXXALIASWARN (fstat);
695 #elif 0
696 /* Above, we define stat to _stati64. */
697 # define fstat _fstati64
698 #elif defined GNULIB_POSIXCHECK
699 # undef fstat
700 # if HAVE_RAW_DECL_FSTAT
701 _GL_WARN_ON_USE (fstat, "fstat has portability problems - "
702  "use gnulib module fstat for portability");
703 # endif
704 #endif
705 
706 
707 #if 1
708 # if 0
709 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
710 # undef fstatat
711 # define fstatat rpl_fstatat
712 # endif
713 _GL_FUNCDECL_RPL (fstatat, int,
714  (int fd, char const *name, struct stat *st, int flags)
715  _GL_ARG_NONNULL ((2, 3)));
716 _GL_CXXALIAS_RPL (fstatat, int,
717  (int fd, char const *name, struct stat *st, int flags));
718 # else
719 # if !1
720 _GL_FUNCDECL_SYS (fstatat, int,
721  (int fd, char const *name, struct stat *st, int flags)
722  _GL_ARG_NONNULL ((2, 3)));
723 # endif
724 _GL_CXXALIAS_SYS (fstatat, int,
725  (int fd, char const *name, struct stat *st, int flags));
726 # endif
727 _GL_CXXALIASWARN (fstatat);
728 #elif defined GNULIB_POSIXCHECK
729 # undef fstatat
730 # if HAVE_RAW_DECL_FSTATAT
731 _GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
732  "use gnulib module openat for portability");
733 # endif
734 #endif
735 
736 
737 #if 0
738 /* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our futimens
739  implementation relies on futimesat, which on Solaris 10 makes an invocation
740  to futimens that is meant to invoke the libc's futimens(), not gnulib's
741  futimens(). */
742 # if 0 || (!1 && defined __sun)
743 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
744 # undef futimens
745 # define futimens rpl_futimens
746 # endif
747 _GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2]));
748 _GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2]));
749 # else
750 # if !1
751 _GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2]));
752 # endif
753 _GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2]));
754 # endif
755 # if 1
756 _GL_CXXALIASWARN (futimens);
757 # endif
758 #elif defined GNULIB_POSIXCHECK
759 # undef futimens
760 # if HAVE_RAW_DECL_FUTIMENS
761 _GL_WARN_ON_USE (futimens, "futimens is not portable - "
762  "use gnulib module futimens for portability");
763 # endif
764 #endif
765 
766 
767 #if 0
768 /* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
769  denotes a symbolic link. */
770 # if !1
771 /* The lchmod replacement follows symbolic links. Callers should take
772  this into account; lchmod should be applied only to arguments that
773  are known to not be symbolic links. On hosts that lack lchmod,
774  this can lead to race conditions between the check and the
775  invocation of lchmod, but we know of no workarounds that are
776  reliable in general. You might try requesting support for lchmod
777  from your operating system supplier. */
778 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
779 # define lchmod chmod
780 # endif
781 /* Need to cast, because on mingw, the second parameter of chmod is
782  int mode. */
783 _GL_CXXALIAS_RPL_CAST_1 (lchmod, chmod, int,
784  (const char *filename, mode_t mode));
785 # else
786 # if 0 /* assume already declared */
787 _GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode)
788  _GL_ARG_NONNULL ((1)));
789 # endif
790 _GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode));
791 # endif
792 # if 1
793 _GL_CXXALIASWARN (lchmod);
794 # endif
795 #elif defined GNULIB_POSIXCHECK
796 # undef lchmod
797 # if HAVE_RAW_DECL_LCHMOD
798 _GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
799  "use gnulib module lchmod for portability");
800 # endif
801 #endif
802 
803 
804 #if 1
805 # if ! 1
806 /* mingw does not support symlinks, therefore it does not have lstat. But
807  without links, stat does just fine. */
808 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
809 # define lstat stat
810 # endif
811 _GL_CXXALIAS_RPL_1 (lstat, stat, int, (const char *name, struct stat *buf));
812 # elif 0
813 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
814 # undef lstat
815 # define lstat rpl_lstat
816 # endif
817 _GL_FUNCDECL_RPL (lstat, int, (const char *name, struct stat *buf)
818  _GL_ARG_NONNULL ((1, 2)));
819 _GL_CXXALIAS_RPL (lstat, int, (const char *name, struct stat *buf));
820 # else
821 _GL_CXXALIAS_SYS (lstat, int, (const char *name, struct stat *buf));
822 # endif
823 # if 1
824 _GL_CXXALIASWARN (lstat);
825 # endif
826 #elif defined GNULIB_POSIXCHECK
827 # undef lstat
828 # if HAVE_RAW_DECL_LSTAT
829 _GL_WARN_ON_USE (lstat, "lstat is unportable - "
830  "use gnulib module lstat for portability");
831 # endif
832 #endif
833 
834 
835 #if 0
836 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
837 # undef mkdir
838 # define mkdir rpl_mkdir
839 # endif
840 _GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode)
841  _GL_ARG_NONNULL ((1)));
842 _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
843 #else
844 /* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
845  Additionally, it declares _mkdir (and depending on compile flags, an
846  alias mkdir), only in the nonstandard includes <direct.h> and <io.h>,
847  which are included above. */
848 # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
849 
850 # if !GNULIB_defined_rpl_mkdir
851 static int
852 rpl_mkdir (char const *name, mode_t mode)
853 {
854  return _mkdir (name);
855 }
856 # define GNULIB_defined_rpl_mkdir 1
857 # endif
858 
859 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
860 # define mkdir rpl_mkdir
861 # endif
862 _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
863 # else
864 _GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
865 # endif
866 #endif
867 _GL_CXXALIASWARN (mkdir);
868 
869 
870 #if 0
871 # if !1
872 _GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)
873  _GL_ARG_NONNULL ((2)));
874 # endif
875 _GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode));
876 _GL_CXXALIASWARN (mkdirat);
877 #elif defined GNULIB_POSIXCHECK
878 # undef mkdirat
879 # if HAVE_RAW_DECL_MKDIRAT
880 _GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
881  "use gnulib module openat for portability");
882 # endif
883 #endif
884 
885 
886 #if 0
887 # if 0
888 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
889 # undef mkfifo
890 # define mkfifo rpl_mkfifo
891 # endif
892 _GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode)
893  _GL_ARG_NONNULL ((1)));
894 _GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode));
895 # else
896 # if !1
897 _GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode)
898  _GL_ARG_NONNULL ((1)));
899 # endif
900 _GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode));
901 # endif
902 _GL_CXXALIASWARN (mkfifo);
903 #elif defined GNULIB_POSIXCHECK
904 # undef mkfifo
905 # if HAVE_RAW_DECL_MKFIFO
906 _GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
907  "use gnulib module mkfifo for portability");
908 # endif
909 #endif
910 
911 
912 #if 0
913 # if !1
914 _GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)
915  _GL_ARG_NONNULL ((2)));
916 # endif
917 _GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode));
918 _GL_CXXALIASWARN (mkfifoat);
919 #elif defined GNULIB_POSIXCHECK
920 # undef mkfifoat
921 # if HAVE_RAW_DECL_MKFIFOAT
922 _GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
923  "use gnulib module mkfifoat for portability");
924 # endif
925 #endif
926 
927 
928 #if 0
929 # if 0
930 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
931 # undef mknod
932 # define mknod rpl_mknod
933 # endif
934 _GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)
935  _GL_ARG_NONNULL ((1)));
936 _GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev));
937 # else
938 # if !1
939 _GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev)
940  _GL_ARG_NONNULL ((1)));
941 # endif
942 /* Need to cast, because on OSF/1 5.1, the third parameter is '...'. */
943 _GL_CXXALIAS_SYS_CAST (mknod, int, (char const *file, mode_t mode, dev_t dev));
944 # endif
945 _GL_CXXALIASWARN (mknod);
946 #elif defined GNULIB_POSIXCHECK
947 # undef mknod
948 # if HAVE_RAW_DECL_MKNOD
949 _GL_WARN_ON_USE (mknod, "mknod is not portable - "
950  "use gnulib module mknod for portability");
951 # endif
952 #endif
953 
954 
955 #if 0
956 # if !1
957 _GL_FUNCDECL_SYS (mknodat, int,
958  (int fd, char const *file, mode_t mode, dev_t dev)
959  _GL_ARG_NONNULL ((2)));
960 # endif
961 _GL_CXXALIAS_SYS (mknodat, int,
962  (int fd, char const *file, mode_t mode, dev_t dev));
963 _GL_CXXALIASWARN (mknodat);
964 #elif defined GNULIB_POSIXCHECK
965 # undef mknodat
966 # if HAVE_RAW_DECL_MKNODAT
967 _GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
968  "use gnulib module mkfifoat for portability");
969 # endif
970 #endif
971 
972 
973 #if 1
974 # if 0
975 /* We can't use the object-like #define stat rpl_stat, because of
976  struct stat. This means that rpl_stat will not be used if the user
977  does (stat)(a,b). Oh well. */
978 # if defined _AIX && defined stat && defined _LARGE_FILES
979  /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
980  so we have to replace stat64() instead of stat(). */
981 # undef stat64
982 # define stat64(name, st) rpl_stat (name, st)
983 # elif 0
984  /* Above, we define stat to _stati64. */
985 # if defined __MINGW32__ && defined _stati64
986 # ifndef _USE_32BIT_TIME_T
987  /* The system headers define _stati64 to _stat64. */
988 # undef _stat64
989 # define _stat64(name, st) rpl_stat (name, st)
990 # endif
991 # elif defined _MSC_VER && defined _stati64
992 # ifdef _USE_32BIT_TIME_T
993  /* The system headers define _stati64 to _stat32i64. */
994 # undef _stat32i64
995 # define _stat32i64(name, st) rpl_stat (name, st)
996 # else
997  /* The system headers define _stati64 to _stat64. */
998 # undef _stat64
999 # define _stat64(name, st) rpl_stat (name, st)
1000 # endif
1001 # else
1002 # undef _stati64
1003 # define _stati64(name, st) rpl_stat (name, st)
1004 # endif
1005 # elif defined __MINGW32__ && defined stat
1006 # ifdef _USE_32BIT_TIME_T
1007  /* The system headers define stat to _stat32i64. */
1008 # undef _stat32i64
1009 # define _stat32i64(name, st) rpl_stat (name, st)
1010 # else
1011  /* The system headers define stat to _stat64. */
1012 # undef _stat64
1013 # define _stat64(name, st) rpl_stat (name, st)
1014 # endif
1015 # elif defined _MSC_VER && defined stat
1016 # ifdef _USE_32BIT_TIME_T
1017  /* The system headers define stat to _stat32. */
1018 # undef _stat32
1019 # define _stat32(name, st) rpl_stat (name, st)
1020 # else
1021  /* The system headers define stat to _stat64i32. */
1022 # undef _stat64i32
1023 # define _stat64i32(name, st) rpl_stat (name, st)
1024 # endif
1025 # else /* !(_AIX ||__MINGW32__ || _MSC_VER) */
1026 # undef stat
1027 # define stat(name, st) rpl_stat (name, st)
1028 # endif /* !_LARGE_FILES */
1029 _GL_EXTERN_C int stat (const char *name, struct stat *buf)
1030  _GL_ARG_NONNULL ((1, 2));
1031 # endif
1032 #elif defined GNULIB_POSIXCHECK
1033 # undef stat
1034 # if HAVE_RAW_DECL_STAT
1035 _GL_WARN_ON_USE (stat, "stat is unportable - "
1036  "use gnulib module stat for portability");
1037 # endif
1038 #endif
1039 
1040 
1041 #if 0
1042 /* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat
1043  implementation relies on futimesat, which on Solaris 10 makes an invocation
1044  to utimensat that is meant to invoke the libc's utimensat(), not gnulib's
1045  utimensat(). */
1046 # if 0 || (!1 && defined __sun)
1047 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1048 # undef utimensat
1049 # define utimensat rpl_utimensat
1050 # endif
1051 _GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name,
1052  struct timespec const times[2], int flag)
1053  _GL_ARG_NONNULL ((2)));
1054 _GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name,
1055  struct timespec const times[2], int flag));
1056 # else
1057 # if !1
1058 _GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name,
1059  struct timespec const times[2], int flag)
1060  _GL_ARG_NONNULL ((2)));
1061 # endif
1062 _GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name,
1063  struct timespec const times[2], int flag));
1064 # endif
1065 # if 1
1066 _GL_CXXALIASWARN (utimensat);
1067 # endif
1068 #elif defined GNULIB_POSIXCHECK
1069 # undef utimensat
1070 # if HAVE_RAW_DECL_UTIMENSAT
1071 _GL_WARN_ON_USE (utimensat, "utimensat is not portable - "
1072  "use gnulib module utimensat for portability");
1073 # endif
1074 #endif
1075 
1076 
1077 #endif /* _GL_SYS_STAT_H */
1078 #endif /* _GL_SYS_STAT_H */
1079 #endif
#define _GL_CXXALIAS_RPL(func, rettype, parameters)
Definition: stat.h:163
const char * name
Definition: tracepoint.c:180
#define _GL_WARN_ON_USE(function, message)
Definition: stat.h:368
#define _GL_ARG_NONNULL(params)
Definition: stat.h:352
#define _GL_CXXALIAS_SYS_CAST(func, rettype, parameters)
Definition: stat.h:251
#define _GL_FUNCDECL_SYS(func, rettype, parameters_and_attributes)
Definition: stat.h:151
#define _GL_CXXALIAS_SYS(func, rettype, parameters)
Definition: stat.h:228
#define _GL_EXTERN_C
Definition: stat.h:129
#define _GL_CXXALIAS_RPL_1(func, rpl_func, rettype, parameters)
Definition: stat.h:178
#define _GL_CXXALIAS_RPL_CAST_1(func, rpl_func, rettype, parameters)
Definition: stat.h:201
#define _GL_CXXALIASWARN(func)
Definition: stat.h:310
#define _GL_FUNCDECL_RPL(func, rettype, parameters_and_attributes)
Definition: stat.h:139