| 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/trusted/manifest_name_service_proxy/manifest_proxy.h
" | 9 #include "native_client/src/trusted/manifest_name_service_proxy/manifest_proxy.h
" |
| 10 | 10 |
| 11 #include "native_client/src/shared/platform/nacl_log.h" | 11 #include "native_client/src/shared/platform/nacl_log.h" |
| 12 #include "native_client/src/shared/platform/nacl_sync.h" | 12 #include "native_client/src/shared/platform/nacl_sync.h" |
| 13 #include "native_client/src/shared/platform/nacl_sync_checked.h" | 13 #include "native_client/src/shared/platform/nacl_sync_checked.h" |
| 14 #include "native_client/src/shared/srpc/nacl_srpc.h" | 14 #include "native_client/src/shared/srpc/nacl_srpc.h" |
| 15 #include "native_client/src/trusted/reverse_service/manifest_rpc.h" | 15 #include "native_client/src/trusted/reverse_service/manifest_rpc.h" |
| 16 #include "native_client/src/trusted/reverse_service/reverse_control_rpc.h" | 16 #include "native_client/src/trusted/reverse_service/reverse_control_rpc.h" |
| 17 #include "native_client/src/trusted/service_runtime/include/sys/errno.h" | 17 #include "native_client/src/trusted/service_runtime/include/sys/errno.h" |
| 18 #include "native_client/src/trusted/service_runtime/include/sys/nacl_name_servic
e.h" | 18 #include "native_client/src/trusted/service_runtime/include/sys/nacl_name_servic
e.h" |
| 19 #include "native_client/src/trusted/service_runtime/sel_ldr.h" | 19 #include "native_client/src/trusted/service_runtime/nacl_secure_service.h" |
| 20 | 20 |
| 21 static void NaClManifestWaitForChannel_yield_mu( | 21 static void NaClManifestWaitForChannel_yield_mu( |
| 22 struct NaClManifestProxyConnection *self) { | 22 struct NaClManifestProxyConnection *self) { |
| 23 NaClLog(4, "Entered NaClManifestWaitForChannel_yield_mu\n"); | 23 NaClLog(4, "Entered NaClManifestWaitForChannel_yield_mu\n"); |
| 24 NaClXMutexLock(&self->mu); | 24 NaClXMutexLock(&self->mu); |
| 25 NaClLog(4, "NaClManifestWaitForChannel_yield_mu: checking channel\n"); | 25 NaClLog(4, "NaClManifestWaitForChannel_yield_mu: checking channel\n"); |
| 26 while (!self->channel_initialized) { | 26 while (!self->channel_initialized) { |
| 27 NaClLog(4, "NaClManifestWaitForChannel_yield_mu: waiting\n"); | 27 NaClLog(4, "NaClManifestWaitForChannel_yield_mu: waiting\n"); |
| 28 NaClXCondVarWait(&self->cv, &self->mu); | 28 NaClXCondVarWait(&self->cv, &self->mu); |
| 29 } | 29 } |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 NaClLog(4, "NaClManifestProxyConnectionFactory: locking reverse channel\n"); | 343 NaClLog(4, "NaClManifestProxyConnectionFactory: locking reverse channel\n"); |
| 344 NaClLog(4, "NaClManifestProxyConnectionFactory: nap 0x%"NACL_PRIxPTR"\n", | 344 NaClLog(4, "NaClManifestProxyConnectionFactory: nap 0x%"NACL_PRIxPTR"\n", |
| 345 (uintptr_t) nap); | 345 (uintptr_t) nap); |
| 346 NaClXMutexLock(&nap->mu); | 346 NaClXMutexLock(&nap->mu); |
| 347 if (NACL_REVERSE_CHANNEL_INITIALIZED != | 347 if (NACL_REVERSE_CHANNEL_INITIALIZED != |
| 348 nap->reverse_channel_initialization_state) { | 348 nap->reverse_channel_initialization_state) { |
| 349 NaClLog(LOG_FATAL, | 349 NaClLog(LOG_FATAL, |
| 350 "NaClManifestProxyConnectionFactory invoked w/o reverse channel\n"); | 350 "NaClManifestProxyConnectionFactory invoked w/o reverse channel\n"); |
| 351 } | 351 } |
| 352 NaClLog(4, "NaClManifestProxyConnectionFactory: inserting handler\n"); | 352 NaClLog(4, "NaClManifestProxyConnectionFactory: inserting handler\n"); |
| 353 if (!NaClSecureReverseClientInsertHandler(nap->reverse_client, | 353 if (!(*NACL_VTBL(NaClSecureReverseClient, nap->reverse_client)-> |
| 354 NaClManifestReverseClientCallback, | 354 InsertHandler)(nap->reverse_client, |
| 355 (void *) mconn)) { | 355 NaClManifestReverseClientCallback, |
| 356 NaClLog(LOG_FATAL, | 356 (void *) mconn)) { |
| 357 NaClLog(LOG_FATAL, |
| 357 ("NaClManifestProxyConnectionFactory:" | 358 ("NaClManifestProxyConnectionFactory:" |
| 358 " NaClSecureReverseClientInsertHandler failed\n")); | 359 " NaClSecureReverseClientInsertHandler failed\n")); |
| 359 } | 360 } |
| 360 /* | 361 /* |
| 361 * NaClSrpcInvokeBySignature(""); tell plugin to connect and create | 362 * NaClSrpcInvokeBySignature(""); tell plugin to connect and create |
| 362 * a reverse channel | 363 * a reverse channel |
| 363 */ | 364 */ |
| 364 NaClLog(4, | 365 NaClLog(4, |
| 365 ("NaClManifestProxyConnectionFactory: making RPC" | 366 ("NaClManifestProxyConnectionFactory: making RPC" |
| 366 " to set up connection\n")); | 367 " to set up connection\n")); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 390 /* | 391 /* |
| 391 * The NaClManifestProxyConnectionFactory creates a subclass of a | 392 * The NaClManifestProxyConnectionFactory creates a subclass of a |
| 392 * NaClSimpleServiceConnectionFactory object that uses the reverse | 393 * NaClSimpleServiceConnectionFactory object that uses the reverse |
| 393 * connection object nap->reverse_client to obtain a new RPC channel | 394 * connection object nap->reverse_client to obtain a new RPC channel |
| 394 * with each manifest connection. | 395 * with each manifest connection. |
| 395 */ | 396 */ |
| 396 NaClSimpleServiceAcceptConnection, | 397 NaClSimpleServiceAcceptConnection, |
| 397 NaClSimpleServiceAcceptAndSpawnHandler, | 398 NaClSimpleServiceAcceptAndSpawnHandler, |
| 398 NaClSimpleServiceRpcHandler, | 399 NaClSimpleServiceRpcHandler, |
| 399 }; | 400 }; |
| OLD | NEW |