OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "ppapi/nacl_irt/irt_interfaces.h" | 5 #include "ppapi/nacl_irt/irt_interfaces.h" |
6 | 6 |
7 #include <unistd.h> | 7 #include <unistd.h> |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "native_client/src/public/irt_core.h" | 10 #include "native_client/src/public/irt_core.h" |
11 #include "native_client/src/trusted/service_runtime/include/sys/unistd.h" | 11 #include "native_client/src/trusted/service_runtime/include/sys/unistd.h" |
12 #include "native_client/src/untrusted/irt/irt.h" | 12 #include "native_client/src/untrusted/irt/irt.h" |
| 13 #include "native_client/src/untrusted/irt/irt_dev.h" |
13 #include "ppapi/nacl_irt/irt_manifest.h" | 14 #include "ppapi/nacl_irt/irt_manifest.h" |
14 #include "ppapi/nacl_irt/public/irt_ppapi.h" | 15 #include "ppapi/nacl_irt/public/irt_ppapi.h" |
15 #include "ppapi/native_client/src/untrusted/pnacl_irt_shim/irt_shim_ppapi.h" | 16 #include "ppapi/native_client/src/untrusted/pnacl_irt_shim/irt_shim_ppapi.h" |
16 | 17 |
17 #if defined(OS_NACL_SFI) | 18 #if defined(OS_NACL_SFI) |
18 static int ppapihook_pnacl_private_filter(void) { | 19 static int ppapihook_pnacl_private_filter(void) { |
19 int pnacl_mode = sysconf(NACL_ABI__SC_NACL_PNACL_MODE); | 20 int pnacl_mode = sysconf(NACL_ABI__SC_NACL_PNACL_MODE); |
20 if (pnacl_mode == -1) | 21 if (pnacl_mode == -1) |
21 return 0; | 22 return 0; |
22 return pnacl_mode; | 23 return pnacl_mode; |
(...skipping 24 matching lines...) Expand all Loading... |
47 { NACL_IRT_RESOURCE_OPEN_v0_1, &kIrtResourceOpen, | 48 { NACL_IRT_RESOURCE_OPEN_v0_1, &kIrtResourceOpen, |
48 sizeof(kIrtResourceOpen), | 49 sizeof(kIrtResourceOpen), |
49 #if defined(OS_NACL_SFI) | 50 #if defined(OS_NACL_SFI) |
50 not_pnacl_filter, | 51 not_pnacl_filter, |
51 #else | 52 #else |
52 // If we change PNaCl to use Non-SFI Mode on the open web, | 53 // If we change PNaCl to use Non-SFI Mode on the open web, |
53 // we should add a filter here. | 54 // we should add a filter here. |
54 NULL, | 55 NULL, |
55 #endif | 56 #endif |
56 }, | 57 }, |
| 58 #if defined(OS_NACL_SFI) |
| 59 // TODO(mseaborn): Ideally these two PNaCl translator interfaces should |
| 60 // be hidden in processes that aren't PNaCl sandboxed translator |
| 61 // processes. However, we haven't yet plumbed though a flag to indicate |
| 62 // when a NaCl process is a PNaCl translator process. The risk of an app |
| 63 // accidentally depending on the presence of this interface is much lower |
| 64 // than for other non-stable IRT interfaces, because this interface is |
| 65 // not useful to apps. |
| 66 { NACL_IRT_PRIVATE_PNACL_TRANSLATOR_LINK_v0_1, |
| 67 &nacl_irt_private_pnacl_translator_link, |
| 68 sizeof(nacl_irt_private_pnacl_translator_link), NULL }, |
| 69 { NACL_IRT_PRIVATE_PNACL_TRANSLATOR_COMPILE_v0_1, |
| 70 &nacl_irt_private_pnacl_translator_compile, |
| 71 sizeof(nacl_irt_private_pnacl_translator_compile), NULL }, |
| 72 #endif |
57 }; | 73 }; |
58 | 74 |
59 size_t chrome_irt_query(const char* interface_ident, | 75 size_t chrome_irt_query(const char* interface_ident, |
60 void* table, size_t tablesize) { | 76 void* table, size_t tablesize) { |
61 size_t result = nacl_irt_query_list(interface_ident, | 77 size_t result = nacl_irt_query_list(interface_ident, |
62 table, | 78 table, |
63 tablesize, | 79 tablesize, |
64 irt_interfaces, | 80 irt_interfaces, |
65 sizeof(irt_interfaces)); | 81 sizeof(irt_interfaces)); |
66 if (result != 0) | 82 if (result != 0) |
67 return result; | 83 return result; |
68 | 84 |
69 return nacl_irt_query_core(interface_ident, table, tablesize); | 85 return nacl_irt_query_core(interface_ident, table, tablesize); |
70 } | 86 } |
OLD | NEW |