| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2008 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2008 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /* | 7 /* |
| 8 * NaCl Service Runtime API. | 8 * NaCl Service Runtime API. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #ifndef NATIVE_CLIENT_SRC_TRUSTED_SERVICE_RUNTIME_INCLUDE_BITS_STAT_H_ | 11 #ifndef NATIVE_CLIENT_SRC_TRUSTED_SERVICE_RUNTIME_INCLUDE_BITS_STAT_H_ |
| 12 #define NATIVE_CLIENT_SRC_TRUSTED_SERVICE_RUNTIME_INCLUDE_BITS_STAT_H_ | 12 #define NATIVE_CLIENT_SRC_TRUSTED_SERVICE_RUNTIME_INCLUDE_BITS_STAT_H_ |
| 13 | 13 |
| 14 /* | 14 /* |
| 15 * nacl_abi_mode_t is uint32_t, so we have more bits to play with: | 15 * nacl_abi_mode_t is uint32_t, so we have more bits to play with: |
| 16 * | 16 * |
| 17 * 3 b/octal digit, 30 bits: 1234567890 | 17 * 3 b/octal digit, 30 bits: 1234567890 |
| 18 */ | 18 */ |
| 19 #define NACL_ABI_S_IFMT 0000370000 /* for now */ | 19 #define NACL_ABI_S_IFMT 0000370000 /* for now */ |
| 20 #define NACL_ABI_S_IFSHM_SYSV 0000300000 /* must map all-or-nothing */ | 20 /* Removed NACL_ABI_S_IFSHM_SYSV, which was 0000300000. */ |
| 21 #define NACL_ABI_S_IFSEMA 0000270000 | 21 #define NACL_ABI_S_IFSEMA 0000270000 |
| 22 #define NACL_ABI_S_IFCOND 0000260000 | 22 #define NACL_ABI_S_IFCOND 0000260000 |
| 23 #define NACL_ABI_S_IFMUTEX 0000250000 | 23 #define NACL_ABI_S_IFMUTEX 0000250000 |
| 24 #define NACL_ABI_S_IFSHM 0000240000 | 24 #define NACL_ABI_S_IFSHM 0000240000 |
| 25 #define NACL_ABI_S_IFBOUNDSOCK 0000230000 /* bound socket*/ | 25 #define NACL_ABI_S_IFBOUNDSOCK 0000230000 /* bound socket*/ |
| 26 #define NACL_ABI_S_IFSOCKADDR 0000220000 /* socket address */ | 26 #define NACL_ABI_S_IFSOCKADDR 0000220000 /* socket address */ |
| 27 #define NACL_ABI_S_IFDSOCK 0000210000 /* data-only, transferable socket*/ | 27 #define NACL_ABI_S_IFDSOCK 0000210000 /* data-only, transferable socket*/ |
| 28 | 28 |
| 29 #define NACL_ABI_S_IFSOCK 0000140000 /* data-and-descriptor socket*/ | 29 #define NACL_ABI_S_IFSOCK 0000140000 /* data-and-descriptor socket*/ |
| 30 #define NACL_ABI_S_IFLNK 0000120000 /* symbolic link */ | 30 #define NACL_ABI_S_IFLNK 0000120000 /* symbolic link */ |
| 31 #define NACL_ABI_S_IFREG 0000100000 /* regular file */ | 31 #define NACL_ABI_S_IFREG 0000100000 /* regular file */ |
| 32 #define NACL_ABI_S_IFBLK 0000060000 /* block device */ | 32 #define NACL_ABI_S_IFBLK 0000060000 /* block device */ |
| 33 #define NACL_ABI_S_IFDIR 0000040000 /* directory */ | 33 #define NACL_ABI_S_IFDIR 0000040000 /* directory */ |
| 34 #define NACL_ABI_S_IFCHR 0000020000 /* character device */ | 34 #define NACL_ABI_S_IFCHR 0000020000 /* character device */ |
| 35 #define NACL_ABI_S_IFIFO 0000010000 /* fifo */ | 35 #define NACL_ABI_S_IFIFO 0000010000 /* fifo */ |
| 36 | 36 |
| 37 #define NACL_ABI_S_UNSUP 0000370000 /* unsupported file type */ | 37 #define NACL_ABI_S_UNSUP 0000370000 /* unsupported file type */ |
| 38 /* | 38 /* |
| 39 * NaCl does not support file system objects other than regular files | 39 * NaCl does not support file system objects other than regular files |
| 40 * and directories, and objects of other types will appear in the | 40 * and directories, and objects of other types will appear in the |
| 41 * directory namespace but will be mapped to NACL_ABI_S_UNSUP when | 41 * directory namespace but will be mapped to NACL_ABI_S_UNSUP when |
| 42 * these objects are stat(2)ed. Opening these kinds of objects will | 42 * these objects are stat(2)ed. Opening these kinds of objects will |
| 43 * fail. | 43 * fail. |
| 44 * | 44 * |
| 45 * The ABI includes these bits so (library) code that use these | 45 * The ABI includes these bits so (library) code that use these |
| 46 * preprocessor symbols will compile. The semantics of having a new | 46 * preprocessor symbols will compile. The semantics of having a new |
| 47 * "unsupported" file type should enable code to run in a reasonably | 47 * "unsupported" file type should enable code to run in a reasonably |
| 48 * sane way, but YMMV. | 48 * sane way, but YMMV. |
| 49 * | |
| 50 * NB: sysv shm is only available when host OS is linux, and cannot be | |
| 51 * created by untrusted code. The only use is in Pepper2d, and other | |
| 52 * trusted code is responsible for their creation -- essentially, | |
| 53 * these objects wrap sysv shm used by the MIT-SHM extension to X11, | |
| 54 * where the X server creates a SysV shm object to hold pixmap data. | |
| 55 */ | 49 */ |
| 56 | 50 |
| 57 #define NACL_ABI_S_ISUID 0004000 | 51 #define NACL_ABI_S_ISUID 0004000 |
| 58 #define NACL_ABI_S_ISGID 0002000 | 52 #define NACL_ABI_S_ISGID 0002000 |
| 59 #define NACL_ABI_S_ISVTX 0001000 | 53 #define NACL_ABI_S_ISVTX 0001000 |
| 60 | 54 |
| 61 #define NACL_ABI_S_IREAD 0400 | 55 #define NACL_ABI_S_IREAD 0400 |
| 62 #define NACL_ABI_S_IWRITE 0200 | 56 #define NACL_ABI_S_IWRITE 0200 |
| 63 #define NACL_ABI_S_IEXEC 0100 | 57 #define NACL_ABI_S_IEXEC 0100 |
| 64 | 58 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 84 #define NACL_ABI_S_ISSOCK(m) (((m) & NACL_ABI_S_IFMT) == NACL_ABI_S_IFSOCK) | 78 #define NACL_ABI_S_ISSOCK(m) (((m) & NACL_ABI_S_IFMT) == NACL_ABI_S_IFSOCK) |
| 85 #define NACL_ABI_S_ISLNK(m) (((m) & NACL_ABI_S_IFMT) == NACL_ABI_S_IFLNK) | 79 #define NACL_ABI_S_ISLNK(m) (((m) & NACL_ABI_S_IFMT) == NACL_ABI_S_IFLNK) |
| 86 #define NACL_ABI_S_ISREG(m) (((m) & NACL_ABI_S_IFMT) == NACL_ABI_S_IFREG) | 80 #define NACL_ABI_S_ISREG(m) (((m) & NACL_ABI_S_IFMT) == NACL_ABI_S_IFREG) |
| 87 #define NACL_ABI_S_ISBLK(m) (((m) & NACL_ABI_S_IFMT) == NACL_ABI_S_IFBLK) | 81 #define NACL_ABI_S_ISBLK(m) (((m) & NACL_ABI_S_IFMT) == NACL_ABI_S_IFBLK) |
| 88 #define NACL_ABI_S_ISDIR(m) (((m) & NACL_ABI_S_IFMT) == NACL_ABI_S_IFDIR) | 82 #define NACL_ABI_S_ISDIR(m) (((m) & NACL_ABI_S_IFMT) == NACL_ABI_S_IFDIR) |
| 89 #define NACL_ABI_S_ISSOCKADDR(m) \ | 83 #define NACL_ABI_S_ISSOCKADDR(m) \ |
| 90 (((m) & NACL_ABI_S_IFMT) == NACL_ABI_S_IFSOCKADDR) | 84 (((m) & NACL_ABI_S_IFMT) == NACL_ABI_S_IFSOCKADDR) |
| 91 #define NACL_ABI_S_ISCHR(m) (((m) & NACL_ABI_S_IFMT) == NACL_ABI_S_IFCHR) | 85 #define NACL_ABI_S_ISCHR(m) (((m) & NACL_ABI_S_IFMT) == NACL_ABI_S_IFCHR) |
| 92 #define NACL_ABI_S_ISFIFO(m) (((m) & NACL_ABI_S_IFMT) == NACL_ABI_S_IFIFO) | 86 #define NACL_ABI_S_ISFIFO(m) (((m) & NACL_ABI_S_IFMT) == NACL_ABI_S_IFIFO) |
| 93 #define NACL_ABI_S_ISSHM(m) (((m) & NACL_ABI_S_IFMT) == NACL_ABI_S_IFSHM) | 87 #define NACL_ABI_S_ISSHM(m) (((m) & NACL_ABI_S_IFMT) == NACL_ABI_S_IFSHM) |
| 94 #define NACL_ABI_S_ISSHM_SYSV(m) \ | |
| 95 (((m) & NACL_ABI_S_IFMT) == NACL_ABI_S_IFSHM_SYSV) | |
| 96 | 88 |
| 97 #endif | 89 #endif |
| OLD | NEW |