| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2012 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 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "native_client/src/include/nacl_macros.h" | 9 #include "native_client/src/include/nacl_macros.h" |
| 10 #include "native_client/src/untrusted/irt/irt.h" | 10 #include "native_client/src/untrusted/irt/irt.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 sizeof(nacl_irt_resource_open) }, | 32 sizeof(nacl_irt_resource_open) }, |
| 33 #ifdef IRT_PPAPI | 33 #ifdef IRT_PPAPI |
| 34 { NACL_IRT_PPAPIHOOK_v0_1, &nacl_irt_ppapihook, sizeof(nacl_irt_ppapihook) }, | 34 { NACL_IRT_PPAPIHOOK_v0_1, &nacl_irt_ppapihook, sizeof(nacl_irt_ppapihook) }, |
| 35 #endif | 35 #endif |
| 36 { NACL_IRT_RANDOM_v0_1, &nacl_irt_random, sizeof(nacl_irt_random) }, | 36 { NACL_IRT_RANDOM_v0_1, &nacl_irt_random, sizeof(nacl_irt_random) }, |
| 37 { NACL_IRT_CLOCK_v0_1, &nacl_irt_clock, sizeof(nacl_irt_clock) }, | 37 { NACL_IRT_CLOCK_v0_1, &nacl_irt_clock, sizeof(nacl_irt_clock) }, |
| 38 { NACL_IRT_DEV_GETPID_v0_1, &nacl_irt_dev_getpid, | 38 { NACL_IRT_DEV_GETPID_v0_1, &nacl_irt_dev_getpid, |
| 39 sizeof(nacl_irt_dev_getpid) }, | 39 sizeof(nacl_irt_dev_getpid) }, |
| 40 { NACL_IRT_DEV_EXCEPTION_HANDLING_v0_1, &nacl_irt_dev_exception_handling, | 40 { NACL_IRT_DEV_EXCEPTION_HANDLING_v0_1, &nacl_irt_dev_exception_handling, |
| 41 sizeof(nacl_irt_dev_exception_handling) }, | 41 sizeof(nacl_irt_dev_exception_handling) }, |
| 42 { NACL_IRT_DEV_MPROTECT_v0_1, &nacl_irt_dev_mprotect, |
| 43 sizeof(nacl_irt_dev_mprotect) }, |
| 42 }; | 44 }; |
| 43 | 45 |
| 44 size_t nacl_irt_interface(const char *interface_ident, | 46 size_t nacl_irt_interface(const char *interface_ident, |
| 45 void *table, size_t tablesize) { | 47 void *table, size_t tablesize) { |
| 46 int i; | 48 int i; |
| 47 for (i = 0; i < NACL_ARRAY_SIZE(irt_interfaces); ++i) { | 49 for (i = 0; i < NACL_ARRAY_SIZE(irt_interfaces); ++i) { |
| 48 if (0 == strcmp(interface_ident, irt_interfaces[i].name)) { | 50 if (0 == strcmp(interface_ident, irt_interfaces[i].name)) { |
| 49 const size_t size = irt_interfaces[i].size; | 51 const size_t size = irt_interfaces[i].size; |
| 50 if (size <= tablesize) { | 52 if (size <= tablesize) { |
| 51 memcpy(table, irt_interfaces[i].table, size); | 53 memcpy(table, irt_interfaces[i].table, size); |
| 52 return size; | 54 return size; |
| 53 } | 55 } |
| 54 break; | 56 break; |
| 55 } | 57 } |
| 56 } | 58 } |
| 57 return 0; | 59 return 0; |
| 58 } | 60 } |
| OLD | NEW |