1 | /*␊ |
2 | * Copyright (c) 2000-2008 Apple Inc. All rights reserved.␊ |
3 | *␊ |
4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@␊ |
5 | * ␊ |
6 | * This file contains Original Code and/or Modifications of Original Code␊ |
7 | * as defined in and that are subject to the Apple Public Source License␊ |
8 | * Version 2.0 (the 'License'). You may not use this file except in␊ |
9 | * compliance with the License. The rights granted to you under the License␊ |
10 | * may not be used to create, or enable the creation or redistribution of,␊ |
11 | * unlawful or unlicensed copies of an Apple operating system, or to␊ |
12 | * circumvent, violate, or enable the circumvention or violation of, any␊ |
13 | * terms of an Apple operating system software license agreement.␊ |
14 | * ␊ |
15 | * Please obtain a copy of the License at␊ |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file.␊ |
17 | * ␊ |
18 | * The Original Code and all software distributed under the License are␊ |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER␊ |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,␊ |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,␊ |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.␊ |
23 | * Please see the License for the specific language governing rights and␊ |
24 | * limitations under the License.␊ |
25 | * ␊ |
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@␊ |
27 | */␊ |
28 | /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */␊ |
29 | /*-␊ |
30 | * Copyright (c) 1982, 1986, 1989, 1993␊ |
31 | *␉The Regents of the University of California. All rights reserved.␊ |
32 | * (c) UNIX System Laboratories, Inc.␊ |
33 | * All or some portions of this file are derived from material licensed␊ |
34 | * to the University of California by American Telephone and Telegraph␊ |
35 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with␊ |
36 | * the permission of UNIX System Laboratories, Inc.␊ |
37 | *␊ |
38 | * Redistribution and use in source and binary forms, with or without␊ |
39 | * modification, are permitted provided that the following conditions␊ |
40 | * are met:␊ |
41 | * 1. Redistributions of source code must retain the above copyright␊ |
42 | * notice, this list of conditions and the following disclaimer.␊ |
43 | * 2. Redistributions in binary form must reproduce the above copyright␊ |
44 | * notice, this list of conditions and the following disclaimer in the␊ |
45 | * documentation and/or other materials provided with the distribution.␊ |
46 | * 3. All advertising materials mentioning features or use of this software␊ |
47 | * must display the following acknowledgement:␊ |
48 | *␉This product includes software developed by the University of␊ |
49 | *␉California, Berkeley and its contributors.␊ |
50 | * 4. Neither the name of the University nor the names of its contributors␊ |
51 | * may be used to endorse or promote products derived from this software␊ |
52 | * without specific prior written permission.␊ |
53 | *␊ |
54 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND␊ |
55 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE␊ |
56 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE␊ |
57 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE␊ |
58 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL␊ |
59 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS␊ |
60 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)␊ |
61 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT␊ |
62 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY␊ |
63 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF␊ |
64 | * SUCH DAMAGE.␊ |
65 | *␊ |
66 | *␉@(#)stat.h␉8.9 (Berkeley) 8/17/94␊ |
67 | */␊ |
68 | ␊ |
69 | ␊ |
70 | #ifndef _SYS_STAT_H_␊ |
71 | #define␉_SYS_STAT_H_␊ |
72 | ␊ |
73 | #include <sys/_types.h>␊ |
74 | #include <sys/cdefs.h>␊ |
75 | #include <Availability.h>␊ |
76 | ␊ |
77 | /* [XSI] The timespec structure may be defined as described in <time.h> */␊ |
78 | #define __need_struct_timespec␊ |
79 | #include <sys/_structs.h>␊ |
80 | ␊ |
81 | /*␊ |
82 | * [XSI] The blkcnt_t, blksize_t, dev_t, ino_t, mode_t, nlink_t, uid_t,␊ |
83 | * gid_t, off_t, and time_t types shall be defined as described in␊ |
84 | * <sys/types.h>.␊ |
85 | */␊ |
86 | #ifndef _BLKCNT_T␊ |
87 | typedef␉__darwin_blkcnt_t␉blkcnt_t;␊ |
88 | #define␉_BLKCNT_T␊ |
89 | #endif␊ |
90 | ␊ |
91 | #ifndef _BLKSIZE_T␊ |
92 | typedef␉__darwin_blksize_t␉blksize_t;␊ |
93 | #define␉_BLKSIZE_T␊ |
94 | #endif␊ |
95 | ␊ |
96 | #ifndef _DEV_T␊ |
97 | typedef␉__darwin_dev_t␉␉dev_t;␉␉/* device number */␊ |
98 | #define _DEV_T␊ |
99 | #endif␊ |
100 | ␊ |
101 | #ifndef␉_INO_T␊ |
102 | typedef␉__darwin_ino_t␉␉ino_t;␉␉/* inode number */␊ |
103 | #define _INO_T␊ |
104 | #endif␊ |
105 | ␊ |
106 | #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)␊ |
107 | #ifndef␉_INO64_T␊ |
108 | typedef␉__darwin_ino64_t␉ino64_t;␉/* 64bit inode number */␊ |
109 | #define _INO64_T␊ |
110 | #endif␊ |
111 | #endif /* !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) */␊ |
112 | ␊ |
113 | #ifndef␉_MODE_T␊ |
114 | typedef␉__darwin_mode_t␉␉mode_t;␊ |
115 | #define _MODE_T␊ |
116 | #endif␊ |
117 | ␊ |
118 | #ifndef _NLINK_T␊ |
119 | typedef␉__uint16_t␉␉nlink_t;␉/* link count */␊ |
120 | #define␉_NLINK_T␊ |
121 | #endif␊ |
122 | ␊ |
123 | #ifndef _UID_T␊ |
124 | typedef __darwin_uid_t␉␉uid_t;␉␉/* user id */␊ |
125 | #define _UID_T␊ |
126 | #endif␊ |
127 | ␊ |
128 | #ifndef _GID_T␊ |
129 | typedef __darwin_gid_t␉␉gid_t;␊ |
130 | #define _GID_T␊ |
131 | #endif␊ |
132 | ␊ |
133 | #ifndef _OFF_T␊ |
134 | typedef __darwin_off_t␉␉off_t;␊ |
135 | #define _OFF_T␊ |
136 | #endif␊ |
137 | ␊ |
138 | #ifndef␉_TIME_T␊ |
139 | #define␉_TIME_T␊ |
140 | typedef␉__darwin_time_t␉␉time_t;␊ |
141 | #endif␊ |
142 | ␊ |
143 | ␊ |
144 | #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)␊ |
145 | /*␊ |
146 | * XXX So deprecated, it would make your head spin␊ |
147 | *␊ |
148 | * The old stat structure. In fact, this is not used by the kernel at all,␊ |
149 | * and should not be used by user space, and should be removed from this␊ |
150 | * header file entirely (along with the unused cvtstat() prototype in␊ |
151 | * vnode_internal.h).␊ |
152 | */␊ |
153 | struct ostat {␊ |
154 | ␉__uint16_t␉st_dev;␉␉/* inode's device */␊ |
155 | ␉ino_t␉␉st_ino;␉␉/* inode's number */␊ |
156 | ␉mode_t␉␉st_mode;␉/* inode protection mode */␊ |
157 | ␉nlink_t␉␉st_nlink;␉/* number of hard links */␊ |
158 | ␉__uint16_t␉st_uid;␉␉/* user ID of the file's owner */␊ |
159 | ␉__uint16_t␉st_gid;␉␉/* group ID of the file's group */␊ |
160 | ␉__uint16_t␉st_rdev;␉/* device type */␊ |
161 | ␉__int32_t␉st_size;␉/* file size, in bytes */␊ |
162 | ␉struct␉timespec st_atimespec;␉/* time of last access */␊ |
163 | ␉struct␉timespec st_mtimespec;␉/* time of last data modification */␊ |
164 | ␉struct␉timespec st_ctimespec;␉/* time of last file status change */␊ |
165 | ␉__int32_t␉st_blksize;␉/* optimal blocksize for I/O */␊ |
166 | ␉__int32_t␉st_blocks;␉/* blocks allocated for file */␊ |
167 | ␉__uint32_t␉st_flags;␉/* user defined flags for file */␊ |
168 | ␉__uint32_t␉st_gen;␉␉/* file generation number */␊ |
169 | };␊ |
170 | ␊ |
171 | #define __DARWIN_STRUCT_STAT64_TIMES \␊ |
172 | ␉struct timespec st_atimespec;␉␉/* time of last access */ \␊ |
173 | ␉struct timespec st_mtimespec;␉␉/* time of last data modification */ \␊ |
174 | ␉struct timespec st_ctimespec;␉␉/* time of last status change */ \␊ |
175 | ␉struct timespec st_birthtimespec;␉/* time of file creation(birth) */␊ |
176 | ␊ |
177 | #else /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */␊ |
178 | ␊ |
179 | #define __DARWIN_STRUCT_STAT64_TIMES \␊ |
180 | ␉time_t␉␉st_atime;␉␉/* [XSI] Time of last access */ \␊ |
181 | ␉long␉␉st_atimensec;␉␉/* nsec of last access */ \␊ |
182 | ␉time_t␉␉st_mtime;␉␉/* [XSI] Last data modification time */ \␊ |
183 | ␉long␉␉st_mtimensec;␉␉/* last data modification nsec */ \␊ |
184 | ␉time_t␉␉st_ctime;␉␉/* [XSI] Time of last status change */ \␊ |
185 | ␉long␉␉st_ctimensec;␉␉/* nsec of last status change */ \␊ |
186 | ␉time_t␉␉st_birthtime;␉␉/* File creation time(birth) */ \␊ |
187 | ␉long␉␉st_birthtimensec;␉/* nsec of File creation time */␊ |
188 | ␊ |
189 | #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */␊ |
190 | ␊ |
191 | /*␊ |
192 | * This structure is used as the second parameter to the fstat64(),␊ |
193 | * lstat64(), and stat64() functions, and for struct stat when␊ |
194 | * __DARWIN_64_BIT_INO_T is set. __DARWIN_STRUCT_STAT64 is defined␊ |
195 | * above, depending on whether we use struct timespec or the direct␊ |
196 | * components.␊ |
197 | *␊ |
198 | * This is simillar to stat except for 64bit inode number␊ |
199 | * number instead of 32bit ino_t and the addition of create(birth) time.␊ |
200 | */␊ |
201 | #define __DARWIN_STRUCT_STAT64 { \␊ |
202 | ␉dev_t␉␉st_dev;␉␉␉/* [XSI] ID of device containing file */ \␊ |
203 | ␉mode_t␉␉st_mode;␉␉/* [XSI] Mode of file (see below) */ \␊ |
204 | ␉nlink_t␉␉st_nlink;␉␉/* [XSI] Number of hard links */ \␊ |
205 | ␉__darwin_ino64_t st_ino;␉␉/* [XSI] File serial number */ \␊ |
206 | ␉uid_t␉␉st_uid;␉␉␉/* [XSI] User ID of the file */ \␊ |
207 | ␉gid_t␉␉st_gid;␉␉␉/* [XSI] Group ID of the file */ \␊ |
208 | ␉dev_t␉␉st_rdev;␉␉/* [XSI] Device ID */ \␊ |
209 | ␉__DARWIN_STRUCT_STAT64_TIMES \␊ |
210 | ␉off_t␉␉st_size;␉␉/* [XSI] file size, in bytes */ \␊ |
211 | ␉blkcnt_t␉st_blocks;␉␉/* [XSI] blocks allocated for file */ \␊ |
212 | ␉blksize_t␉st_blksize;␉␉/* [XSI] optimal blocksize for I/O */ \␊ |
213 | ␉__uint32_t␉st_flags;␉␉/* user defined flags for file */ \␊ |
214 | ␉__uint32_t␉st_gen;␉␉␉/* file generation number */ \␊ |
215 | ␉__int32_t␉st_lspare;␉␉/* RESERVED: DO NOT USE! */ \␊ |
216 | ␉__int64_t␉st_qspare[2];␉␉/* RESERVED: DO NOT USE! */ \␊ |
217 | }␊ |
218 | ␊ |
219 | /*␊ |
220 | * [XSI] This structure is used as the second parameter to the fstat(),␊ |
221 | * lstat(), and stat() functions.␊ |
222 | */␊ |
223 | #if __DARWIN_64_BIT_INO_T␊ |
224 | ␊ |
225 | struct stat __DARWIN_STRUCT_STAT64;␊ |
226 | ␊ |
227 | #else /* !__DARWIN_64_BIT_INO_T */␊ |
228 | ␊ |
229 | struct stat {␊ |
230 | ␉dev_t␉ ␉st_dev;␉␉/* [XSI] ID of device containing file */␊ |
231 | ␉ino_t␉ ␉st_ino;␉␉/* [XSI] File serial number */␊ |
232 | ␉mode_t␉ ␉st_mode;␉/* [XSI] Mode of file (see below) */␊ |
233 | ␉nlink_t␉␉st_nlink;␉/* [XSI] Number of hard links */␊ |
234 | ␉uid_t␉␉st_uid;␉␉/* [XSI] User ID of the file */␊ |
235 | ␉gid_t␉␉st_gid;␉␉/* [XSI] Group ID of the file */␊ |
236 | ␉dev_t␉␉st_rdev;␉/* [XSI] Device ID */␊ |
237 | #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)␊ |
238 | ␉struct␉timespec st_atimespec;␉/* time of last access */␊ |
239 | ␉struct␉timespec st_mtimespec;␉/* time of last data modification */␊ |
240 | ␉struct␉timespec st_ctimespec;␉/* time of last status change */␊ |
241 | #else␊ |
242 | ␉time_t␉␉st_atime;␉/* [XSI] Time of last access */␊ |
243 | ␉long␉␉st_atimensec;␉/* nsec of last access */␊ |
244 | ␉time_t␉␉st_mtime;␉/* [XSI] Last data modification time */␊ |
245 | ␉long␉␉st_mtimensec;␉/* last data modification nsec */␊ |
246 | ␉time_t␉␉st_ctime;␉/* [XSI] Time of last status change */␊ |
247 | ␉long␉␉st_ctimensec;␉/* nsec of last status change */␊ |
248 | #endif␊ |
249 | ␉off_t␉␉st_size;␉/* [XSI] file size, in bytes */␊ |
250 | ␉blkcnt_t␉st_blocks;␉/* [XSI] blocks allocated for file */␊ |
251 | ␉blksize_t␉st_blksize;␉/* [XSI] optimal blocksize for I/O */␊ |
252 | ␉__uint32_t␉st_flags;␉/* user defined flags for file */␊ |
253 | ␉__uint32_t␉st_gen;␉␉/* file generation number */␊ |
254 | ␉__int32_t␉st_lspare;␉/* RESERVED: DO NOT USE! */␊ |
255 | ␉__int64_t␉st_qspare[2];␉/* RESERVED: DO NOT USE! */␊ |
256 | };␊ |
257 | ␊ |
258 | #endif /* __DARWIN_64_BIT_INO_T */␊ |
259 | ␊ |
260 | #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)␊ |
261 | ␊ |
262 | #if !__DARWIN_ONLY_64_BIT_INO_T␊ |
263 | ␊ |
264 | struct stat64 __DARWIN_STRUCT_STAT64;␊ |
265 | ␊ |
266 | #endif /* !__DARWIN_ONLY_64_BIT_INO_T */␊ |
267 | ␊ |
268 | #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */␊ |
269 | ␊ |
270 | ␊ |
271 | ␊ |
272 | ␊ |
273 | #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)␊ |
274 | #define st_atime st_atimespec.tv_sec␊ |
275 | #define st_mtime st_mtimespec.tv_sec␊ |
276 | #define st_ctime st_ctimespec.tv_sec␊ |
277 | #define st_birthtime st_birthtimespec.tv_sec␊ |
278 | #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */␊ |
279 | ␊ |
280 | /*␊ |
281 | * [XSI] The following are symbolic names for the values of type mode_t. They␊ |
282 | * are bitmap values.␊ |
283 | */␊ |
284 | #ifndef S_IFMT␊ |
285 | /* File type */␊ |
286 | #define␉S_IFMT␉␉0170000␉␉/* [XSI] type of file mask */␊ |
287 | #define␉S_IFIFO␉␉0010000␉␉/* [XSI] named pipe (fifo) */␊ |
288 | #define␉S_IFCHR␉␉0020000␉␉/* [XSI] character special */␊ |
289 | #define␉S_IFDIR␉␉0040000␉␉/* [XSI] directory */␊ |
290 | #define␉S_IFBLK␉␉0060000␉␉/* [XSI] block special */␊ |
291 | #define␉S_IFREG␉␉0100000␉␉/* [XSI] regular */␊ |
292 | #define␉S_IFLNK␉␉0120000␉␉/* [XSI] symbolic link */␊ |
293 | #define␉S_IFSOCK␉0140000␉␉/* [XSI] socket */␊ |
294 | #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)␊ |
295 | #define␉S_IFWHT␉␉0160000␉␉/* OBSOLETE: whiteout */␊ |
296 | #endif␊ |
297 | ␊ |
298 | /* File mode */␊ |
299 | /* Read, write, execute/search by owner */␊ |
300 | #define␉S_IRWXU␉␉0000700␉␉/* [XSI] RWX mask for owner */␊ |
301 | #define␉S_IRUSR␉␉0000400␉␉/* [XSI] R for owner */␊ |
302 | #define␉S_IWUSR␉␉0000200␉␉/* [XSI] W for owner */␊ |
303 | #define␉S_IXUSR␉␉0000100␉␉/* [XSI] X for owner */␊ |
304 | /* Read, write, execute/search by group */␊ |
305 | #define␉S_IRWXG␉␉0000070␉␉/* [XSI] RWX mask for group */␊ |
306 | #define␉S_IRGRP␉␉0000040␉␉/* [XSI] R for group */␊ |
307 | #define␉S_IWGRP␉␉0000020␉␉/* [XSI] W for group */␊ |
308 | #define␉S_IXGRP␉␉0000010␉␉/* [XSI] X for group */␊ |
309 | /* Read, write, execute/search by others */␊ |
310 | #define␉S_IRWXO␉␉0000007␉␉/* [XSI] RWX mask for other */␊ |
311 | #define␉S_IROTH␉␉0000004␉␉/* [XSI] R for other */␊ |
312 | #define␉S_IWOTH␉␉0000002␉␉/* [XSI] W for other */␊ |
313 | #define␉S_IXOTH␉␉0000001␉␉/* [XSI] X for other */␊ |
314 | ␊ |
315 | #define␉S_ISUID␉␉0004000␉␉/* [XSI] set user id on execution */␊ |
316 | #define␉S_ISGID␉␉0002000␉␉/* [XSI] set group id on execution */␊ |
317 | #define␉S_ISVTX␉␉0001000␉␉/* [XSI] directory restrcted delete */␊ |
318 | ␊ |
319 | #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)␊ |
320 | #define␉S_ISTXT␉␉S_ISVTX␉␉/* sticky bit: not supported */␊ |
321 | #define␉S_IREAD␉␉S_IRUSR␉␉/* backward compatability */␊ |
322 | #define␉S_IWRITE␉S_IWUSR␉␉/* backward compatability */␊ |
323 | #define␉S_IEXEC␉␉S_IXUSR␉␉/* backward compatability */␊ |
324 | #endif␊ |
325 | #endif␉/* !S_IFMT */␊ |
326 | ␊ |
327 | /*␊ |
328 | * [XSI] The following macros shall be provided to test whether a file is␊ |
329 | * of the specified type. The value m supplied to the macros is the value␊ |
330 | * of st_mode from a stat structure. The macro shall evaluate to a non-zero␊ |
331 | * value if the test is true; 0 if the test is false.␊ |
332 | */␊ |
333 | #define␉S_ISBLK(m)␉(((m) & S_IFMT) == S_IFBLK)␉/* block special */␊ |
334 | #define␉S_ISCHR(m)␉(((m) & S_IFMT) == S_IFCHR)␉/* char special */␊ |
335 | #define␉S_ISDIR(m)␉(((m) & S_IFMT) == S_IFDIR)␉/* directory */␊ |
336 | #define␉S_ISFIFO(m)␉(((m) & S_IFMT) == S_IFIFO)␉/* fifo or socket */␊ |
337 | #define␉S_ISREG(m)␉(((m) & S_IFMT) == S_IFREG)␉/* regular file */␊ |
338 | #define␉S_ISLNK(m)␉(((m) & S_IFMT) == S_IFLNK)␉/* symbolic link */␊ |
339 | #define␉S_ISSOCK(m)␉(((m) & S_IFMT) == S_IFSOCK)␉/* socket */␊ |
340 | #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)␊ |
341 | #define␉S_ISWHT(m)␉(((m) & S_IFMT) == S_IFWHT)␉/* OBSOLETE: whiteout */␊ |
342 | #endif␊ |
343 | ␊ |
344 | /*␊ |
345 | * [XSI] The implementation may implement message queues, semaphores, or␊ |
346 | * shared memory objects as distinct file types. The following macros␊ |
347 | * shall be provided to test whether a file is of the specified type.␊ |
348 | * The value of the buf argument supplied to the macros is a pointer to␊ |
349 | * a stat structure. The macro shall evaluate to a non-zero value if␊ |
350 | * the specified object is implemented as a distinct file type and the␊ |
351 | * specified file type is contained in the stat structure referenced by␊ |
352 | * buf. Otherwise, the macro shall evaluate to zero.␊ |
353 | *␊ |
354 | * NOTE:␉The current implementation does not do this, although␊ |
355 | *␉␉this may change in future revisions, and co currently only␊ |
356 | *␉␉provides these macros to ensure source compatability with␊ |
357 | *␉␉implementations which do.␊ |
358 | */␊ |
359 | #define␉S_TYPEISMQ(buf)␉␉(0)␉/* Test for a message queue */␊ |
360 | #define␉S_TYPEISSEM(buf)␉(0)␉/* Test for a semaphore */␊ |
361 | #define␉S_TYPEISSHM(buf)␉(0)␉/* Test for a shared memory object */␊ |
362 | ␊ |
363 | /*␊ |
364 | * [TYM] The implementation may implement typed memory objects as distinct␊ |
365 | * file types, and the following macro shall test whether a file is of the␊ |
366 | * specified type. The value of the buf argument supplied to the macros is␊ |
367 | * a pointer to a stat structure. The macro shall evaluate to a non-zero␊ |
368 | * value if the specified object is implemented as a distinct file type and␊ |
369 | * the specified file type is contained in the stat structure referenced by␊ |
370 | * buf. Otherwise, the macro shall evaluate to zero.␊ |
371 | *␊ |
372 | * NOTE:␉The current implementation does not do this, although␊ |
373 | *␉␉this may change in future revisions, and co currently only␊ |
374 | *␉␉provides this macro to ensure source compatability with␊ |
375 | *␉␉implementations which do.␊ |
376 | */␊ |
377 | #define␉S_TYPEISTMO(buf)␉(0)␉/* Test for a typed memory object */␊ |
378 | ␊ |
379 | ␊ |
380 | #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)␊ |
381 | #define␉ACCESSPERMS␉(S_IRWXU|S_IRWXG|S_IRWXO)␉/* 0777 */␊ |
382 | ␉␉␉␉␉␉␉/* 7777 */␊ |
383 | #define␉ALLPERMS␉(S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO)␊ |
384 | ␉␉␉␉␉␉␉/* 0666 */␊ |
385 | #define␉DEFFILEMODE␉(S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)␊ |
386 | ␊ |
387 | #define S_BLKSIZE␉512␉␉/* block size used in the stat struct */␊ |
388 | ␊ |
389 | /*␊ |
390 | * Definitions of flags stored in file flags word.␊ |
391 | *␊ |
392 | * Super-user and owner changeable flags.␊ |
393 | */␊ |
394 | #define␉UF_SETTABLE␉0x0000ffff␉/* mask of owner changeable flags */␊ |
395 | #define␉UF_NODUMP␉0x00000001␉/* do not dump file */␊ |
396 | #define␉UF_IMMUTABLE␉0x00000002␉/* file may not be changed */␊ |
397 | #define␉UF_APPEND␉0x00000004␉/* writes to file may only append */␊ |
398 | #define UF_OPAQUE␉0x00000008␉/* directory is opaque wrt. union */␊ |
399 | /*␊ |
400 | * The following bit is reserved for FreeBSD. It is not implemented␊ |
401 | * in Mac OS X.␊ |
402 | */␊ |
403 | /* #define UF_NOUNLINK␉0x00000010 */␉/* file may not be removed or renamed */␊ |
404 | #define UF_COMPRESSED␉0x00000020␉/* file is hfs-compressed */␊ |
405 | #define UF_TRACKED␉␉0x00000040␉/* file renames and deletes are tracked */␊ |
406 | /* Bits 0x0080 through 0x4000 are currently undefined. */␊ |
407 | #define UF_HIDDEN␉0x00008000␉/* hint that this item should not be */␊ |
408 | ␉␉␉␉␉/* displayed in a GUI */␊ |
409 | /*␊ |
410 | * Super-user changeable flags.␊ |
411 | */␊ |
412 | #define␉SF_SETTABLE␉0xffff0000␉/* mask of superuser changeable flags */␊ |
413 | #define␉SF_ARCHIVED␉0x00010000␉/* file is archived */␊ |
414 | #define␉SF_IMMUTABLE␉0x00020000␉/* file may not be changed */␊ |
415 | #define␉SF_APPEND␉0x00040000␉/* writes to file may only append */␊ |
416 | ␊ |
417 | /*␊ |
418 | * The following two bits are reserved for FreeBSD. They are not␊ |
419 | * implemented in Mac OS X.␊ |
420 | */␊ |
421 | /* #define SF_NOUNLINK␉0x00100000 */␉/* file may not be removed or renamed */␊ |
422 | /* #define SF_SNAPSHOT␉0x00200000 */␉/* snapshot inode */␊ |
423 | /* NOTE: There is no SF_HIDDEN bit. */␊ |
424 | ␊ |
425 | #endif␊ |
426 | ␊ |
427 | ␊ |
428 | __BEGIN_DECLS␊ |
429 | /* [XSI] */␊ |
430 | int␉fstat(int, struct stat *) ;␊ |
431 | __END_DECLS␊ |
432 | #endif /* !_SYS_STAT_H_ */␊ |
433 | |