Commit | Line | Data |
---|---|---|
5e8754f9 SDJ |
1 | /* Provide a more complete sys/stat header file. |
2 | Copyright (C) 2005-2016 Free Software Foundation, Inc. | |
09607c9e TT |
3 | |
4 | This program is free software; you can redistribute it and/or modify | |
5 | it under the terms of the GNU General Public License as published by | |
6 | the Free Software Foundation; either version 3, or (at your option) | |
7 | any later version. | |
8 | ||
9 | This program is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | GNU General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU General Public License | |
5e8754f9 | 15 | along with this program; if not, see <http://www.gnu.org/licenses/>. */ |
09607c9e TT |
16 | |
17 | /* Written by Eric Blake, Paul Eggert, and Jim Meyering. */ | |
18 | ||
19 | /* This file is supposed to be used on platforms where <sys/stat.h> is | |
20 | incomplete. It is intended to provide definitions and prototypes | |
21 | needed by an application. Start with what the system provides. */ | |
22 | ||
23 | #if __GNUC__ >= 3 | |
24 | @PRAGMA_SYSTEM_HEADER@ | |
25 | #endif | |
26 | @PRAGMA_COLUMNS@ | |
27 | ||
28 | #if defined __need_system_sys_stat_h | |
29 | /* Special invocation convention. */ | |
30 | ||
31 | #@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@ | |
32 | ||
33 | #else | |
34 | /* Normal invocation convention. */ | |
35 | ||
36 | #ifndef _@GUARD_PREFIX@_SYS_STAT_H | |
37 | ||
38 | /* Get nlink_t. | |
39 | May also define off_t to a 64-bit type on native Windows. */ | |
40 | #include <sys/types.h> | |
41 | ||
42 | /* Get struct timespec. */ | |
43 | #include <time.h> | |
44 | ||
45 | /* The include_next requires a split double-inclusion guard. */ | |
46 | #@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@ | |
47 | ||
48 | #ifndef _@GUARD_PREFIX@_SYS_STAT_H | |
49 | #define _@GUARD_PREFIX@_SYS_STAT_H | |
50 | ||
51 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ | |
52 | ||
53 | /* The definition of _GL_ARG_NONNULL is copied here. */ | |
54 | ||
55 | /* The definition of _GL_WARN_ON_USE is copied here. */ | |
56 | ||
57 | /* Before doing "#define mkdir rpl_mkdir" below, we need to include all | |
58 | headers that may declare mkdir(). Native Windows platforms declare mkdir | |
59 | in <io.h> and/or <direct.h>, not in <unistd.h>. */ | |
5e8754f9 | 60 | #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ |
09607c9e TT |
61 | # include <io.h> /* mingw32, mingw64 */ |
62 | # include <direct.h> /* mingw64, MSVC 9 */ | |
63 | #endif | |
64 | ||
65 | /* Native Windows platforms declare umask() in <io.h>. */ | |
5e8754f9 | 66 | #if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) |
09607c9e TT |
67 | # include <io.h> |
68 | #endif | |
69 | ||
70 | /* Large File Support on native Windows. */ | |
71 | #if @WINDOWS_64_BIT_ST_SIZE@ | |
72 | # define stat _stati64 | |
73 | #endif | |
74 | ||
75 | #ifndef S_IFIFO | |
76 | # ifdef _S_IFIFO | |
77 | # define S_IFIFO _S_IFIFO | |
78 | # endif | |
79 | #endif | |
80 | ||
81 | #ifndef S_IFMT | |
82 | # define S_IFMT 0170000 | |
83 | #endif | |
84 | ||
85 | #if STAT_MACROS_BROKEN | |
86 | # undef S_ISBLK | |
87 | # undef S_ISCHR | |
88 | # undef S_ISDIR | |
89 | # undef S_ISFIFO | |
90 | # undef S_ISLNK | |
91 | # undef S_ISNAM | |
92 | # undef S_ISMPB | |
93 | # undef S_ISMPC | |
94 | # undef S_ISNWK | |
95 | # undef S_ISREG | |
96 | # undef S_ISSOCK | |
97 | #endif | |
98 | ||
99 | #ifndef S_ISBLK | |
100 | # ifdef S_IFBLK | |
101 | # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) | |
102 | # else | |
103 | # define S_ISBLK(m) 0 | |
104 | # endif | |
105 | #endif | |
106 | ||
107 | #ifndef S_ISCHR | |
108 | # ifdef S_IFCHR | |
109 | # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) | |
110 | # else | |
111 | # define S_ISCHR(m) 0 | |
112 | # endif | |
113 | #endif | |
114 | ||
115 | #ifndef S_ISDIR | |
116 | # ifdef S_IFDIR | |
117 | # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) | |
118 | # else | |
119 | # define S_ISDIR(m) 0 | |
120 | # endif | |
121 | #endif | |
122 | ||
123 | #ifndef S_ISDOOR /* Solaris 2.5 and up */ | |
124 | # define S_ISDOOR(m) 0 | |
125 | #endif | |
126 | ||
127 | #ifndef S_ISFIFO | |
128 | # ifdef S_IFIFO | |
129 | # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) | |
130 | # else | |
131 | # define S_ISFIFO(m) 0 | |
132 | # endif | |
133 | #endif | |
134 | ||
135 | #ifndef S_ISLNK | |
136 | # ifdef S_IFLNK | |
137 | # define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) | |
138 | # else | |
139 | # define S_ISLNK(m) 0 | |
140 | # endif | |
141 | #endif | |
142 | ||
143 | #ifndef S_ISMPB /* V7 */ | |
144 | # ifdef S_IFMPB | |
145 | # define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) | |
146 | # define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC) | |
147 | # else | |
148 | # define S_ISMPB(m) 0 | |
149 | # define S_ISMPC(m) 0 | |
150 | # endif | |
151 | #endif | |
152 | ||
4a626d0a PA |
153 | #ifndef S_ISMPX /* AIX */ |
154 | # define S_ISMPX(m) 0 | |
155 | #endif | |
156 | ||
09607c9e TT |
157 | #ifndef S_ISNAM /* Xenix */ |
158 | # ifdef S_IFNAM | |
159 | # define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM) | |
160 | # else | |
161 | # define S_ISNAM(m) 0 | |
162 | # endif | |
163 | #endif | |
164 | ||
165 | #ifndef S_ISNWK /* HP/UX */ | |
166 | # ifdef S_IFNWK | |
167 | # define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK) | |
168 | # else | |
169 | # define S_ISNWK(m) 0 | |
170 | # endif | |
171 | #endif | |
172 | ||
173 | #ifndef S_ISPORT /* Solaris 10 and up */ | |
174 | # define S_ISPORT(m) 0 | |
175 | #endif | |
176 | ||
177 | #ifndef S_ISREG | |
178 | # ifdef S_IFREG | |
179 | # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) | |
180 | # else | |
181 | # define S_ISREG(m) 0 | |
182 | # endif | |
183 | #endif | |
184 | ||
185 | #ifndef S_ISSOCK | |
186 | # ifdef S_IFSOCK | |
187 | # define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) | |
188 | # else | |
189 | # define S_ISSOCK(m) 0 | |
190 | # endif | |
191 | #endif | |
192 | ||
193 | ||
194 | #ifndef S_TYPEISMQ | |
195 | # define S_TYPEISMQ(p) 0 | |
196 | #endif | |
197 | ||
198 | #ifndef S_TYPEISTMO | |
199 | # define S_TYPEISTMO(p) 0 | |
200 | #endif | |
201 | ||
202 | ||
203 | #ifndef S_TYPEISSEM | |
204 | # ifdef S_INSEM | |
205 | # define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM) | |
206 | # else | |
207 | # define S_TYPEISSEM(p) 0 | |
208 | # endif | |
209 | #endif | |
210 | ||
211 | #ifndef S_TYPEISSHM | |
212 | # ifdef S_INSHD | |
213 | # define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD) | |
214 | # else | |
215 | # define S_TYPEISSHM(p) 0 | |
216 | # endif | |
217 | #endif | |
218 | ||
219 | /* high performance ("contiguous data") */ | |
220 | #ifndef S_ISCTG | |
221 | # define S_ISCTG(p) 0 | |
222 | #endif | |
223 | ||
224 | /* Cray DMF (data migration facility): off line, with data */ | |
225 | #ifndef S_ISOFD | |
226 | # define S_ISOFD(p) 0 | |
227 | #endif | |
228 | ||
229 | /* Cray DMF (data migration facility): off line, with no data */ | |
230 | #ifndef S_ISOFL | |
231 | # define S_ISOFL(p) 0 | |
232 | #endif | |
233 | ||
234 | /* 4.4BSD whiteout */ | |
235 | #ifndef S_ISWHT | |
236 | # define S_ISWHT(m) 0 | |
237 | #endif | |
238 | ||
239 | /* If any of the following are undefined, | |
240 | define them to their de facto standard values. */ | |
241 | #if !S_ISUID | |
242 | # define S_ISUID 04000 | |
243 | #endif | |
244 | #if !S_ISGID | |
245 | # define S_ISGID 02000 | |
246 | #endif | |
247 | ||
248 | /* S_ISVTX is a common extension to POSIX. */ | |
249 | #ifndef S_ISVTX | |
250 | # define S_ISVTX 01000 | |
251 | #endif | |
252 | ||
253 | #if !S_IRUSR && S_IREAD | |
254 | # define S_IRUSR S_IREAD | |
255 | #endif | |
256 | #if !S_IRUSR | |
257 | # define S_IRUSR 00400 | |
258 | #endif | |
259 | #if !S_IRGRP | |
260 | # define S_IRGRP (S_IRUSR >> 3) | |
261 | #endif | |
262 | #if !S_IROTH | |
263 | # define S_IROTH (S_IRUSR >> 6) | |
264 | #endif | |
265 | ||
266 | #if !S_IWUSR && S_IWRITE | |
267 | # define S_IWUSR S_IWRITE | |
268 | #endif | |
269 | #if !S_IWUSR | |
270 | # define S_IWUSR 00200 | |
271 | #endif | |
272 | #if !S_IWGRP | |
273 | # define S_IWGRP (S_IWUSR >> 3) | |
274 | #endif | |
275 | #if !S_IWOTH | |
276 | # define S_IWOTH (S_IWUSR >> 6) | |
277 | #endif | |
278 | ||
279 | #if !S_IXUSR && S_IEXEC | |
280 | # define S_IXUSR S_IEXEC | |
281 | #endif | |
282 | #if !S_IXUSR | |
283 | # define S_IXUSR 00100 | |
284 | #endif | |
285 | #if !S_IXGRP | |
286 | # define S_IXGRP (S_IXUSR >> 3) | |
287 | #endif | |
288 | #if !S_IXOTH | |
289 | # define S_IXOTH (S_IXUSR >> 6) | |
290 | #endif | |
291 | ||
292 | #if !S_IRWXU | |
293 | # define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) | |
294 | #endif | |
295 | #if !S_IRWXG | |
296 | # define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP) | |
297 | #endif | |
298 | #if !S_IRWXO | |
299 | # define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH) | |
300 | #endif | |
301 | ||
302 | /* S_IXUGO is a common extension to POSIX. */ | |
303 | #if !S_IXUGO | |
304 | # define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH) | |
305 | #endif | |
306 | ||
307 | #ifndef S_IRWXUGO | |
308 | # define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO) | |
309 | #endif | |
310 | ||
311 | /* Macros for futimens and utimensat. */ | |
312 | #ifndef UTIME_NOW | |
313 | # define UTIME_NOW (-1) | |
314 | # define UTIME_OMIT (-2) | |
315 | #endif | |
316 | ||
317 | ||
318 | #if @GNULIB_FCHMODAT@ | |
319 | # if !@HAVE_FCHMODAT@ | |
320 | _GL_FUNCDECL_SYS (fchmodat, int, | |
321 | (int fd, char const *file, mode_t mode, int flag) | |
322 | _GL_ARG_NONNULL ((2))); | |
323 | # endif | |
324 | _GL_CXXALIAS_SYS (fchmodat, int, | |
325 | (int fd, char const *file, mode_t mode, int flag)); | |
326 | _GL_CXXALIASWARN (fchmodat); | |
327 | #elif defined GNULIB_POSIXCHECK | |
328 | # undef fchmodat | |
329 | # if HAVE_RAW_DECL_FCHMODAT | |
330 | _GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - " | |
331 | "use gnulib module openat for portability"); | |
332 | # endif | |
333 | #endif | |
334 | ||
335 | ||
336 | #if @GNULIB_FSTAT@ | |
337 | # if @REPLACE_FSTAT@ | |
338 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
339 | # undef fstat | |
340 | # define fstat rpl_fstat | |
341 | # endif | |
342 | _GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2))); | |
343 | _GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf)); | |
344 | # else | |
345 | _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf)); | |
346 | # endif | |
347 | _GL_CXXALIASWARN (fstat); | |
348 | #elif @WINDOWS_64_BIT_ST_SIZE@ | |
349 | /* Above, we define stat to _stati64. */ | |
350 | # define fstat _fstati64 | |
351 | #elif defined GNULIB_POSIXCHECK | |
352 | # undef fstat | |
353 | # if HAVE_RAW_DECL_FSTAT | |
354 | _GL_WARN_ON_USE (fstat, "fstat has portability problems - " | |
355 | "use gnulib module fstat for portability"); | |
356 | # endif | |
357 | #endif | |
358 | ||
359 | ||
360 | #if @GNULIB_FSTATAT@ | |
361 | # if @REPLACE_FSTATAT@ | |
362 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
363 | # undef fstatat | |
364 | # define fstatat rpl_fstatat | |
365 | # endif | |
366 | _GL_FUNCDECL_RPL (fstatat, int, | |
367 | (int fd, char const *name, struct stat *st, int flags) | |
368 | _GL_ARG_NONNULL ((2, 3))); | |
369 | _GL_CXXALIAS_RPL (fstatat, int, | |
370 | (int fd, char const *name, struct stat *st, int flags)); | |
371 | # else | |
372 | # if !@HAVE_FSTATAT@ | |
373 | _GL_FUNCDECL_SYS (fstatat, int, | |
374 | (int fd, char const *name, struct stat *st, int flags) | |
375 | _GL_ARG_NONNULL ((2, 3))); | |
376 | # endif | |
377 | _GL_CXXALIAS_SYS (fstatat, int, | |
378 | (int fd, char const *name, struct stat *st, int flags)); | |
379 | # endif | |
380 | _GL_CXXALIASWARN (fstatat); | |
381 | #elif defined GNULIB_POSIXCHECK | |
382 | # undef fstatat | |
383 | # if HAVE_RAW_DECL_FSTATAT | |
384 | _GL_WARN_ON_USE (fstatat, "fstatat is not portable - " | |
385 | "use gnulib module openat for portability"); | |
386 | # endif | |
387 | #endif | |
388 | ||
389 | ||
390 | #if @GNULIB_FUTIMENS@ | |
391 | /* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our futimens | |
392 | implementation relies on futimesat, which on Solaris 10 makes an invocation | |
393 | to futimens that is meant to invoke the libc's futimens(), not gnulib's | |
394 | futimens(). */ | |
395 | # if @REPLACE_FUTIMENS@ || (!@HAVE_FUTIMENS@ && defined __sun) | |
396 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
397 | # undef futimens | |
398 | # define futimens rpl_futimens | |
399 | # endif | |
400 | _GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2])); | |
401 | _GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2])); | |
402 | # else | |
403 | # if !@HAVE_FUTIMENS@ | |
404 | _GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2])); | |
405 | # endif | |
406 | _GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2])); | |
407 | # endif | |
408 | # if @HAVE_FUTIMENS@ | |
409 | _GL_CXXALIASWARN (futimens); | |
410 | # endif | |
411 | #elif defined GNULIB_POSIXCHECK | |
412 | # undef futimens | |
413 | # if HAVE_RAW_DECL_FUTIMENS | |
414 | _GL_WARN_ON_USE (futimens, "futimens is not portable - " | |
415 | "use gnulib module futimens for portability"); | |
416 | # endif | |
417 | #endif | |
418 | ||
419 | ||
420 | #if @GNULIB_LCHMOD@ | |
421 | /* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME | |
422 | denotes a symbolic link. */ | |
423 | # if !@HAVE_LCHMOD@ | |
424 | /* The lchmod replacement follows symbolic links. Callers should take | |
425 | this into account; lchmod should be applied only to arguments that | |
426 | are known to not be symbolic links. On hosts that lack lchmod, | |
427 | this can lead to race conditions between the check and the | |
428 | invocation of lchmod, but we know of no workarounds that are | |
429 | reliable in general. You might try requesting support for lchmod | |
430 | from your operating system supplier. */ | |
431 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
432 | # define lchmod chmod | |
433 | # endif | |
434 | /* Need to cast, because on mingw, the second parameter of chmod is | |
435 | int mode. */ | |
436 | _GL_CXXALIAS_RPL_CAST_1 (lchmod, chmod, int, | |
437 | (const char *filename, mode_t mode)); | |
438 | # else | |
439 | # if 0 /* assume already declared */ | |
440 | _GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode) | |
441 | _GL_ARG_NONNULL ((1))); | |
442 | # endif | |
443 | _GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode)); | |
444 | # endif | |
445 | # if @HAVE_LCHMOD@ | |
446 | _GL_CXXALIASWARN (lchmod); | |
447 | # endif | |
448 | #elif defined GNULIB_POSIXCHECK | |
449 | # undef lchmod | |
450 | # if HAVE_RAW_DECL_LCHMOD | |
451 | _GL_WARN_ON_USE (lchmod, "lchmod is unportable - " | |
452 | "use gnulib module lchmod for portability"); | |
453 | # endif | |
454 | #endif | |
455 | ||
456 | ||
457 | #if @GNULIB_LSTAT@ | |
458 | # if ! @HAVE_LSTAT@ | |
459 | /* mingw does not support symlinks, therefore it does not have lstat. But | |
460 | without links, stat does just fine. */ | |
461 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
462 | # define lstat stat | |
463 | # endif | |
464 | _GL_CXXALIAS_RPL_1 (lstat, stat, int, (const char *name, struct stat *buf)); | |
465 | # elif @REPLACE_LSTAT@ | |
466 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
467 | # undef lstat | |
468 | # define lstat rpl_lstat | |
469 | # endif | |
470 | _GL_FUNCDECL_RPL (lstat, int, (const char *name, struct stat *buf) | |
471 | _GL_ARG_NONNULL ((1, 2))); | |
472 | _GL_CXXALIAS_RPL (lstat, int, (const char *name, struct stat *buf)); | |
473 | # else | |
474 | _GL_CXXALIAS_SYS (lstat, int, (const char *name, struct stat *buf)); | |
475 | # endif | |
476 | # if @HAVE_LSTAT@ | |
477 | _GL_CXXALIASWARN (lstat); | |
478 | # endif | |
479 | #elif defined GNULIB_POSIXCHECK | |
480 | # undef lstat | |
481 | # if HAVE_RAW_DECL_LSTAT | |
482 | _GL_WARN_ON_USE (lstat, "lstat is unportable - " | |
483 | "use gnulib module lstat for portability"); | |
484 | # endif | |
485 | #endif | |
486 | ||
487 | ||
488 | #if @REPLACE_MKDIR@ | |
489 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
490 | # undef mkdir | |
491 | # define mkdir rpl_mkdir | |
492 | # endif | |
493 | _GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode) | |
494 | _GL_ARG_NONNULL ((1))); | |
495 | _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode)); | |
496 | #else | |
497 | /* mingw's _mkdir() function has 1 argument, but we pass 2 arguments. | |
498 | Additionally, it declares _mkdir (and depending on compile flags, an | |
499 | alias mkdir), only in the nonstandard includes <direct.h> and <io.h>, | |
500 | which are included above. */ | |
5e8754f9 | 501 | # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ |
09607c9e TT |
502 | |
503 | # if !GNULIB_defined_rpl_mkdir | |
504 | static int | |
505 | rpl_mkdir (char const *name, mode_t mode) | |
506 | { | |
507 | return _mkdir (name); | |
508 | } | |
509 | # define GNULIB_defined_rpl_mkdir 1 | |
510 | # endif | |
511 | ||
512 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
513 | # define mkdir rpl_mkdir | |
514 | # endif | |
515 | _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode)); | |
516 | # else | |
517 | _GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode)); | |
518 | # endif | |
519 | #endif | |
520 | _GL_CXXALIASWARN (mkdir); | |
521 | ||
522 | ||
523 | #if @GNULIB_MKDIRAT@ | |
524 | # if !@HAVE_MKDIRAT@ | |
525 | _GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode) | |
526 | _GL_ARG_NONNULL ((2))); | |
527 | # endif | |
528 | _GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)); | |
529 | _GL_CXXALIASWARN (mkdirat); | |
530 | #elif defined GNULIB_POSIXCHECK | |
531 | # undef mkdirat | |
532 | # if HAVE_RAW_DECL_MKDIRAT | |
533 | _GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - " | |
534 | "use gnulib module openat for portability"); | |
535 | # endif | |
536 | #endif | |
537 | ||
538 | ||
539 | #if @GNULIB_MKFIFO@ | |
540 | # if @REPLACE_MKFIFO@ | |
541 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
542 | # undef mkfifo | |
543 | # define mkfifo rpl_mkfifo | |
544 | # endif | |
545 | _GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode) | |
546 | _GL_ARG_NONNULL ((1))); | |
547 | _GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode)); | |
548 | # else | |
549 | # if !@HAVE_MKFIFO@ | |
550 | _GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode) | |
551 | _GL_ARG_NONNULL ((1))); | |
552 | # endif | |
553 | _GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode)); | |
554 | # endif | |
555 | _GL_CXXALIASWARN (mkfifo); | |
556 | #elif defined GNULIB_POSIXCHECK | |
557 | # undef mkfifo | |
558 | # if HAVE_RAW_DECL_MKFIFO | |
559 | _GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - " | |
560 | "use gnulib module mkfifo for portability"); | |
561 | # endif | |
562 | #endif | |
563 | ||
564 | ||
565 | #if @GNULIB_MKFIFOAT@ | |
566 | # if !@HAVE_MKFIFOAT@ | |
567 | _GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode) | |
568 | _GL_ARG_NONNULL ((2))); | |
569 | # endif | |
570 | _GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)); | |
571 | _GL_CXXALIASWARN (mkfifoat); | |
572 | #elif defined GNULIB_POSIXCHECK | |
573 | # undef mkfifoat | |
574 | # if HAVE_RAW_DECL_MKFIFOAT | |
575 | _GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - " | |
576 | "use gnulib module mkfifoat for portability"); | |
577 | # endif | |
578 | #endif | |
579 | ||
580 | ||
581 | #if @GNULIB_MKNOD@ | |
582 | # if @REPLACE_MKNOD@ | |
583 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
584 | # undef mknod | |
585 | # define mknod rpl_mknod | |
586 | # endif | |
587 | _GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev) | |
588 | _GL_ARG_NONNULL ((1))); | |
589 | _GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)); | |
590 | # else | |
591 | # if !@HAVE_MKNOD@ | |
592 | _GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev) | |
593 | _GL_ARG_NONNULL ((1))); | |
594 | # endif | |
595 | /* Need to cast, because on OSF/1 5.1, the third parameter is '...'. */ | |
596 | _GL_CXXALIAS_SYS_CAST (mknod, int, (char const *file, mode_t mode, dev_t dev)); | |
597 | # endif | |
598 | _GL_CXXALIASWARN (mknod); | |
599 | #elif defined GNULIB_POSIXCHECK | |
600 | # undef mknod | |
601 | # if HAVE_RAW_DECL_MKNOD | |
602 | _GL_WARN_ON_USE (mknod, "mknod is not portable - " | |
603 | "use gnulib module mknod for portability"); | |
604 | # endif | |
605 | #endif | |
606 | ||
607 | ||
608 | #if @GNULIB_MKNODAT@ | |
609 | # if !@HAVE_MKNODAT@ | |
610 | _GL_FUNCDECL_SYS (mknodat, int, | |
611 | (int fd, char const *file, mode_t mode, dev_t dev) | |
612 | _GL_ARG_NONNULL ((2))); | |
613 | # endif | |
614 | _GL_CXXALIAS_SYS (mknodat, int, | |
615 | (int fd, char const *file, mode_t mode, dev_t dev)); | |
616 | _GL_CXXALIASWARN (mknodat); | |
617 | #elif defined GNULIB_POSIXCHECK | |
618 | # undef mknodat | |
619 | # if HAVE_RAW_DECL_MKNODAT | |
620 | _GL_WARN_ON_USE (mknodat, "mknodat is not portable - " | |
621 | "use gnulib module mkfifoat for portability"); | |
622 | # endif | |
623 | #endif | |
624 | ||
625 | ||
626 | #if @GNULIB_STAT@ | |
627 | # if @REPLACE_STAT@ | |
5e8754f9 SDJ |
628 | /* We can't use the object-like #define stat rpl_stat, because of |
629 | struct stat. This means that rpl_stat will not be used if the user | |
630 | does (stat)(a,b). Oh well. */ | |
631 | # if defined _AIX && defined stat && defined _LARGE_FILES | |
632 | /* With _LARGE_FILES defined, AIX (only) defines stat to stat64, | |
633 | so we have to replace stat64() instead of stat(). */ | |
634 | # undef stat64 | |
635 | # define stat64(name, st) rpl_stat (name, st) | |
636 | # elif @WINDOWS_64_BIT_ST_SIZE@ | |
637 | /* Above, we define stat to _stati64. */ | |
638 | # if defined __MINGW32__ && defined _stati64 | |
639 | # ifndef _USE_32BIT_TIME_T | |
640 | /* The system headers define _stati64 to _stat64. */ | |
641 | # undef _stat64 | |
642 | # define _stat64(name, st) rpl_stat (name, st) | |
09607c9e | 643 | # endif |
5e8754f9 | 644 | # elif defined _MSC_VER && defined _stati64 |
09607c9e | 645 | # ifdef _USE_32BIT_TIME_T |
5e8754f9 | 646 | /* The system headers define _stati64 to _stat32i64. */ |
09607c9e TT |
647 | # undef _stat32i64 |
648 | # define _stat32i64(name, st) rpl_stat (name, st) | |
649 | # else | |
5e8754f9 | 650 | /* The system headers define _stati64 to _stat64. */ |
09607c9e TT |
651 | # undef _stat64 |
652 | # define _stat64(name, st) rpl_stat (name, st) | |
653 | # endif | |
5e8754f9 SDJ |
654 | # else |
655 | # undef _stati64 | |
656 | # define _stati64(name, st) rpl_stat (name, st) | |
657 | # endif | |
658 | # elif defined __MINGW32__ && defined stat | |
659 | # ifdef _USE_32BIT_TIME_T | |
660 | /* The system headers define stat to _stat32i64. */ | |
661 | # undef _stat32i64 | |
662 | # define _stat32i64(name, st) rpl_stat (name, st) | |
663 | # else | |
664 | /* The system headers define stat to _stat64. */ | |
665 | # undef _stat64 | |
666 | # define _stat64(name, st) rpl_stat (name, st) | |
667 | # endif | |
668 | # elif defined _MSC_VER && defined stat | |
669 | # ifdef _USE_32BIT_TIME_T | |
670 | /* The system headers define stat to _stat32. */ | |
671 | # undef _stat32 | |
672 | # define _stat32(name, st) rpl_stat (name, st) | |
673 | # else | |
674 | /* The system headers define stat to _stat64i32. */ | |
675 | # undef _stat64i32 | |
676 | # define _stat64i32(name, st) rpl_stat (name, st) | |
677 | # endif | |
678 | # else /* !(_AIX ||__MINGW32__ || _MSC_VER) */ | |
679 | # undef stat | |
680 | # define stat(name, st) rpl_stat (name, st) | |
681 | # endif /* !_LARGE_FILES */ | |
09607c9e TT |
682 | _GL_EXTERN_C int stat (const char *name, struct stat *buf) |
683 | _GL_ARG_NONNULL ((1, 2)); | |
684 | # endif | |
685 | #elif defined GNULIB_POSIXCHECK | |
686 | # undef stat | |
687 | # if HAVE_RAW_DECL_STAT | |
688 | _GL_WARN_ON_USE (stat, "stat is unportable - " | |
689 | "use gnulib module stat for portability"); | |
690 | # endif | |
691 | #endif | |
692 | ||
693 | ||
694 | #if @GNULIB_UTIMENSAT@ | |
695 | /* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat | |
696 | implementation relies on futimesat, which on Solaris 10 makes an invocation | |
697 | to utimensat that is meant to invoke the libc's utimensat(), not gnulib's | |
698 | utimensat(). */ | |
699 | # if @REPLACE_UTIMENSAT@ || (!@HAVE_UTIMENSAT@ && defined __sun) | |
700 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
701 | # undef utimensat | |
702 | # define utimensat rpl_utimensat | |
703 | # endif | |
704 | _GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name, | |
705 | struct timespec const times[2], int flag) | |
706 | _GL_ARG_NONNULL ((2))); | |
707 | _GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name, | |
708 | struct timespec const times[2], int flag)); | |
709 | # else | |
710 | # if !@HAVE_UTIMENSAT@ | |
711 | _GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name, | |
712 | struct timespec const times[2], int flag) | |
713 | _GL_ARG_NONNULL ((2))); | |
714 | # endif | |
715 | _GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name, | |
716 | struct timespec const times[2], int flag)); | |
717 | # endif | |
718 | # if @HAVE_UTIMENSAT@ | |
719 | _GL_CXXALIASWARN (utimensat); | |
720 | # endif | |
721 | #elif defined GNULIB_POSIXCHECK | |
722 | # undef utimensat | |
723 | # if HAVE_RAW_DECL_UTIMENSAT | |
724 | _GL_WARN_ON_USE (utimensat, "utimensat is not portable - " | |
725 | "use gnulib module utimensat for portability"); | |
726 | # endif | |
727 | #endif | |
728 | ||
729 | ||
730 | #endif /* _@GUARD_PREFIX@_SYS_STAT_H */ | |
731 | #endif /* _@GUARD_PREFIX@_SYS_STAT_H */ | |
732 | #endif |