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