1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 2 /* -*- buffer-read-only: t -*- vi: set ro: */ 3 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 4 /* Provide a more complete sys/stat header file. 5 Copyright (C) 2005-2010 Free Software Foundation, Inc. 6 7 This program is free software; you can redistribute it and/or modify 8 it under the terms of the GNU General Public License as published by 9 the Free Software Foundation; either version 3, or (at your option) 10 any later version. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with this program; if not, write to the Free Software Foundation, 19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ 20 21 /* Written by Eric Blake, Paul Eggert, and Jim Meyering. */ 22 23 /* This file is supposed to be used on platforms where <sys/stat.h> is 24 incomplete. It is intended to provide definitions and prototypes 25 needed by an application. Start with what the system provides. */ 26 27 #if __GNUC__ >= 3 28 #pragma GCC system_header 29 #endif 30 31 #if defined __need_system_sys_stat_h 32 /* Special invocation convention. */ 33 34 #include_next <sys/stat.h> 35 36 #else 37 /* Normal invocation convention. */ 38 39 #ifndef _GL_SYS_STAT_H 40 41 /* Get nlink_t. */ 42 #include <sys/types.h> 43 44 /* Get struct timespec. */ 45 #include <time.h> 46 47 /* The include_next requires a split double-inclusion guard. */ 48 #include_next <sys/stat.h> 49 50 #ifndef _GL_SYS_STAT_H 51 #define _GL_SYS_STAT_H 52 53 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 54 #ifndef _GL_CXXDEFS_H 55 #define _GL_CXXDEFS_H 56 57 /* The three most frequent use cases of these macros are: 58 59 * For providing a substitute for a function that is missing on some 60 platforms, but is declared and works fine on the platforms on which 61 it exists: 62 63 #if @GNULIB_FOO@ 64 # if !@HAVE_FOO@ 65 _GL_FUNCDECL_SYS (foo, ...); 66 # endif 67 _GL_CXXALIAS_SYS (foo, ...); 68 _GL_CXXALIASWARN (foo); 69 #elif defined GNULIB_POSIXCHECK 70 ... 71 #endif 72 73 * For providing a replacement for a function that exists on all platforms, 74 but is broken/insufficient and needs to be replaced on some platforms: 75 76 #if @GNULIB_FOO@ 77 # if @REPLACE_FOO@ 78 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 79 # undef foo 80 # define foo rpl_foo 81 # endif 82 _GL_FUNCDECL_RPL (foo, ...); 83 _GL_CXXALIAS_RPL (foo, ...); 84 # else 85 _GL_CXXALIAS_SYS (foo, ...); 86 # endif 87 _GL_CXXALIASWARN (foo); 88 #elif defined GNULIB_POSIXCHECK 89 ... 90 #endif 91 92 * For providing a replacement for a function that exists on some platforms 93 but is broken/insufficient and needs to be replaced on some of them and 94 is additionally either missing or undeclared on some other platforms: 95 96 #if @GNULIB_FOO@ 97 # if @REPLACE_FOO@ 98 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 99 # undef foo 100 # define foo rpl_foo 101 # endif 102 _GL_FUNCDECL_RPL (foo, ...); 103 _GL_CXXALIAS_RPL (foo, ...); 104 # else 105 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ 106 _GL_FUNCDECL_SYS (foo, ...); 107 # endif 108 _GL_CXXALIAS_SYS (foo, ...); 109 # endif 110 _GL_CXXALIASWARN (foo); 111 #elif defined GNULIB_POSIXCHECK 112 ... 113 #endif 114 */ 115 116 /* _GL_EXTERN_C declaration; 117 performs the declaration with C linkage. */ 118 #if defined __cplusplus 119 # define _GL_EXTERN_C extern "C" 120 #else 121 # define _GL_EXTERN_C extern 122 #endif 123 124 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); 125 declares a replacement function, named rpl_func, with the given prototype, 126 consisting of return type, parameters, and attributes. 127 Example: 128 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) 129 _GL_ARG_NONNULL ((1))); 130 */ 131 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ 132 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) 133 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ 134 _GL_EXTERN_C rettype rpl_func parameters_and_attributes 135 136 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); 137 declares the system function, named func, with the given prototype, 138 consisting of return type, parameters, and attributes. 139 Example: 140 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) 141 _GL_ARG_NONNULL ((1))); 142 */ 143 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ 144 _GL_EXTERN_C rettype func parameters_and_attributes 145 146 /* _GL_CXXALIAS_RPL (func, rettype, parameters); 147 declares a C++ alias called GNULIB_NAMESPACE::func 148 that redirects to rpl_func, if GNULIB_NAMESPACE is defined. 149 Example: 150 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); 151 */ 152 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ 153 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) 154 #if defined __cplusplus && defined GNULIB_NAMESPACE 155 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 156 namespace GNULIB_NAMESPACE \ 157 { \ 158 rettype (*const func) parameters = ::rpl_func; \ 159 } \ 160 _GL_EXTERN_C int _gl_cxxalias_dummy 161 #else 162 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 163 _GL_EXTERN_C int _gl_cxxalias_dummy 164 #endif 165 166 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); 167 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); 168 except that the C function rpl_func may have a slightly different 169 declaration. A cast is used to silence the "invalid conversion" error 170 that would otherwise occur. */ 171 #if defined __cplusplus && defined GNULIB_NAMESPACE 172 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 173 namespace GNULIB_NAMESPACE \ 174 { \ 175 rettype (*const func) parameters = \ 176 reinterpret_cast<rettype(*)parameters>(::rpl_func); \ 177 } \ 178 _GL_EXTERN_C int _gl_cxxalias_dummy 179 #else 180 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 181 _GL_EXTERN_C int _gl_cxxalias_dummy 182 #endif 183 184 /* _GL_CXXALIAS_SYS (func, rettype, parameters); 185 declares a C++ alias called GNULIB_NAMESPACE::func 186 that redirects to the system provided function func, if GNULIB_NAMESPACE 187 is defined. 188 Example: 189 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); 190 */ 191 #if defined __cplusplus && defined GNULIB_NAMESPACE 192 /* If we were to write 193 rettype (*const func) parameters = ::func; 194 like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls 195 better (remove an indirection through a 'static' pointer variable), 196 but then the _GL_CXXALIASWARN macro below would cause a warning not only 197 for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */ 198 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 199 namespace GNULIB_NAMESPACE \ 200 { \ 201 static rettype (*func) parameters = ::func; \ 202 } \ 203 _GL_EXTERN_C int _gl_cxxalias_dummy 204 #else 205 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 206 _GL_EXTERN_C int _gl_cxxalias_dummy 207 #endif 208 209 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); 210 is like _GL_CXXALIAS_SYS (func, rettype, parameters); 211 except that the C function func may have a slightly different declaration. 212 A cast is used to silence the "invalid conversion" error that would 213 otherwise occur. */ 214 #if defined __cplusplus && defined GNULIB_NAMESPACE 215 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 216 namespace GNULIB_NAMESPACE \ 217 { \ 218 static rettype (*func) parameters = \ 219 reinterpret_cast<rettype(*)parameters>(::func); \ 220 } \ 221 _GL_EXTERN_C int _gl_cxxalias_dummy 222 #else 223 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 224 _GL_EXTERN_C int _gl_cxxalias_dummy 225 #endif 226 227 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); 228 is like _GL_CXXALIAS_SYS (func, rettype, parameters); 229 except that the C function is picked among a set of overloaded functions, 230 namely the one with rettype2 and parameters2. Two consecutive casts 231 are used to silence the "cannot find a match" and "invalid conversion" 232 errors that would otherwise occur. */ 233 #if defined __cplusplus && defined GNULIB_NAMESPACE 234 /* The outer cast must be a reinterpret_cast. 235 The inner cast: When the function is defined as a set of overloaded 236 functions, it works as a static_cast<>, choosing the designated variant. 237 When the function is defined as a single variant, it works as a 238 reinterpret_cast<>. The parenthesized cast syntax works both ways. */ 239 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 240 namespace GNULIB_NAMESPACE \ 241 { \ 242 static rettype (*func) parameters = \ 243 reinterpret_cast<rettype(*)parameters>( \ 244 (rettype2(*)parameters2)(::func)); \ 245 } \ 246 _GL_EXTERN_C int _gl_cxxalias_dummy 247 #else 248 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 249 _GL_EXTERN_C int _gl_cxxalias_dummy 250 #endif 251 252 /* _GL_CXXALIASWARN (func); 253 causes a warning to be emitted when ::func is used but not when 254 GNULIB_NAMESPACE::func is used. func must be defined without overloaded 255 variants. */ 256 #if defined __cplusplus && defined GNULIB_NAMESPACE 257 # define _GL_CXXALIASWARN(func) \ 258 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) 259 # define _GL_CXXALIASWARN_1(func,namespace) \ 260 _GL_CXXALIASWARN_2 (func, namespace) 261 # define _GL_CXXALIASWARN_2(func,namespace) \ 262 _GL_WARN_ON_USE (func, \ 263 "The symbol ::" #func " refers to the system function. " \ 264 "Use " #namespace "::" #func " instead.") 265 #else 266 # define _GL_CXXALIASWARN(func) \ 267 _GL_EXTERN_C int _gl_cxxalias_dummy 268 #endif 269 270 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); 271 causes a warning to be emitted when the given overloaded variant of ::func 272 is used but not when GNULIB_NAMESPACE::func is used. */ 273 #if defined __cplusplus && defined GNULIB_NAMESPACE 274 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 275 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ 276 GNULIB_NAMESPACE) 277 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ 278 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) 279 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 280 _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ 281 "The symbol ::" #func " refers to the system function. " \ 282 "Use " #namespace "::" #func " instead.") 283 #else 284 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 285 _GL_EXTERN_C int _gl_cxxalias_dummy 286 #endif 287 288 #endif /* _GL_CXXDEFS_H */ 289 290 /* The definition of _GL_ARG_NONNULL is copied here. */ 291 /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools 292 that the values passed as arguments n, ..., m must be non-NULL pointers. 293 n = 1 stands for the first argument, n = 2 for the second argument etc. */ 294 #ifndef _GL_ARG_NONNULL 295 # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 296 # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) 297 # else 298 # define _GL_ARG_NONNULL(params) 299 # endif 300 #endif 301 302 /* The definition of _GL_WARN_ON_USE is copied here. */ 303 #ifndef _GL_WARN_ON_USE 304 305 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 306 /* A compiler attribute is available in gcc versions 4.3.0 and later. */ 307 # define _GL_WARN_ON_USE(function, message) \ 308 extern __typeof__ (function) function __attribute__ ((__warning__ (message))) 309 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 310 /* Verify the existence of the function. */ 311 # define _GL_WARN_ON_USE(function, message) \ 312 extern __typeof__ (function) function 313 # else /* Unsupported. */ 314 # define _GL_WARN_ON_USE(function, message) \ 315 _GL_WARN_EXTERN_C int _gl_warn_on_use 316 # endif 317 #endif 318 319 /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") 320 is like _GL_WARN_ON_USE (function, "string"), except that the function is 321 declared with the given prototype, consisting of return type, parameters, 322 and attributes. 323 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does 324 not work in this case. */ 325 #ifndef _GL_WARN_ON_USE_CXX 326 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 327 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 328 extern rettype function parameters_and_attributes \ 329 __attribute__ ((__warning__ (msg))) 330 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 331 /* Verify the existence of the function. */ 332 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 333 extern rettype function parameters_and_attributes 334 # else /* Unsupported. */ 335 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 336 _GL_WARN_EXTERN_C int _gl_warn_on_use 337 # endif 338 #endif 339 340 /* _GL_WARN_EXTERN_C declaration; 341 performs the declaration with C linkage. */ 342 #ifndef _GL_WARN_EXTERN_C 343 # if defined __cplusplus 344 # define _GL_WARN_EXTERN_C extern "C" 345 # else 346 # define _GL_WARN_EXTERN_C extern 347 # endif 348 #endif 349 350 /* Before doing "#define mkdir rpl_mkdir" below, we need to include all 351 headers that may declare mkdir(). */ 352 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ 353 # include <io.h> /* mingw32, mingw64 */ 354 # include <direct.h> /* mingw64 */ 355 #endif 356 357 #ifndef S_IFMT 358 # define S_IFMT 0170000 359 #endif 360 361 #if STAT_MACROS_BROKEN 362 # undef S_ISBLK 363 # undef S_ISCHR 364 # undef S_ISDIR 365 # undef S_ISFIFO 366 # undef S_ISLNK 367 # undef S_ISNAM 368 # undef S_ISMPB 369 # undef S_ISMPC 370 # undef S_ISNWK 371 # undef S_ISREG 372 # undef S_ISSOCK 373 #endif 374 375 #ifndef S_ISBLK 376 # ifdef S_IFBLK 377 # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) 378 # else 379 # define S_ISBLK(m) 0 380 # endif 381 #endif 382 383 #ifndef S_ISCHR 384 # ifdef S_IFCHR 385 # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) 386 # else 387 # define S_ISCHR(m) 0 388 # endif 389 #endif 390 391 #ifndef S_ISDIR 392 # ifdef S_IFDIR 393 # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) 394 # else 395 # define S_ISDIR(m) 0 396 # endif 397 #endif 398 399 #ifndef S_ISDOOR /* Solaris 2.5 and up */ 400 # define S_ISDOOR(m) 0 401 #endif 402 403 #ifndef S_ISFIFO 404 # ifdef S_IFIFO 405 # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) 406 # else 407 # define S_ISFIFO(m) 0 408 # endif 409 #endif 410 411 #ifndef S_ISLNK 412 # ifdef S_IFLNK 413 # define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) 414 # else 415 # define S_ISLNK(m) 0 416 # endif 417 #endif 418 419 #ifndef S_ISMPB /* V7 */ 420 # ifdef S_IFMPB 421 # define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) 422 # define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC) 423 # else 424 # define S_ISMPB(m) 0 425 # define S_ISMPC(m) 0 426 # endif 427 #endif 428 429 #ifndef S_ISNAM /* Xenix */ 430 # ifdef S_IFNAM 431 # define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM) 432 # else 433 # define S_ISNAM(m) 0 434 # endif 435 #endif 436 437 #ifndef S_ISNWK /* HP/UX */ 438 # ifdef S_IFNWK 439 # define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK) 440 # else 441 # define S_ISNWK(m) 0 442 # endif 443 #endif 444 445 #ifndef S_ISPORT /* Solaris 10 and up */ 446 # define S_ISPORT(m) 0 447 #endif 448 449 #ifndef S_ISREG 450 # ifdef S_IFREG 451 # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) 452 # else 453 # define S_ISREG(m) 0 454 # endif 455 #endif 456 457 #ifndef S_ISSOCK 458 # ifdef S_IFSOCK 459 # define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) 460 # else 461 # define S_ISSOCK(m) 0 462 # endif 463 #endif 464 465 466 #ifndef S_TYPEISMQ 467 # define S_TYPEISMQ(p) 0 468 #endif 469 470 #ifndef S_TYPEISTMO 471 # define S_TYPEISTMO(p) 0 472 #endif 473 474 475 #ifndef S_TYPEISSEM 476 # ifdef S_INSEM 477 # define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM) 478 # else 479 # define S_TYPEISSEM(p) 0 480 # endif 481 #endif 482 483 #ifndef S_TYPEISSHM 484 # ifdef S_INSHD 485 # define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD) 486 # else 487 # define S_TYPEISSHM(p) 0 488 # endif 489 #endif 490 491 /* high performance ("contiguous data") */ 492 #ifndef S_ISCTG 493 # define S_ISCTG(p) 0 494 #endif 495 496 /* Cray DMF (data migration facility): off line, with data */ 497 #ifndef S_ISOFD 498 # define S_ISOFD(p) 0 499 #endif 500 501 /* Cray DMF (data migration facility): off line, with no data */ 502 #ifndef S_ISOFL 503 # define S_ISOFL(p) 0 504 #endif 505 506 /* 4.4BSD whiteout */ 507 #ifndef S_ISWHT 508 # define S_ISWHT(m) 0 509 #endif 510 511 /* If any of the following are undefined, 512 define them to their de facto standard values. */ 513 #if !S_ISUID 514 # define S_ISUID 04000 515 #endif 516 #if !S_ISGID 517 # define S_ISGID 02000 518 #endif 519 520 /* S_ISVTX is a common extension to POSIX. */ 521 #ifndef S_ISVTX 522 # define S_ISVTX 01000 523 #endif 524 525 #if !S_IRUSR && S_IREAD 526 # define S_IRUSR S_IREAD 527 #endif 528 #if !S_IRUSR 529 # define S_IRUSR 00400 530 #endif 531 #if !S_IRGRP 532 # define S_IRGRP (S_IRUSR >> 3) 533 #endif 534 #if !S_IROTH 535 # define S_IROTH (S_IRUSR >> 6) 536 #endif 537 538 #if !S_IWUSR && S_IWRITE 539 # define S_IWUSR S_IWRITE 540 #endif 541 #if !S_IWUSR 542 # define S_IWUSR 00200 543 #endif 544 #if !S_IWGRP 545 # define S_IWGRP (S_IWUSR >> 3) 546 #endif 547 #if !S_IWOTH 548 # define S_IWOTH (S_IWUSR >> 6) 549 #endif 550 551 #if !S_IXUSR && S_IEXEC 552 # define S_IXUSR S_IEXEC 553 #endif 554 #if !S_IXUSR 555 # define S_IXUSR 00100 556 #endif 557 #if !S_IXGRP 558 # define S_IXGRP (S_IXUSR >> 3) 559 #endif 560 #if !S_IXOTH 561 # define S_IXOTH (S_IXUSR >> 6) 562 #endif 563 564 #if !S_IRWXU 565 # define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) 566 #endif 567 #if !S_IRWXG 568 # define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP) 569 #endif 570 #if !S_IRWXO 571 # define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH) 572 #endif 573 574 /* S_IXUGO is a common extension to POSIX. */ 575 #if !S_IXUGO 576 # define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH) 577 #endif 578 579 #ifndef S_IRWXUGO 580 # define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO) 581 #endif 582 583 /* Macros for futimens and utimensat. */ 584 #ifndef UTIME_NOW 585 # define UTIME_NOW (-1) 586 # define UTIME_OMIT (-2) 587 #endif 588 589 590 #if 0 591 # if !1 592 _GL_FUNCDECL_SYS (fchmodat, int, 593 (int fd, char const *file, mode_t mode, int flag) 594 _GL_ARG_NONNULL ((2))); 595 # endif 596 _GL_CXXALIAS_SYS (fchmodat, int, 597 (int fd, char const *file, mode_t mode, int flag)); 598 _GL_CXXALIASWARN (fchmodat); 599 #elif defined GNULIB_POSIXCHECK 600 # undef fchmodat 601 # if HAVE_RAW_DECL_FCHMODAT 602 _GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - " 603 "use gnulib module openat for portability"); 604 # endif 605 #endif 606 607 608 #if 0 609 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 610 # define fstat rpl_fstat 611 # endif 612 _GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2))); 613 _GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf)); 614 #else 615 _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf)); 616 #endif 617 _GL_CXXALIASWARN (fstat); 618 619 620 #if 0 621 # if 0 622 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 623 # undef fstatat 624 # define fstatat rpl_fstatat 625 # endif 626 _GL_FUNCDECL_RPL (fstatat, int, 627 (int fd, char const *name, struct stat *st, int flags) 628 _GL_ARG_NONNULL ((2, 3))); 629 _GL_CXXALIAS_RPL (fstatat, int, 630 (int fd, char const *name, struct stat *st, int flags)); 631 # else 632 # if !1 633 _GL_FUNCDECL_SYS (fstatat, int, 634 (int fd, char const *name, struct stat *st, int flags) 635 _GL_ARG_NONNULL ((2, 3))); 636 # endif 637 _GL_CXXALIAS_SYS (fstatat, int, 638 (int fd, char const *name, struct stat *st, int flags)); 639 # endif 640 _GL_CXXALIASWARN (fstatat); 641 #elif defined GNULIB_POSIXCHECK 642 # undef fstatat 643 # if HAVE_RAW_DECL_FSTATAT 644 _GL_WARN_ON_USE (fstatat, "fstatat is not portable - " 645 "use gnulib module openat for portability"); 646 # endif 647 #endif 648 649 650 #if 0 651 # if 0 652 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 653 # undef futimens 654 # define futimens rpl_futimens 655 # endif 656 _GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2])); 657 _GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2])); 658 # else 659 # if !1 660 _GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2])); 661 # endif 662 _GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2])); 663 # endif 664 _GL_CXXALIASWARN (futimens); 665 #elif defined GNULIB_POSIXCHECK 666 # undef futimens 667 # if HAVE_RAW_DECL_FUTIMENS 668 _GL_WARN_ON_USE (futimens, "futimens is not portable - " 669 "use gnulib module futimens for portability"); 670 # endif 671 #endif 672 673 674 #if 0 675 /* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME 676 denotes a symbolic link. */ 677 # if !1 678 /* The lchmod replacement follows symbolic links. Callers should take 679 this into account; lchmod should be applied only to arguments that 680 are known to not be symbolic links. On hosts that lack lchmod, 681 this can lead to race conditions between the check and the 682 invocation of lchmod, but we know of no workarounds that are 683 reliable in general. You might try requesting support for lchmod 684 from your operating system supplier. */ 685 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 686 # define lchmod chmod 687 # endif 688 /* Need to cast, because on mingw, the second parameter of chmod is 689 int mode. */ 690 _GL_CXXALIAS_RPL_CAST_1 (lchmod, chmod, int, 691 (const char *filename, mode_t mode)); 692 # else 693 # if 0 /* assume already declared */ 694 _GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode) 695 _GL_ARG_NONNULL ((1))); 696 # endif 697 _GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode)); 698 # endif 699 # if 1 700 _GL_CXXALIASWARN (lchmod); 701 # endif 702 #elif defined GNULIB_POSIXCHECK 703 # undef lchmod 704 # if HAVE_RAW_DECL_LCHMOD 705 _GL_WARN_ON_USE (lchmod, "lchmod is unportable - " 706 "use gnulib module lchmod for portability"); 707 # endif 708 #endif 709 710 711 #if 1 712 # if ! 1 713 /* mingw does not support symlinks, therefore it does not have lstat. But 714 without links, stat does just fine. */ 715 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 716 # define lstat stat 717 # endif 718 _GL_CXXALIAS_RPL_1 (lstat, stat, int, (const char *name, struct stat *buf)); 719 # elif 0 720 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 721 # undef lstat 722 # define lstat rpl_lstat 723 # endif 724 _GL_FUNCDECL_RPL (lstat, int, (const char *name, struct stat *buf) 725 _GL_ARG_NONNULL ((1, 2))); 726 _GL_CXXALIAS_RPL (lstat, int, (const char *name, struct stat *buf)); 727 # else 728 _GL_CXXALIAS_SYS (lstat, int, (const char *name, struct stat *buf)); 729 # endif 730 # if 1 731 _GL_CXXALIASWARN (lstat); 732 # endif 733 #elif defined GNULIB_POSIXCHECK 734 # undef lstat 735 # if HAVE_RAW_DECL_LSTAT 736 _GL_WARN_ON_USE (lstat, "lstat is unportable - " 737 "use gnulib module lstat for portability"); 738 # endif 739 #endif 740 741 742 #if 0 743 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 744 # undef mkdir 745 # define mkdir rpl_mkdir 746 # endif 747 _GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode) 748 _GL_ARG_NONNULL ((1))); 749 _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode)); 750 #else 751 /* mingw's _mkdir() function has 1 argument, but we pass 2 arguments. 752 Additionally, it declares _mkdir (and depending on compile flags, an 753 alias mkdir), only in the nonstandard includes <direct.h> and <io.h>, 754 which are included above. */ 755 # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ 756 757 static inline int 758 rpl_mkdir (char const *name, mode_t mode) 759 { 760 return _mkdir (name); 761 } 762 763 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 764 # define mkdir rpl_mkdir 765 # endif 766 _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode)); 767 # else 768 _GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode)); 769 # endif 770 #endif 771 _GL_CXXALIASWARN (mkdir); 772 773 774 #if 0 775 # if !1 776 _GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode) 777 _GL_ARG_NONNULL ((2))); 778 # endif 779 _GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)); 780 _GL_CXXALIASWARN (mkdirat); 781 #elif defined GNULIB_POSIXCHECK 782 # undef mkdirat 783 # if HAVE_RAW_DECL_MKDIRAT 784 _GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - " 785 "use gnulib module openat for portability"); 786 # endif 787 #endif 788 789 790 #if 0 791 # if 0 792 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 793 # undef mkfifo 794 # define mkfifo rpl_mkfifo 795 # endif 796 _GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode) 797 _GL_ARG_NONNULL ((1))); 798 _GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode)); 799 # else 800 # if !1 801 _GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode) 802 _GL_ARG_NONNULL ((1))); 803 # endif 804 _GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode)); 805 # endif 806 _GL_CXXALIASWARN (mkfifo); 807 #elif defined GNULIB_POSIXCHECK 808 # undef mkfifo 809 # if HAVE_RAW_DECL_MKFIFO 810 _GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - " 811 "use gnulib module mkfifo for portability"); 812 # endif 813 #endif 814 815 816 #if 0 817 # if !1 818 _GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode) 819 _GL_ARG_NONNULL ((2))); 820 # endif 821 _GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)); 822 _GL_CXXALIASWARN (mkfifoat); 823 #elif defined GNULIB_POSIXCHECK 824 # undef mkfifoat 825 # if HAVE_RAW_DECL_MKFIFOAT 826 _GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - " 827 "use gnulib module mkfifoat for portability"); 828 # endif 829 #endif 830 831 832 #if 0 833 # if 0 834 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 835 # undef mknod 836 # define mknod rpl_mknod 837 # endif 838 _GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev) 839 _GL_ARG_NONNULL ((1))); 840 _GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)); 841 # else 842 # if !1 843 _GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev) 844 _GL_ARG_NONNULL ((1))); 845 # endif 846 _GL_CXXALIAS_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev)); 847 # endif 848 _GL_CXXALIASWARN (mknod); 849 #elif defined GNULIB_POSIXCHECK 850 # undef mknod 851 # if HAVE_RAW_DECL_MKNOD 852 _GL_WARN_ON_USE (mknod, "mknod is not portable - " 853 "use gnulib module mknod for portability"); 854 # endif 855 #endif 856 857 858 #if 0 859 # if !1 860 _GL_FUNCDECL_SYS (mknodat, int, 861 (int fd, char const *file, mode_t mode, dev_t dev) 862 _GL_ARG_NONNULL ((2))); 863 # endif 864 _GL_CXXALIAS_SYS (mknodat, int, 865 (int fd, char const *file, mode_t mode, dev_t dev)); 866 _GL_CXXALIASWARN (mknodat); 867 #elif defined GNULIB_POSIXCHECK 868 # undef mknodat 869 # if HAVE_RAW_DECL_MKNODAT 870 _GL_WARN_ON_USE (mknodat, "mknodat is not portable - " 871 "use gnulib module mkfifoat for portability"); 872 # endif 873 #endif 874 875 876 #if 1 877 # if 0 878 /* We can't use the object-like #define stat rpl_stat, because of 879 struct stat. This means that rpl_stat will not be used if the user 880 does (stat)(a,b). Oh well. */ 881 # undef stat 882 # ifdef _LARGE_FILES 883 /* With _LARGE_FILES defined, AIX (only) defines stat to stat64, 884 so we have to replace stat64() instead of stat(). */ 885 # define stat stat64 886 # undef stat64 887 # define stat64(name, st) rpl_stat (name, st) 888 # else /* !_LARGE_FILES */ 889 # define stat(name, st) rpl_stat (name, st) 890 # endif /* !_LARGE_FILES */ 891 _GL_EXTERN_C int stat (const char *name, struct stat *buf) _GL_ARG_NONNULL ((1, 2)); 892 # endif 893 #elif defined GNULIB_POSIXCHECK 894 # undef stat 895 # if HAVE_RAW_DECL_STAT 896 _GL_WARN_ON_USE (stat, "stat is unportable - " 897 "use gnulib module stat for portability"); 898 # endif 899 #endif 900 901 902 #if 0 903 # if 0 904 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 905 # undef utimensat 906 # define utimensat rpl_utimensat 907 # endif 908 _GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name, 909 struct timespec const times[2], int flag) 910 _GL_ARG_NONNULL ((2))); 911 _GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name, 912 struct timespec const times[2], int flag)); 913 # else 914 # if !1 915 _GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name, 916 struct timespec const times[2], int flag) 917 _GL_ARG_NONNULL ((2))); 918 # endif 919 _GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name, 920 struct timespec const times[2], int flag)); 921 # endif 922 _GL_CXXALIASWARN (utimensat); 923 #elif defined GNULIB_POSIXCHECK 924 # undef utimensat 925 # if HAVE_RAW_DECL_UTIMENSAT 926 _GL_WARN_ON_USE (utimensat, "utimensat is not portable - " 927 "use gnulib module utimensat for portability"); 928 # endif 929 #endif 930 931 932 #endif /* _GL_SYS_STAT_H */ 933 #endif /* _GL_SYS_STAT_H */ 934 #endif 935