OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_NACL_COMMON_NACL_HELPER_LINUX_H_ | 5 #ifndef COMPONENTS_NACL_COMMON_NACL_HELPER_LINUX_H_ |
6 #define COMPONENTS_NACL_COMMON_NACL_HELPER_LINUX_H_ | 6 #define COMPONENTS_NACL_COMMON_NACL_HELPER_LINUX_H_ |
7 | 7 |
8 // A mini-zygote specifically for Native Client. This file defines | 8 // A mini-zygote specifically for Native Client. This file defines |
9 // constants used to implement communication between the nacl_helper | 9 // constants used to implement communication between the nacl_helper |
10 // process and the Chrome zygote. | 10 // process and the Chrome zygote. |
11 | 11 |
12 #define kNaClMaxIPCMessageLength 2048 | 12 #define kNaClMaxIPCMessageLength 2048 |
13 | 13 |
14 // Used by Helper to tell Zygote it has started successfully. | 14 // Used by Helper to tell Zygote it has started successfully. |
15 #define kNaClHelperStartupAck "NACLHELPER_OK" | 15 #define kNaClHelperStartupAck "NACLHELPER_OK" |
16 | 16 |
17 enum NaClZygoteIPCCommand { | 17 enum NaClZygoteIPCCommand { |
18 kNaClForkRequest, | 18 kNaClForkRequest, |
19 kNaClGetTerminationStatusRequest, | 19 kNaClGetTerminationStatusRequest, |
20 }; | 20 }; |
21 | 21 |
22 // The next set of constants define global Linux file descriptors. | 22 // The next set of constants define global Linux file descriptors. |
23 // For communications between NaCl loader and browser. | 23 // For communications between NaCl loader and browser. |
24 // See also content/common/zygote_main_linux.cc and | 24 // See also content/common/zygote_main_linux.cc and |
25 // http://code.google.com/p/chromium/wiki/LinuxZygote | 25 // http://code.google.com/p/chromium/wiki/LinuxZygote |
26 | 26 |
27 // For communications between NaCl loader and zygote. | 27 // For communications between NaCl loader and zygote. |
28 #define kNaClZygoteDescriptor 3 | 28 #define kNaClZygoteDescriptor 4 |
29 // For communications between the NaCl loader process and | 29 // For communications between the NaCl loader process and |
30 // the SUID sandbox. | 30 // the SUID sandbox. |
31 #define kNaClSandboxDescriptor 5 | 31 #define kNaClSandboxDescriptor 6 |
32 // NOTE: kNaClSandboxDescriptor must match | 32 // NOTE: kNaClSandboxDescriptor must match |
33 // content/browser/zygote_main_linux.cc | 33 // content/public/common/content_descriptors.h |
34 // kMagicSandboxIPCDescriptor. | 34 // kSandboxIPCChannel + base::GlobalDescriptors::kBaseDescriptor |
35 | 35 |
36 // A fork request from the Zygote to the helper includes an array | 36 // A fork request from the Zygote to the helper includes an array |
37 // of three file descriptors. These constants are used as indicies | 37 // of three or four file descriptors. These constants are used as indicies |
38 // into the array. | 38 // into the array. |
39 // Used to pass in the descriptor for talking to the Browser | 39 // Used to pass in the descriptor for talking to the Browser |
40 #define kNaClBrowserFDIndex 0 | 40 #define kNaClBrowserFDIndex 0 |
41 // The next two are used in the protocol for discovering the | 41 // The next two are used in the protocol for discovering the |
42 // child processes real PID from within the SUID sandbox. See | 42 // child processes real PID from within the SUID sandbox. See |
43 // http://code.google.com/p/chromium/wiki/LinuxZygote | 43 // http://code.google.com/p/chromium/wiki/LinuxZygote |
44 #define kNaClDummyFDIndex 1 | 44 // These indices depend on the size of the array, as kStatsTableSharedMemFd |
45 #define kNaClParentFDIndex 2 | 45 // could be inserted between kNaClBrowserFDIndex and kNaClDummyFDIndex. |
46 #define kNaClDummyFDIndex(fd_array_size) (fd_array_size == 3 ? 1 : 2) | |
Mark Seaborn
2013/09/12 00:00:28
This should be an inline function rather than a ma
rmcilroy
2013/09/12 17:04:56
Done.
| |
47 #define kNaClParentFDIndex(fd_array_size) (fd_array_size == 3 ? 2 : 3) | |
46 | 48 |
47 #endif // COMPONENTS_NACL_COMMON_NACL_HELPER_LINUX_H_ | 49 #endif // COMPONENTS_NACL_COMMON_NACL_HELPER_LINUX_H_ |
OLD | NEW |