1 | /* |
2 | * Copyright (c) 2003-2012 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 | |
29 | /* |
30 | * [XSI] The symbolic names for file modes for use as values of mode_t |
31 | * shall be defined as described in <sys/stat.h> |
32 | */ |
33 | #ifndef S_IFMT |
34 | /* File type */ |
35 | #define S_IFMT 0170000 /* [XSI] type of file mask */ |
36 | #define S_IFIFO 0010000 /* [XSI] named pipe (fifo) */ |
37 | #define S_IFCHR 0020000 /* [XSI] character special */ |
38 | #define S_IFDIR 0040000 /* [XSI] directory */ |
39 | #define S_IFBLK 0060000 /* [XSI] block special */ |
40 | #define S_IFREG 0100000 /* [XSI] regular */ |
41 | #define S_IFLNK 0120000 /* [XSI] symbolic link */ |
42 | #define S_IFSOCK 0140000 /* [XSI] socket */ |
43 | #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) |
44 | #define S_IFWHT 0160000 /* OBSOLETE: whiteout */ |
45 | #endif |
46 | |
47 | /* File mode */ |
48 | /* Read, write, execute/search by owner */ |
49 | #define S_IRWXU 0000700 /* [XSI] RWX mask for owner */ |
50 | #define S_IRUSR 0000400 /* [XSI] R for owner */ |
51 | #define S_IWUSR 0000200 /* [XSI] W for owner */ |
52 | #define S_IXUSR 0000100 /* [XSI] X for owner */ |
53 | /* Read, write, execute/search by group */ |
54 | #define S_IRWXG 0000070 /* [XSI] RWX mask for group */ |
55 | #define S_IRGRP 0000040 /* [XSI] R for group */ |
56 | #define S_IWGRP 0000020 /* [XSI] W for group */ |
57 | #define S_IXGRP 0000010 /* [XSI] X for group */ |
58 | /* Read, write, execute/search by others */ |
59 | #define S_IRWXO 0000007 /* [XSI] RWX mask for other */ |
60 | #define S_IROTH 0000004 /* [XSI] R for other */ |
61 | #define S_IWOTH 0000002 /* [XSI] W for other */ |
62 | #define S_IXOTH 0000001 /* [XSI] X for other */ |
63 | |
64 | #define S_ISUID 0004000 /* [XSI] set user id on execution */ |
65 | #define S_ISGID 0002000 /* [XSI] set group id on execution */ |
66 | #define S_ISVTX 0001000 /* [XSI] directory restrcted delete */ |
67 | |
68 | #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) |
69 | #define S_ISTXT S_ISVTX /* sticky bit: not supported */ |
70 | #define S_IREAD S_IRUSR /* backward compatability */ |
71 | #define S_IWRITE S_IWUSR /* backward compatability */ |
72 | #define S_IEXEC S_IXUSR /* backward compatability */ |
73 | #endif |
74 | #endif /* !S_IFMT */ |
75 | |