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