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