• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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) 2005-2009 Free Software Foundation, Inc.
5 
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)
9    any later version.
10 
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.
15 
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.  */
19 
20 /* Written by Eric Blake, Paul Eggert, and Jim Meyering.  */
21 
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.  */
25 
26 #if __GNUC__ >= 3
27 @PRAGMA_SYSTEM_HEADER@
28 #endif
29 
30 #if defined __need_system_sys_stat_h
31 /* Special invocation convention.  */
32 
33 #@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
34 
35 #else
36 /* Normal invocation convention.  */
37 
38 #ifndef _GL_SYS_STAT_H
39 
40 /* Get nlink_t.  */
41 #include <sys/types.h>
42 
43 /* The include_next requires a split double-inclusion guard.  */
44 #@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
45 
46 #ifndef _GL_SYS_STAT_H
47 #define _GL_SYS_STAT_H
48 
49 /* The definition of GL_LINK_WARNING is copied here.  */
50 
51 /* Before doing "#define mkdir rpl_mkdir" below, we need to include all
52    headers that may declare mkdir().  */
53 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
54 # include <io.h>
55 #endif
56 
57 #ifndef S_IFMT
58 # define S_IFMT 0170000
59 #endif
60 
61 #if STAT_MACROS_BROKEN
62 # undef S_ISBLK
63 # undef S_ISCHR
64 # undef S_ISDIR
65 # undef S_ISFIFO
66 # undef S_ISLNK
67 # undef S_ISNAM
68 # undef S_ISMPB
69 # undef S_ISMPC
70 # undef S_ISNWK
71 # undef S_ISREG
72 # undef S_ISSOCK
73 #endif
74 
75 #ifndef S_ISBLK
76 # ifdef S_IFBLK
77 #  define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
78 # else
79 #  define S_ISBLK(m) 0
80 # endif
81 #endif
82 
83 #ifndef S_ISCHR
84 # ifdef S_IFCHR
85 #  define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
86 # else
87 #  define S_ISCHR(m) 0
88 # endif
89 #endif
90 
91 #ifndef S_ISDIR
92 # ifdef S_IFDIR
93 #  define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
94 # else
95 #  define S_ISDIR(m) 0
96 # endif
97 #endif
98 
99 #ifndef S_ISDOOR /* Solaris 2.5 and up */
100 # define S_ISDOOR(m) 0
101 #endif
102 
103 #ifndef S_ISFIFO
104 # ifdef S_IFIFO
105 #  define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
106 # else
107 #  define S_ISFIFO(m) 0
108 # endif
109 #endif
110 
111 #ifndef S_ISLNK
112 # ifdef S_IFLNK
113 #  define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
114 # else
115 #  define S_ISLNK(m) 0
116 # endif
117 #endif
118 
119 #ifndef S_ISMPB /* V7 */
120 # ifdef S_IFMPB
121 #  define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
122 #  define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
123 # else
124 #  define S_ISMPB(m) 0
125 #  define S_ISMPC(m) 0
126 # endif
127 #endif
128 
129 #ifndef S_ISNAM /* Xenix */
130 # ifdef S_IFNAM
131 #  define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
132 # else
133 #  define S_ISNAM(m) 0
134 # endif
135 #endif
136 
137 #ifndef S_ISNWK /* HP/UX */
138 # ifdef S_IFNWK
139 #  define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
140 # else
141 #  define S_ISNWK(m) 0
142 # endif
143 #endif
144 
145 #ifndef S_ISPORT /* Solaris 10 and up */
146 # define S_ISPORT(m) 0
147 #endif
148 
149 #ifndef S_ISREG
150 # ifdef S_IFREG
151 #  define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
152 # else
153 #  define S_ISREG(m) 0
154 # endif
155 #endif
156 
157 #ifndef S_ISSOCK
158 # ifdef S_IFSOCK
159 #  define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
160 # else
161 #  define S_ISSOCK(m) 0
162 # endif
163 #endif
164 
165 
166 #ifndef S_TYPEISMQ
167 # define S_TYPEISMQ(p) 0
168 #endif
169 
170 #ifndef S_TYPEISTMO
171 # define S_TYPEISTMO(p) 0
172 #endif
173 
174 
175 #ifndef S_TYPEISSEM
176 # ifdef S_INSEM
177 #  define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
178 # else
179 #  define S_TYPEISSEM(p) 0
180 # endif
181 #endif
182 
183 #ifndef S_TYPEISSHM
184 # ifdef S_INSHD
185 #  define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
186 # else
187 #  define S_TYPEISSHM(p) 0
188 # endif
189 #endif
190 
191 /* high performance ("contiguous data") */
192 #ifndef S_ISCTG
193 # define S_ISCTG(p) 0
194 #endif
195 
196 /* Cray DMF (data migration facility): off line, with data  */
197 #ifndef S_ISOFD
198 # define S_ISOFD(p) 0
199 #endif
200 
201 /* Cray DMF (data migration facility): off line, with no data  */
202 #ifndef S_ISOFL
203 # define S_ISOFL(p) 0
204 #endif
205 
206 /* 4.4BSD whiteout */
207 #ifndef S_ISWHT
208 # define S_ISWHT(m) 0
209 #endif
210 
211 /* If any of the following are undefined,
212    define them to their de facto standard values.  */
213 #if !S_ISUID
214 # define S_ISUID 04000
215 #endif
216 #if !S_ISGID
217 # define S_ISGID 02000
218 #endif
219 
220 /* S_ISVTX is a common extension to POSIX.  */
221 #ifndef S_ISVTX
222 # define S_ISVTX 01000
223 #endif
224 
225 #if !S_IRUSR && S_IREAD
226 # define S_IRUSR S_IREAD
227 #endif
228 #if !S_IRUSR
229 # define S_IRUSR 00400
230 #endif
231 #if !S_IRGRP
232 # define S_IRGRP (S_IRUSR >> 3)
233 #endif
234 #if !S_IROTH
235 # define S_IROTH (S_IRUSR >> 6)
236 #endif
237 
238 #if !S_IWUSR && S_IWRITE
239 # define S_IWUSR S_IWRITE
240 #endif
241 #if !S_IWUSR
242 # define S_IWUSR 00200
243 #endif
244 #if !S_IWGRP
245 # define S_IWGRP (S_IWUSR >> 3)
246 #endif
247 #if !S_IWOTH
248 # define S_IWOTH (S_IWUSR >> 6)
249 #endif
250 
251 #if !S_IXUSR && S_IEXEC
252 # define S_IXUSR S_IEXEC
253 #endif
254 #if !S_IXUSR
255 # define S_IXUSR 00100
256 #endif
257 #if !S_IXGRP
258 # define S_IXGRP (S_IXUSR >> 3)
259 #endif
260 #if !S_IXOTH
261 # define S_IXOTH (S_IXUSR >> 6)
262 #endif
263 
264 #if !S_IRWXU
265 # define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
266 #endif
267 #if !S_IRWXG
268 # define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
269 #endif
270 #if !S_IRWXO
271 # define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
272 #endif
273 
274 /* S_IXUGO is a common extension to POSIX.  */
275 #if !S_IXUGO
276 # define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
277 #endif
278 
279 #ifndef S_IRWXUGO
280 # define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
281 #endif
282 
283 
284 #ifdef __cplusplus
285 extern "C" {
286 #endif
287 
288 
289 #if @GNULIB_LSTAT@
290 # if ! @HAVE_LSTAT@
291 /* mingw does not support symlinks, therefore it does not have lstat.  But
292    without links, stat does just fine.  */
293 #  define lstat stat
294 # elif @REPLACE_LSTAT@
295 #  undef lstat
296 #  define lstat rpl_lstat
297 extern int rpl_lstat (const char *name, struct stat *buf);
298 # endif
299 #elif defined GNULIB_POSIXCHECK
300 # undef lstat
301 # define lstat(p,b)							\
302   (GL_LINK_WARNING ("lstat is unportable - "				\
303 		    "use gnulib module lstat for portability"),		\
304    lstat (p, b))
305 #endif
306 
307 
308 #if @REPLACE_MKDIR@
309 # undef mkdir
310 # define mkdir rpl_mkdir
311 extern int mkdir (char const *name, mode_t mode);
312 #else
313 /* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
314    Additionally, it declares _mkdir (and depending on compile flags, an
315    alias mkdir), only in the nonstandard <io.h>, which is included above.  */
316 # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
317 
318 static inline int
319 rpl_mkdir (char const *name, mode_t mode)
320 {
321   return _mkdir (name);
322 }
323 
324 #  define mkdir rpl_mkdir
325 # endif
326 #endif
327 
328 
329 /* Declare BSD extensions.  */
330 
331 #if @GNULIB_LCHMOD@
332 /* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
333    denotes a symbolic link.  */
334 # if !@HAVE_LCHMOD@
335 /* The lchmod replacement follows symbolic links.  Callers should take
336    this into account; lchmod should be applied only to arguments that
337    are known to not be symbolic links.  On hosts that lack lchmod,
338    this can lead to race conditions between the check and the
339    invocation of lchmod, but we know of no workarounds that are
340    reliable in general.  You might try requesting support for lchmod
341    from your operating system supplier.  */
342 #  define lchmod chmod
343 # endif
344 # if 0 /* assume already declared */
345 extern int lchmod (const char *filename, mode_t mode);
346 # endif
347 #elif defined GNULIB_POSIXCHECK
348 # undef lchmod
349 # define lchmod(f,m) \
350     (GL_LINK_WARNING ("lchmod is unportable - " \
351                       "use gnulib module lchmod for portability"), \
352      lchmod (f, m))
353 #endif
354 
355 
356 #ifdef __cplusplus
357 }
358 #endif
359 
360 
361 #endif /* _GL_SYS_STAT_H */
362 #endif /* _GL_SYS_STAT_H */
363 #endif
364