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