1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2 /* Provide a more complete sys/stat header file.
3 Copyright (C) 2006-2008 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3, or (at your option)
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation,
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
19 /* Written by Eric Blake, Paul Eggert, and Jim Meyering. */
21 /* This file is supposed to be used on platforms where <sys/stat.h> is
22 incomplete. It is intended to provide definitions and prototypes
23 needed by an application. Start with what the system provides. */
25 #ifndef _GL_SYS_STAT_H
27 /* The include_next requires a split double-inclusion guard. */
28 #include_next <sys/stat.h>
30 #ifndef _GL_SYS_STAT_H
31 #define _GL_SYS_STAT_H
33 /* Before doing "#define mkdir rpl_mkdir" below, we need to include all
34 headers that may declare mkdir(). */
35 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
40 # define S_IFMT 0170000
43 #if STAT_MACROS_BROKEN
59 # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
67 # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
75 # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
81 #ifndef S_ISDOOR /* Solaris 2.5 and up */
82 # define S_ISDOOR(m) 0
87 # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
89 # define S_ISFIFO(m) 0
95 # define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
101 #ifndef S_ISMPB /* V7 */
103 # define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
104 # define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
106 # define S_ISMPB(m) 0
107 # define S_ISMPC(m) 0
111 #ifndef S_ISNAM /* Xenix */
113 # define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
115 # define S_ISNAM(m) 0
119 #ifndef S_ISNWK /* HP/UX */
121 # define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
123 # define S_ISNWK(m) 0
127 #ifndef S_ISPORT /* Solaris 10 and up */
128 # define S_ISPORT(m) 0
133 # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
135 # define S_ISREG(m) 0
141 # define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
143 # define S_ISSOCK(m) 0
149 # define S_TYPEISMQ(p) 0
153 # define S_TYPEISTMO(p) 0
159 # define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
161 # define S_TYPEISSEM(p) 0
167 # define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
169 # define S_TYPEISSHM(p) 0
173 /* high performance ("contiguous data") */
175 # define S_ISCTG(p) 0
178 /* Cray DMF (data migration facility): off line, with data */
180 # define S_ISOFD(p) 0
183 /* Cray DMF (data migration facility): off line, with no data */
185 # define S_ISOFL(p) 0
188 /* 4.4BSD whiteout */
190 # define S_ISWHT(m) 0
193 /* If any of the following are undefined,
194 define them to their de facto standard values. */
196 # define S_ISUID 04000
199 # define S_ISGID 02000
202 /* S_ISVTX is a common extension to POSIX. */
204 # define S_ISVTX 01000
207 #if !S_IRUSR && S_IREAD
208 # define S_IRUSR S_IREAD
211 # define S_IRUSR 00400
214 # define S_IRGRP (S_IRUSR >> 3)
217 # define S_IROTH (S_IRUSR >> 6)
220 #if !S_IWUSR && S_IWRITE
221 # define S_IWUSR S_IWRITE
224 # define S_IWUSR 00200
227 # define S_IWGRP (S_IWUSR >> 3)
230 # define S_IWOTH (S_IWUSR >> 6)
233 #if !S_IXUSR && S_IEXEC
234 # define S_IXUSR S_IEXEC
237 # define S_IXUSR 00100
240 # define S_IXGRP (S_IXUSR >> 3)
243 # define S_IXOTH (S_IXUSR >> 6)
247 # define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
250 # define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
253 # define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
256 /* S_IXUGO is a common extension to POSIX. */
258 # define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
262 # define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
265 /* mingw does not support symlinks, therefore it does not have lstat. But
266 without links, stat does just fine. */
273 # define mkdir rpl_mkdir
274 extern int mkdir (char const *name, mode_t mode);
276 /* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
277 Additionally, it declares _mkdir (and depending on compile flags, an
278 alias mkdir), only in the nonstandard <io.h>, which is included above. */
279 # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
282 rpl_mkdir (char const *name, mode_t mode)
284 return _mkdir (name);
287 # define mkdir rpl_mkdir
291 #endif /* _GL_SYS_STAT_H */
292 #endif /* _GL_SYS_STAT_H */