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

Side by Side Diff: src/trusted/reverse_service/reverse_service.cc

Issue 15039022: Enable meta-based validation for shared libraries. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Created 7 years, 7 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) 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 "native_client/src/trusted/reverse_service/reverse_service.h" 7 #include "native_client/src/trusted/reverse_service/reverse_service.h"
8 8
9 #include <string.h> 9 #include <string.h>
10 10
11 #include <limits> 11 #include <limits>
12 #include <string> 12 #include <string>
13 13
14 #include "native_client/src/include/nacl_compiler_annotations.h" 14 #include "native_client/src/include/nacl_compiler_annotations.h"
15 #include "native_client/src/include/nacl_scoped_ptr.h" 15 #include "native_client/src/include/nacl_scoped_ptr.h"
16 #include "native_client/src/include/portability_io.h" 16 #include "native_client/src/include/portability_io.h"
17 #include "native_client/src/shared/platform/nacl_check.h" 17 #include "native_client/src/shared/platform/nacl_check.h"
18 #include "native_client/src/shared/platform/nacl_host_desc.h" 18 #include "native_client/src/shared/platform/nacl_host_desc.h"
19 #include "native_client/src/shared/platform/nacl_log.h" 19 #include "native_client/src/shared/platform/nacl_log.h"
20 #include "native_client/src/shared/platform/nacl_sync.h" 20 #include "native_client/src/shared/platform/nacl_sync.h"
21 #include "native_client/src/shared/platform/nacl_sync_checked.h" 21 #include "native_client/src/shared/platform/nacl_sync_checked.h"
22 #include "native_client/src/shared/platform/nacl_threads.h" 22 #include "native_client/src/shared/platform/nacl_threads.h"
23 #include "native_client/src/shared/srpc/nacl_srpc.h" 23 #include "native_client/src/shared/srpc/nacl_srpc.h"
24 24
25 #include "native_client/src/trusted/desc/nacl_desc_invalid.h" 25 #include "native_client/src/trusted/desc/nacl_desc_invalid.h"
26 #include "native_client/src/trusted/desc/nacl_desc_io.h" 26 #include "native_client/src/trusted/desc/nacl_desc_io.h"
27 27
28 #include "native_client/src/trusted/reverse_service/nacl_file_info.h"
28 #include "native_client/src/trusted/service_runtime/include/sys/fcntl.h" 29 #include "native_client/src/trusted/service_runtime/include/sys/fcntl.h"
29 30
30 namespace { 31 namespace {
31 32
32 // ReverseInterfaceWrapper wraps a C++ interface and provides 33 // ReverseInterfaceWrapper wraps a C++ interface and provides
33 // C-callable wrapper functions for use by the underlying C 34 // C-callable wrapper functions for use by the underlying C
34 // implementation. 35 // implementation.
35 36
36 struct ReverseInterfaceWrapper { 37 struct ReverseInterfaceWrapper {
37 NaClReverseInterface base NACL_IS_REFCOUNT_SUBCLASS; 38 NaClReverseInterface base NACL_IS_REFCOUNT_SUBCLASS;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } 93 }
93 strncpy(buffer + size, it->c_str(), to_write); 94 strncpy(buffer + size, it->c_str(), to_write);
94 NaClLog(3, "EnumerateManifestKeys: %.*s\n", (int) to_write, buffer + size); 95 NaClLog(3, "EnumerateManifestKeys: %.*s\n", (int) to_write, buffer + size);
95 size += to_write; 96 size += to_write;
96 } 97 }
97 return size; 98 return size;
98 } 99 }
99 100
100 int OpenManifestEntry(NaClReverseInterface* self, 101 int OpenManifestEntry(NaClReverseInterface* self,
101 char const* url_key, 102 char const* url_key,
102 int32_t* out_desc) { 103 struct NaClFileInfo* info) {
103 ReverseInterfaceWrapper* wrapper = 104 ReverseInterfaceWrapper* wrapper =
104 reinterpret_cast<ReverseInterfaceWrapper*>(self); 105 reinterpret_cast<ReverseInterfaceWrapper*>(self);
105 if (NULL == wrapper->iface) { 106 if (NULL == wrapper->iface) {
106 NaClLog(1, "OpenManifestEntry, no reverse_interface.\n"); 107 NaClLog(1, "OpenManifestEntry, no reverse_interface.\n");
107 return 0; 108 return 0;
108 } 109 }
109 return wrapper->iface->OpenManifestEntry(nacl::string(url_key), out_desc); 110 return wrapper->iface->OpenManifestEntry(nacl::string(url_key), info);
bsy 2013/05/10 23:52:56 isn't this implemented in chrome?
110 } 111 }
111 112
112 int CloseManifestEntry(NaClReverseInterface* self, 113 int CloseManifestEntry(NaClReverseInterface* self,
113 int32_t desc) { 114 int32_t desc) {
114 ReverseInterfaceWrapper* wrapper = 115 ReverseInterfaceWrapper* wrapper =
115 reinterpret_cast<ReverseInterfaceWrapper*>(self); 116 reinterpret_cast<ReverseInterfaceWrapper*>(self);
116 if (NULL == wrapper->iface) { 117 if (NULL == wrapper->iface) {
117 NaClLog(1, "CloseManifestEntry, no reverse_interface.\n"); 118 NaClLog(1, "CloseManifestEntry, no reverse_interface.\n");
118 return 0; 119 return 0;
119 } 120 }
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 328
328 void ReverseService::IncrThreadCount() { 329 void ReverseService::IncrThreadCount() {
329 NACL_VTBL(NaClReverseService, service_)->ThreadCountIncr(service_); 330 NACL_VTBL(NaClReverseService, service_)->ThreadCountIncr(service_);
330 } 331 }
331 332
332 void ReverseService::DecrThreadCount() { 333 void ReverseService::DecrThreadCount() {
333 NACL_VTBL(NaClReverseService, service_)->ThreadCountDecr(service_); 334 NACL_VTBL(NaClReverseService, service_)->ThreadCountDecr(service_);
334 } 335 }
335 336
336 } // namespace nacl 337 } // namespace nacl
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698