]> git.saurik.com Git - apple/xnu.git/blob - bsd/sys/stat.h
xnu-1228.0.2.tar.gz
[apple/xnu.git] / bsd / sys / stat.h
1 /*
2 * Copyright (c) 2000-2007 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 #ifdef KERNEL
76 #include <machine/types.h>
77 #endif /* KERNEL */
78
79 /* [XSI] The timespec structure may be defined as described in <time.h> */
80 #define __need_struct_timespec
81 #ifdef KERNEL
82 #define __need_struct_user_timespec
83 #endif /* KERNEL */
84 #include <sys/_structs.h>
85
86 /*
87 * [XSI] The blkcnt_t, blksize_t, dev_t, ino_t, mode_t, nlink_t, uid_t,
88 * gid_t, off_t, and time_t types shall be defined as described in
89 * <sys/types.h>.
90 */
91 #ifndef _BLKCNT_T
92 typedef __darwin_blkcnt_t blkcnt_t;
93 #define _BLKCNT_T
94 #endif
95
96 #ifndef _BLKSIZE_T
97 typedef __darwin_blksize_t blksize_t;
98 #define _BLKSIZE_T
99 #endif
100
101 #ifndef _DEV_T
102 typedef __darwin_dev_t dev_t; /* device number */
103 #define _DEV_T
104 #endif
105
106 #ifndef _INO_T
107 typedef __darwin_ino_t ino_t; /* inode number */
108 #define _INO_T
109 #endif
110
111 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
112 #ifndef _INO64_T
113 typedef __darwin_ino64_t ino64_t; /* 64bit inode number */
114 #define _INO64_T
115 #endif
116 #endif /* !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) */
117
118 #ifndef _MODE_T
119 typedef __darwin_mode_t mode_t;
120 #define _MODE_T
121 #endif
122
123 #ifndef _NLINK_T
124 typedef __uint16_t nlink_t; /* link count */
125 #define _NLINK_T
126 #endif
127
128 #ifndef _UID_T
129 typedef __darwin_uid_t uid_t; /* user id */
130 #define _UID_T
131 #endif
132
133 #ifndef _GID_T
134 typedef __darwin_gid_t gid_t;
135 #define _GID_T
136 #endif
137
138 #ifndef _OFF_T
139 typedef __darwin_off_t off_t;
140 #define _OFF_T
141 #endif
142
143 #ifndef _TIME_T
144 #define _TIME_T
145 typedef __darwin_time_t time_t;
146 #endif
147
148
149 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
150 /*
151 * XXX So deprecated, it would make your head spin
152 *
153 * The old stat structure. In fact, this is not used by the kernel at all,
154 * and should not be used by user space, and should be removed from this
155 * header file entirely (along with the unused cvtstat() prototype in
156 * vnode_internal.h).
157 */
158 struct ostat {
159 __uint16_t st_dev; /* inode's device */
160 ino_t st_ino; /* inode's number */
161 mode_t st_mode; /* inode protection mode */
162 nlink_t st_nlink; /* number of hard links */
163 __uint16_t st_uid; /* user ID of the file's owner */
164 __uint16_t st_gid; /* group ID of the file's group */
165 __uint16_t st_rdev; /* device type */
166 __int32_t st_size; /* file size, in bytes */
167 struct timespec st_atimespec; /* time of last access */
168 struct timespec st_mtimespec; /* time of last data modification */
169 struct timespec st_ctimespec; /* time of last file status change */
170 __int32_t st_blksize; /* optimal blocksize for I/O */
171 __int32_t st_blocks; /* blocks allocated for file */
172 __uint32_t st_flags; /* user defined flags for file */
173 __uint32_t st_gen; /* file generation number */
174 };
175
176 #define __DARWIN_STRUCT_STAT64_TIMES \
177 struct timespec st_atimespec; /* time of last access */ \
178 struct timespec st_mtimespec; /* time of last data modification */ \
179 struct timespec st_ctimespec; /* time of last status change */ \
180 struct timespec st_birthtimespec; /* time of file creation(birth) */
181
182 #else /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
183
184 #define __DARWIN_STRUCT_STAT64_TIMES \
185 time_t st_atime; /* [XSI] Time of last access */ \
186 long st_atimensec; /* nsec of last access */ \
187 time_t st_mtime; /* [XSI] Last data modification time */ \
188 long st_mtimensec; /* last data modification nsec */ \
189 time_t st_ctime; /* [XSI] Time of last status change */ \
190 long st_ctimensec; /* nsec of last status change */ \
191 time_t st_birthtime; /* File creation time(birth) */ \
192 long st_birthtimensec; /* nsec of File creation time */
193
194 #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
195
196 /*
197 * This structure is used as the second parameter to the fstat64(),
198 * lstat64(), and stat64() functions, and for struct stat when
199 * __DARWIN_64_BIT_INO_T is set. __DARWIN_STRUCT_STAT64 is defined
200 * above, depending on whether we use struct timespec or the direct
201 * components.
202 *
203 * This is simillar to stat except for 64bit inode number
204 * number instead of 32bit ino_t and the addition of create(birth) time.
205 */
206 #define __DARWIN_STRUCT_STAT64 { \
207 dev_t st_dev; /* [XSI] ID of device containing file */ \
208 mode_t st_mode; /* [XSI] Mode of file (see below) */ \
209 nlink_t st_nlink; /* [XSI] Number of hard links */ \
210 __darwin_ino64_t st_ino; /* [XSI] File serial number */ \
211 uid_t st_uid; /* [XSI] User ID of the file */ \
212 gid_t st_gid; /* [XSI] Group ID of the file */ \
213 dev_t st_rdev; /* [XSI] Device ID */ \
214 __DARWIN_STRUCT_STAT64_TIMES \
215 off_t st_size; /* [XSI] file size, in bytes */ \
216 blkcnt_t st_blocks; /* [XSI] blocks allocated for file */ \
217 blksize_t st_blksize; /* [XSI] optimal blocksize for I/O */ \
218 __uint32_t st_flags; /* user defined flags for file */ \
219 __uint32_t st_gen; /* file generation number */ \
220 __int32_t st_lspare; /* RESERVED: DO NOT USE! */ \
221 __int64_t st_qspare[2]; /* RESERVED: DO NOT USE! */ \
222 }
223
224 /*
225 * [XSI] This structure is used as the second parameter to the fstat(),
226 * lstat(), and stat() functions.
227 */
228 #if __DARWIN_64_BIT_INO_T
229
230 struct stat __DARWIN_STRUCT_STAT64;
231
232 #else /* !__DARWIN_64_BIT_INO_T */
233
234 struct stat {
235 dev_t st_dev; /* [XSI] ID of device containing file */
236 ino_t st_ino; /* [XSI] File serial number */
237 mode_t st_mode; /* [XSI] Mode of file (see below) */
238 nlink_t st_nlink; /* [XSI] Number of hard links */
239 uid_t st_uid; /* [XSI] User ID of the file */
240 gid_t st_gid; /* [XSI] Group ID of the file */
241 dev_t st_rdev; /* [XSI] Device ID */
242 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
243 struct timespec st_atimespec; /* time of last access */
244 struct timespec st_mtimespec; /* time of last data modification */
245 struct timespec st_ctimespec; /* time of last status change */
246 #else
247 time_t st_atime; /* [XSI] Time of last access */
248 long st_atimensec; /* nsec of last access */
249 time_t st_mtime; /* [XSI] Last data modification time */
250 long st_mtimensec; /* last data modification nsec */
251 time_t st_ctime; /* [XSI] Time of last status change */
252 long st_ctimensec; /* nsec of last status change */
253 #endif
254 off_t st_size; /* [XSI] file size, in bytes */
255 blkcnt_t st_blocks; /* [XSI] blocks allocated for file */
256 blksize_t st_blksize; /* [XSI] optimal blocksize for I/O */
257 __uint32_t st_flags; /* user defined flags for file */
258 __uint32_t st_gen; /* file generation number */
259 __int32_t st_lspare; /* RESERVED: DO NOT USE! */
260 __int64_t st_qspare[2]; /* RESERVED: DO NOT USE! */
261 };
262
263 #endif /* __DARWIN_64_BIT_INO_T */
264
265 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
266
267 struct stat64 __DARWIN_STRUCT_STAT64;
268
269 #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
270
271
272 #ifdef KERNEL
273 /* LP64 version of struct stat. time_t (see timespec) is a long and must
274 * grow when we're dealing with a 64-bit process.
275 * WARNING - keep in sync with struct stat
276 */
277
278 struct user_stat {
279 dev_t st_dev; /* [XSI] ID of device containing file */
280 ino_t st_ino; /* [XSI] File serial number */
281 mode_t st_mode; /* [XSI] Mode of file (see below) */
282 nlink_t st_nlink; /* [XSI] Number of hard links */
283 uid_t st_uid; /* [XSI] User ID of the file */
284 gid_t st_gid; /* [XSI] Group ID of the file */
285 dev_t st_rdev; /* [XSI] Device ID */
286 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
287 struct user_timespec st_atimespec; /* time of last access */
288 struct user_timespec st_mtimespec; /* time of last data modification */
289 struct user_timespec st_ctimespec; /* time of last status change */
290 #else
291 user_time_t st_atime; /* [XSI] Time of last access */
292 __int64_t st_atimensec; /* nsec of last access */
293 user_time_t st_mtime; /* [XSI] Last data modification */
294 __int64_t st_mtimensec; /* last data modification nsec */
295 user_time_t st_ctime; /* [XSI] Time of last status change */
296 __int64_t st_ctimensec; /* nsec of last status change */
297 #endif
298 off_t st_size; /* [XSI] File size, in bytes */
299 blkcnt_t st_blocks; /* [XSI] Blocks allocated for file */
300 blksize_t st_blksize; /* [XSI] Optimal blocksize for I/O */
301 __uint32_t st_flags; /* user defined flags for file */
302 __uint32_t st_gen; /* file generation number */
303 __int32_t st_lspare; /* RESERVED: DO NOT USE! */
304 __int64_t st_qspare[2]; /* RESERVED: DO NOT USE! */
305 };
306
307 extern void munge_stat(struct stat *sbp, struct user_stat *usbp);
308
309
310 struct user_stat64 {
311 dev_t st_dev; /* [XSI] ID of device containing file */
312 mode_t st_mode; /* [XSI] Mode of file (see below) */
313 nlink_t st_nlink; /* [XSI] Number of hard links */
314 ino64_t st_ino; /* [XSI] File serial number */
315 uid_t st_uid; /* [XSI] User ID of the file */
316 gid_t st_gid; /* [XSI] Group ID of the file */
317 dev_t st_rdev; /* [XSI] Device ID */
318 #ifndef _POSIX_C_SOURCE
319 struct user_timespec st_atimespec; /* time of last access */
320 struct user_timespec st_mtimespec; /* time of last data modification */
321 struct user_timespec st_ctimespec; /* time of last status change */
322 struct user_timespec st_birthtimespec; /* time of file creation(birth) */
323 #else
324 user_time_t st_atime; /* [XSI] Time of last access */
325 __int64_t st_atimensec; /* nsec of last access */
326 user_time_t st_mtime; /* [XSI] Last data modification time */
327 __int64_t st_mtimensec; /* last data modification nsec */
328 user_time_t st_ctime; /* [XSI] Time of last status change */
329 __int64_t st_ctimensec; /* nsec of last status change */
330 user_time_t st_birthtime; /* File creation time(birth) */
331 __int64_t st_birthtimensec; /* nsec of File creation time */
332 #endif
333 off_t st_size; /* [XSI] file size, in bytes */
334 blkcnt_t st_blocks; /* [XSI] blocks allocated for file */
335 blksize_t st_blksize; /* [XSI] optimal blocksize for I/O */
336 __uint32_t st_flags; /* user defined flags for file */
337 __uint32_t st_gen; /* file generation number */
338 __uint32_t st_lspare; /* RESERVED: DO NOT USE! */
339 __int64_t st_qspare[2]; /* RESERVED: DO NOT USE! */
340 };
341
342 extern void munge_stat64(struct stat64 *sbp, struct user_stat64 *usbp);
343
344 #endif // KERNEL
345
346
347 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
348 #define st_atime st_atimespec.tv_sec
349 #define st_mtime st_mtimespec.tv_sec
350 #define st_ctime st_ctimespec.tv_sec
351 #define st_birthtime st_birthtimespec.tv_sec
352 #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
353
354 /*
355 * [XSI] The following are symbolic names for the values of type mode_t. They
356 * are bitmap values.
357 */
358 #ifndef S_IFMT
359 /* File type */
360 #define S_IFMT 0170000 /* [XSI] type of file mask */
361 #define S_IFIFO 0010000 /* [XSI] named pipe (fifo) */
362 #define S_IFCHR 0020000 /* [XSI] character special */
363 #define S_IFDIR 0040000 /* [XSI] directory */
364 #define S_IFBLK 0060000 /* [XSI] block special */
365 #define S_IFREG 0100000 /* [XSI] regular */
366 #define S_IFLNK 0120000 /* [XSI] symbolic link */
367 #define S_IFSOCK 0140000 /* [XSI] socket */
368 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
369 #define S_IFWHT 0160000 /* whiteout */
370 #define S_IFXATTR 0200000 /* extended attribute */
371 #endif
372
373 /* File mode */
374 /* Read, write, execute/search by owner */
375 #define S_IRWXU 0000700 /* [XSI] RWX mask for owner */
376 #define S_IRUSR 0000400 /* [XSI] R for owner */
377 #define S_IWUSR 0000200 /* [XSI] W for owner */
378 #define S_IXUSR 0000100 /* [XSI] X for owner */
379 /* Read, write, execute/search by group */
380 #define S_IRWXG 0000070 /* [XSI] RWX mask for group */
381 #define S_IRGRP 0000040 /* [XSI] R for group */
382 #define S_IWGRP 0000020 /* [XSI] W for group */
383 #define S_IXGRP 0000010 /* [XSI] X for group */
384 /* Read, write, execute/search by others */
385 #define S_IRWXO 0000007 /* [XSI] RWX mask for other */
386 #define S_IROTH 0000004 /* [XSI] R for other */
387 #define S_IWOTH 0000002 /* [XSI] W for other */
388 #define S_IXOTH 0000001 /* [XSI] X for other */
389
390 #define S_ISUID 0004000 /* [XSI] set user id on execution */
391 #define S_ISGID 0002000 /* [XSI] set group id on execution */
392 #define S_ISVTX 0001000 /* [XSI] directory restrcted delete */
393
394 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
395 #define S_ISTXT S_ISVTX /* sticky bit: not supported */
396 #define S_IREAD S_IRUSR /* backward compatability */
397 #define S_IWRITE S_IWUSR /* backward compatability */
398 #define S_IEXEC S_IXUSR /* backward compatability */
399 #endif
400 #endif /* !S_IFMT */
401
402 /*
403 * [XSI] The following macros shall be provided to test whether a file is
404 * of the specified type. The value m supplied to the macros is the value
405 * of st_mode from a stat structure. The macro shall evaluate to a non-zero
406 * value if the test is true; 0 if the test is false.
407 */
408 #define S_ISBLK(m) (((m) & 0170000) == 0060000) /* block special */
409 #define S_ISCHR(m) (((m) & 0170000) == 0020000) /* char special */
410 #define S_ISDIR(m) (((m) & 0170000) == 0040000) /* directory */
411 #define S_ISFIFO(m) (((m) & 0170000) == 0010000) /* fifo or socket */
412 #define S_ISREG(m) (((m) & 0170000) == 0100000) /* regular file */
413 #define S_ISLNK(m) (((m) & 0170000) == 0120000) /* symbolic link */
414 #define S_ISSOCK(m) (((m) & 0170000) == 0140000) /* socket */
415 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
416 #define S_ISWHT(m) (((m) & 0170000) == 0160000) /* whiteout */
417 #define S_ISXATTR(m) (((m) & 0200000) == 0200000) /* extended attribute */
418 #endif
419
420 /*
421 * [XSI] The implementation may implement message queues, semaphores, or
422 * shared memory objects as distinct file types. The following macros
423 * shall be provided to test whether a file is of the specified type.
424 * The value of the buf argument supplied to the macros is a pointer to
425 * a stat structure. The macro shall evaluate to a non-zero value if
426 * the specified object is implemented as a distinct file type and the
427 * specified file type is contained in the stat structure referenced by
428 * buf. Otherwise, the macro shall evaluate to zero.
429 *
430 * NOTE: The current implementation does not do this, although
431 * this may change in future revisions, and co currently only
432 * provides these macros to ensure source compatability with
433 * implementations which do.
434 */
435 #define S_TYPEISMQ(buf) (0) /* Test for a message queue */
436 #define S_TYPEISSEM(buf) (0) /* Test for a semaphore */
437 #define S_TYPEISSHM(buf) (0) /* Test for a shared memory object */
438
439 /*
440 * [TYM] The implementation may implement typed memory objects as distinct
441 * file types, and the following macro shall test whether a file is of the
442 * specified type. The value of the buf argument supplied to the macros is
443 * a pointer to a stat structure. The macro shall evaluate to a non-zero
444 * value if the specified object is implemented as a distinct file type and
445 * the specified file type is contained in the stat structure referenced by
446 * buf. Otherwise, the macro shall evaluate to zero.
447 *
448 * NOTE: The current implementation does not do this, although
449 * this may change in future revisions, and co currently only
450 * provides this macro to ensure source compatability with
451 * implementations which do.
452 */
453 #define S_TYPEISTMO(buf) (0) /* Test for a typed memory object */
454
455
456 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
457 #define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
458 /* 7777 */
459 #define ALLPERMS (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO)
460 /* 0666 */
461 #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
462
463 #define S_BLKSIZE 512 /* block size used in the stat struct */
464
465 /*
466 * Definitions of flags stored in file flags word.
467 *
468 * Super-user and owner changeable flags.
469 */
470 #define UF_SETTABLE 0x0000ffff /* mask of owner changeable flags */
471 #define UF_NODUMP 0x00000001 /* do not dump file */
472 #define UF_IMMUTABLE 0x00000002 /* file may not be changed */
473 #define UF_APPEND 0x00000004 /* writes to file may only append */
474 #define UF_OPAQUE 0x00000008 /* directory is opaque wrt. union */
475 /*
476 * The following bit is reserved for FreeBSD. It is not implemented
477 * in Mac OS X.
478 */
479 /* #define UF_NOUNLINK 0x00000010 */ /* file may not be removed or renamed */
480 /* Bits 0x0020 through 0x4000 are currently undefined. */
481 #define UF_HIDDEN 0x00008000 /* hint that this item should not be */
482 /* displayed in a GUI */
483 /*
484 * Super-user changeable flags.
485 */
486 #define SF_SETTABLE 0xffff0000 /* mask of superuser changeable flags */
487 #define SF_ARCHIVED 0x00010000 /* file is archived */
488 #define SF_IMMUTABLE 0x00020000 /* file may not be changed */
489 #define SF_APPEND 0x00040000 /* writes to file may only append */
490 /*
491 * The following two bits are reserved for FreeBSD. They are not
492 * implemented in Mac OS X.
493 */
494 /* #define SF_NOUNLINK 0x00100000 */ /* file may not be removed or renamed */
495 /* #define SF_SNAPSHOT 0x00200000 */ /* snapshot inode */
496 /* NOTE: There is no SF_HIDDEN bit. */
497
498 #ifdef KERNEL
499 /*
500 * Shorthand abbreviations of above.
501 */
502 #define OPAQUE (UF_OPAQUE)
503 #define APPEND (UF_APPEND | SF_APPEND)
504 #define IMMUTABLE (UF_IMMUTABLE | SF_IMMUTABLE)
505 #endif
506 #endif
507
508 #ifndef KERNEL
509
510 __BEGIN_DECLS
511 /* [XSI] */
512 int chmod(const char *, mode_t) __DARWIN_ALIAS(chmod);
513 int fchmod(int, mode_t) __DARWIN_ALIAS(fchmod);
514 int fstat(int, struct stat *) __DARWIN_INODE64(fstat);
515 int lstat(const char *, struct stat *) __DARWIN_INODE64(lstat);
516 int mkdir(const char *, mode_t);
517 int mkfifo(const char *, mode_t);
518 int stat(const char *, struct stat *) __DARWIN_INODE64(stat);
519 int mknod(const char *, mode_t, dev_t);
520 mode_t umask(mode_t);
521
522 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
523 #ifndef _FILESEC_T
524 struct _filesec;
525 typedef struct _filesec *filesec_t;
526 #define _FILESEC_T
527 #endif
528 int chflags(const char *, __uint32_t);
529 int chmodx_np(const char *, filesec_t);
530 int fchflags(int, __uint32_t);
531 int fchmodx_np(int, filesec_t);
532 int fstatx_np(int, struct stat *, filesec_t) __DARWIN_INODE64(fstatx_np);
533 int lchflags(const char *, __uint32_t);
534 int lchmod(const char *, mode_t);
535 int lstatx_np(const char *, struct stat *, filesec_t) __DARWIN_INODE64(lstatx_np);
536 int mkdirx_np(const char *, filesec_t);
537 int mkfifox_np(const char *, filesec_t);
538 int statx_np(const char *, struct stat *, filesec_t) __DARWIN_INODE64(statx_np);
539 int umaskx_np(filesec_t);
540 /* The following are simillar to stat and friends except provide struct stat64 instead of struct stat */
541 int fstatx64_np(int, struct stat64 *, filesec_t);
542 int lstatx64_np(const char *, struct stat64 *, filesec_t);
543 int statx64_np(const char *, struct stat64 *, filesec_t);
544 int fstat64(int, struct stat64 *);
545 int lstat64(const char *, struct stat64 *);
546 int stat64(const char *, struct stat64 *);
547 #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
548
549 __END_DECLS
550 #endif
551 #endif /* !_SYS_STAT_H_ */