Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(404)

Side by Side Diff: src/untrusted/irt/irt_interfaces.c

Issue 7605029: Extend IRT with nacl_irt_resource_open interface (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: '' Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2011 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 11 matching lines...) Expand all
22 { NACL_IRT_FILENAME_v0_1, &nacl_irt_filename, sizeof(nacl_irt_filename) }, 22 { NACL_IRT_FILENAME_v0_1, &nacl_irt_filename, sizeof(nacl_irt_filename) },
23 { NACL_IRT_MEMORY_v0_1, &nacl_irt_memory, sizeof(nacl_irt_memory) }, 23 { NACL_IRT_MEMORY_v0_1, &nacl_irt_memory, sizeof(nacl_irt_memory) },
24 { NACL_IRT_DYNCODE_v0_1, &nacl_irt_dyncode, sizeof(nacl_irt_dyncode) }, 24 { NACL_IRT_DYNCODE_v0_1, &nacl_irt_dyncode, sizeof(nacl_irt_dyncode) },
25 { NACL_IRT_THREAD_v0_1, &nacl_irt_thread, sizeof(nacl_irt_thread) }, 25 { NACL_IRT_THREAD_v0_1, &nacl_irt_thread, sizeof(nacl_irt_thread) },
26 { NACL_IRT_MUTEX_v0_1, &nacl_irt_mutex, sizeof(nacl_irt_mutex) }, 26 { NACL_IRT_MUTEX_v0_1, &nacl_irt_mutex, sizeof(nacl_irt_mutex) },
27 { NACL_IRT_COND_v0_1, &nacl_irt_cond, sizeof(nacl_irt_cond) }, 27 { NACL_IRT_COND_v0_1, &nacl_irt_cond, sizeof(nacl_irt_cond) },
28 { NACL_IRT_SEM_v0_1, &nacl_irt_sem, sizeof(nacl_irt_sem) }, 28 { NACL_IRT_SEM_v0_1, &nacl_irt_sem, sizeof(nacl_irt_sem) },
29 { NACL_IRT_TLS_v0_1, &nacl_irt_tls, sizeof(nacl_irt_tls) }, 29 { NACL_IRT_TLS_v0_1, &nacl_irt_tls, sizeof(nacl_irt_tls) },
30 { NACL_IRT_BLOCKHOOK_v0_1, &nacl_irt_blockhook, sizeof(nacl_irt_blockhook) }, 30 { NACL_IRT_BLOCKHOOK_v0_1, &nacl_irt_blockhook, sizeof(nacl_irt_blockhook) },
31 #ifdef IRT_PPAPI 31 #ifdef IRT_PPAPI
32 { NACL_IRT_RESOURCE_OPEN_v0_1, &nacl_irt_resource_open,
33 sizeof(nacl_irt_resource_open) },
32 { 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) },
33 #endif 35 #endif
34 }; 36 };
35 37
36 size_t nacl_irt_interface(const char *interface_ident, 38 size_t nacl_irt_interface(const char *interface_ident,
37 void *table, size_t tablesize) { 39 void *table, size_t tablesize) {
38 int i; 40 int i;
39 for (i = 0; i < NACL_ARRAY_SIZE(irt_interfaces); ++i) { 41 for (i = 0; i < NACL_ARRAY_SIZE(irt_interfaces); ++i) {
40 if (0 == strcmp(interface_ident, irt_interfaces[i].name)) { 42 if (0 == strcmp(interface_ident, irt_interfaces[i].name)) {
41 const size_t size = irt_interfaces[i].size; 43 const size_t size = irt_interfaces[i].size;
42 if (size <= tablesize) { 44 if (size <= tablesize) {
43 memcpy(table, irt_interfaces[i].table, size); 45 memcpy(table, irt_interfaces[i].table, size);
44 return size; 46 return size;
45 } 47 }
46 break; 48 break;
47 } 49 }
48 } 50 }
49 return 0; 51 return 0;
50 } 52 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698