1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* Provide a more complete sys/stat header file.
4 Copyright (C) 2006, 2007 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software Foundation,
18 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
20 /* Written by Eric Blake, Paul Eggert, and Jim Meyering. */
22 /* This file is supposed to be used on platforms where <sys/stat.h> is
23 incomplete. It is intended to provide definitions and prototypes
24 needed by an application. Start with what the system provides. */
26 #ifndef _GL_SYS_STAT_H
28 /* The include_next requires a split double-inclusion guard. */
29 #@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
31 #ifndef _GL_SYS_STAT_H
32 #define _GL_SYS_STAT_H
35 # define S_IFMT 0170000
38 #if STAT_MACROS_BROKEN
54 # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
62 # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
70 # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
76 #ifndef S_ISDOOR /* Solaris 2.5 and up */
77 # define S_ISDOOR(m) 0
82 # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
84 # define S_ISFIFO(m) 0
90 # define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
96 #ifndef S_ISMPB /* V7 */
98 # define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
99 # define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
101 # define S_ISMPB(m) 0
102 # define S_ISMPC(m) 0
106 #ifndef S_ISNAM /* Xenix */
108 # define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
110 # define S_ISNAM(m) 0
114 #ifndef S_ISNWK /* HP/UX */
116 # define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
118 # define S_ISNWK(m) 0
122 #ifndef S_ISPORT /* Solaris 10 and up */
123 # define S_ISPORT(m) 0
128 # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
130 # define S_ISREG(m) 0
136 # define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
138 # define S_ISSOCK(m) 0
144 # define S_TYPEISMQ(p) 0
148 # define S_TYPEISTMO(p) 0
154 # define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
156 # define S_TYPEISSEM(p) 0
162 # define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
164 # define S_TYPEISSHM(p) 0
168 /* high performance ("contiguous data") */
170 # define S_ISCTG(p) 0
173 /* Cray DMF (data migration facility): off line, with data */
175 # define S_ISOFD(p) 0
178 /* Cray DMF (data migration facility): off line, with no data */
180 # define S_ISOFL(p) 0
183 /* 4.4BSD whiteout */
185 # define S_ISWHT(m) 0
188 /* If any of the following are undefined,
189 define them to their de facto standard values. */
191 # define S_ISUID 04000
194 # define S_ISGID 02000
197 /* S_ISVTX is a common extension to POSIX. */
199 # define S_ISVTX 01000
202 #if !S_IRUSR && S_IREAD
203 # define S_IRUSR S_IREAD
206 # define S_IRUSR 00400
209 # define S_IRGRP (S_IRUSR >> 3)
212 # define S_IROTH (S_IRUSR >> 6)
215 #if !S_IWUSR && S_IWRITE
216 # define S_IWUSR S_IWRITE
219 # define S_IWUSR 00200
222 # define S_IWGRP (S_IWUSR >> 3)
225 # define S_IWOTH (S_IWUSR >> 6)
228 #if !S_IXUSR && S_IEXEC
229 # define S_IXUSR S_IEXEC
232 # define S_IXUSR 00100
235 # define S_IXGRP (S_IXUSR >> 3)
238 # define S_IXOTH (S_IXUSR >> 6)
242 # define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
245 # define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
248 # define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
251 /* S_IXUGO is a common extension to POSIX. */
253 # define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
257 # define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
260 /* mingw does not support symlinks, therefore it does not have lstat. But
261 without links, stat does just fine. */
266 /* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
267 Additionally, it declares _mkdir (and depending on compile flags, an
268 alias mkdir), only in the nonstandard io.h. */
269 #if ! @HAVE_DECL_MKDIR@ && @HAVE_IO_H@
273 rpl_mkdir (char const *name, mode_t mode)
275 return _mkdir (name);
278 # define mkdir rpl_mkdir
281 #endif /* _GL_SYS_STAT_H */
282 #endif /* _GL_SYS_STAT_H */