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