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

Side by Side Diff: src/shared/srpc/nacl_srpc_ppapi_plugin_internal.c

Issue 871713002: Remove NaClPluginLowLevelInitializationComplete() (caller of "init_done" SRPC) (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « src/shared/srpc/nacl_srpc_ppapi_plugin_internal.h ('k') | src/shared/srpc/srpc.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
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
4 * found in the LICENSE file.
5 */
6
7 #include "native_client/src/shared/srpc/nacl_srpc_ppapi_plugin_internal.h"
8
9 #include <fcntl.h>
10 #include <unistd.h>
11
12 #include "native_client/src/public/imc_syscalls.h"
13 #include "native_client/src/public/name_service.h"
14 #include "native_client/src/shared/platform/nacl_log.h"
15 #include "native_client/src/shared/srpc/nacl_srpc.h"
16 #include "native_client/src/shared/srpc/nacl_srpc_internal.h"
17 #include "native_client/src/trusted/service_runtime/include/sys/nacl_kernel_serv ice.h"
18
19 static int gNaClNameServiceConnCapDesc = -1;
20
21 void NaClPluginLowLevelInitializationCompleteInternal(void) {
22 int nameservice_conn_desc;
23 int kernel_service_conn_cap_desc = -1;
24 int kernel_service_desc;
25 struct NaClSrpcChannel srpc_channel;
26 int status;
27
28 NaClLog(4, "Entered NaClPluginLowLevelInitializationComplete\n");
29
30 if (-1 != gNaClNameServiceConnCapDesc) {
31 NaClLog(LOG_ERROR,
32 "Double call to NaClPluginLowLevelInitializationComplete?\n");
33 return;
34 }
35 /*
36 * The existence of the bootstrap nameservice is independent of
37 * whether NaCl is running as a standalone application or running as
38 * a untrusted Pepper plugin, browser extension environment.
39 */
40 if (-1 == nacl_nameservice(&gNaClNameServiceConnCapDesc)) {
41 NaClLog(LOG_FATAL,
42 "NaClPluginLowLevelInitializationComplete: no name service?!?\n");
43 }
44
45 nameservice_conn_desc = imc_connect(gNaClNameServiceConnCapDesc);
46 if (-1 == nameservice_conn_desc) {
47 NaClLog(LOG_FATAL,
48 "Could not connect to bootstrap name service\n");
49 }
50 if (!NaClSrpcClientCtor(&srpc_channel, nameservice_conn_desc)) {
51 (void) close(nameservice_conn_desc);
52 NaClLog(LOG_FATAL, "SRPC channel ctor to name service failed\n");
53 }
54 if (NACL_SRPC_RESULT_OK != NaClSrpcInvokeBySignature(
55 &srpc_channel,
56 NACL_NAME_SERVICE_LOOKUP,
57 "KernelService",
58 O_RDWR,
59 &status,
60 &kernel_service_conn_cap_desc)) {
61 NaClSrpcDtor(&srpc_channel);
62 NaClLog(LOG_FATAL, "Name service lookup RPC for KernelService failed\n");
63 }
64 NaClSrpcDtor(&srpc_channel);
65 if (-1 == kernel_service_conn_cap_desc) {
66 NaClLog(LOG_FATAL, "Name service lookup for KernelService failed, %d\n",
67 status);
68 }
69 if (-1 == (kernel_service_desc = imc_connect(kernel_service_conn_cap_desc))) {
70 (void) close(kernel_service_conn_cap_desc);
71 NaClLog(LOG_FATAL, "Connect to KernelService failed\n");
72 }
73 (void) close(kernel_service_conn_cap_desc);
74 if (!NaClSrpcClientCtor(&srpc_channel, kernel_service_desc)) {
75 (void) close(kernel_service_desc);
76 NaClLog(LOG_FATAL, "SRPC channel ctor to KernelService failed\n");
77 }
78 if (NACL_SRPC_RESULT_OK != NaClSrpcInvokeBySignature(
79 &srpc_channel,
80 NACL_KERNEL_SERVICE_INITIALIZATION_COMPLETE)) {
81 NaClLog(LOG_FATAL, "KernelService init_done RPC failed!\n");
82 }
83 NaClSrpcDtor(&srpc_channel);
84 }
OLDNEW
« no previous file with comments | « src/shared/srpc/nacl_srpc_ppapi_plugin_internal.h ('k') | src/shared/srpc/srpc.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698