]> git.cworth.org Git - tar/blob - lib/sys_stat.in.h
Imported Upstream version 1.20
[tar] / lib / sys_stat.in.h
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.
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 #ifndef _GL_SYS_STAT_H
27
28 /* The include_next requires a split double-inclusion guard.  */
29 #@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
30
31 #ifndef _GL_SYS_STAT_H
32 #define _GL_SYS_STAT_H
33
34 #ifndef S_IFMT
35 # define S_IFMT 0170000
36 #endif
37
38 #if STAT_MACROS_BROKEN
39 # undef S_ISBLK
40 # undef S_ISCHR
41 # undef S_ISDIR
42 # undef S_ISFIFO
43 # undef S_ISLNK
44 # undef S_ISNAM
45 # undef S_ISMPB
46 # undef S_ISMPC
47 # undef S_ISNWK
48 # undef S_ISREG
49 # undef S_ISSOCK
50 #endif
51
52 #ifndef S_ISBLK
53 # ifdef S_IFBLK
54 #  define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
55 # else
56 #  define S_ISBLK(m) 0
57 # endif
58 #endif
59
60 #ifndef S_ISCHR
61 # ifdef S_IFCHR
62 #  define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
63 # else
64 #  define S_ISCHR(m) 0
65 # endif
66 #endif
67
68 #ifndef S_ISDIR
69 # ifdef S_IFDIR
70 #  define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
71 # else
72 #  define S_ISDIR(m) 0
73 # endif
74 #endif
75
76 #ifndef S_ISDOOR /* Solaris 2.5 and up */
77 # define S_ISDOOR(m) 0
78 #endif
79
80 #ifndef S_ISFIFO
81 # ifdef S_IFIFO
82 #  define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
83 # else
84 #  define S_ISFIFO(m) 0
85 # endif
86 #endif
87
88 #ifndef S_ISLNK
89 # ifdef S_IFLNK
90 #  define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
91 # else
92 #  define S_ISLNK(m) 0
93 # endif
94 #endif
95
96 #ifndef S_ISMPB /* V7 */
97 # ifdef S_IFMPB
98 #  define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
99 #  define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
100 # else
101 #  define S_ISMPB(m) 0
102 #  define S_ISMPC(m) 0
103 # endif
104 #endif
105
106 #ifndef S_ISNAM /* Xenix */
107 # ifdef S_IFNAM
108 #  define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
109 # else
110 #  define S_ISNAM(m) 0
111 # endif
112 #endif
113
114 #ifndef S_ISNWK /* HP/UX */
115 # ifdef S_IFNWK
116 #  define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
117 # else
118 #  define S_ISNWK(m) 0
119 # endif
120 #endif
121
122 #ifndef S_ISPORT /* Solaris 10 and up */
123 # define S_ISPORT(m) 0
124 #endif
125
126 #ifndef S_ISREG
127 # ifdef S_IFREG
128 #  define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
129 # else
130 #  define S_ISREG(m) 0
131 # endif
132 #endif
133
134 #ifndef S_ISSOCK
135 # ifdef S_IFSOCK
136 #  define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
137 # else
138 #  define S_ISSOCK(m) 0
139 # endif
140 #endif
141
142
143 #ifndef S_TYPEISMQ
144 # define S_TYPEISMQ(p) 0
145 #endif
146
147 #ifndef S_TYPEISTMO
148 # define S_TYPEISTMO(p) 0
149 #endif
150
151
152 #ifndef S_TYPEISSEM
153 # ifdef S_INSEM
154 #  define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
155 # else
156 #  define S_TYPEISSEM(p) 0
157 # endif
158 #endif
159
160 #ifndef S_TYPEISSHM
161 # ifdef S_INSHD
162 #  define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
163 # else
164 #  define S_TYPEISSHM(p) 0
165 # endif
166 #endif
167
168 /* high performance ("contiguous data") */
169 #ifndef S_ISCTG
170 # define S_ISCTG(p) 0
171 #endif
172
173 /* Cray DMF (data migration facility): off line, with data  */
174 #ifndef S_ISOFD
175 # define S_ISOFD(p) 0
176 #endif
177
178 /* Cray DMF (data migration facility): off line, with no data  */
179 #ifndef S_ISOFL
180 # define S_ISOFL(p) 0
181 #endif
182
183 /* 4.4BSD whiteout */
184 #ifndef S_ISWHT
185 # define S_ISWHT(m) 0
186 #endif
187
188 /* If any of the following are undefined,
189    define them to their de facto standard values.  */
190 #if !S_ISUID
191 # define S_ISUID 04000
192 #endif
193 #if !S_ISGID
194 # define S_ISGID 02000
195 #endif
196
197 /* S_ISVTX is a common extension to POSIX.  */
198 #ifndef S_ISVTX
199 # define S_ISVTX 01000
200 #endif
201
202 #if !S_IRUSR && S_IREAD
203 # define S_IRUSR S_IREAD
204 #endif
205 #if !S_IRUSR
206 # define S_IRUSR 00400
207 #endif
208 #if !S_IRGRP
209 # define S_IRGRP (S_IRUSR >> 3)
210 #endif
211 #if !S_IROTH
212 # define S_IROTH (S_IRUSR >> 6)
213 #endif
214
215 #if !S_IWUSR && S_IWRITE
216 # define S_IWUSR S_IWRITE
217 #endif
218 #if !S_IWUSR
219 # define S_IWUSR 00200
220 #endif
221 #if !S_IWGRP
222 # define S_IWGRP (S_IWUSR >> 3)
223 #endif
224 #if !S_IWOTH
225 # define S_IWOTH (S_IWUSR >> 6)
226 #endif
227
228 #if !S_IXUSR && S_IEXEC
229 # define S_IXUSR S_IEXEC
230 #endif
231 #if !S_IXUSR
232 # define S_IXUSR 00100
233 #endif
234 #if !S_IXGRP
235 # define S_IXGRP (S_IXUSR >> 3)
236 #endif
237 #if !S_IXOTH
238 # define S_IXOTH (S_IXUSR >> 6)
239 #endif
240
241 #if !S_IRWXU
242 # define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
243 #endif
244 #if !S_IRWXG
245 # define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
246 #endif
247 #if !S_IRWXO
248 # define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
249 #endif
250
251 /* S_IXUGO is a common extension to POSIX.  */
252 #if !S_IXUGO
253 # define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
254 #endif
255
256 #ifndef S_IRWXUGO
257 # define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
258 #endif
259
260 /* mingw does not support symlinks, therefore it does not have lstat.  But
261    without links, stat does just fine.  */
262 #if ! @HAVE_LSTAT@
263 # define lstat stat
264 #endif
265
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@
270 # include <io.h>
271
272 static inline int
273 rpl_mkdir (char const *name, mode_t mode)
274 {
275   return _mkdir (name);
276 }
277
278 # define mkdir rpl_mkdir
279 #endif
280
281 #endif /* _GL_SYS_STAT_H */
282 #endif /* _GL_SYS_STAT_H */