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

Unified Diff: src/untrusted/init/kernel_service.cc

Issue 25147002: nacl_init Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/untrusted/init/kernel_service.h ('k') | src/untrusted/init/nacl.scons » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/untrusted/init/kernel_service.cc
diff --git a/src/untrusted/init/kernel_service.cc b/src/untrusted/init/kernel_service.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e032f7bd00c88f74bef9922f5defaaa2cfe51a8f
--- /dev/null
+++ b/src/untrusted/init/kernel_service.cc
@@ -0,0 +1,48 @@
+// Copyright (c) 2013 The Native Client Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "native_client/src/untrusted/init/process_lib.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "native_client/src/public/imc_syscalls.h"
+#include "native_client/src/public/name_service.h"
+#include "native_client/src/trusted/service_runtime/include/bits/nacl_syscalls.h"
+#include "native_client/src/trusted/service_runtime/include/sys/nacl_kernel_service.h"
+
+#include "native_client/src/trusted/service_runtime/nacl_config.h"
+
+namespace nacl {
+
+bool KernelServiceClient::CreateProcess(int *child_sockaddr,
+ int *app_sockaddr) {
+ if (!initialized()) {
+ return 0;
+ }
+ NaClSrpcResultCodes result;
+ int status;
+ result = NaClSrpcInvokeBySignature(chan(), NACL_KERNEL_SERVICE_CREATE_PROCESS,
+ &status, child_sockaddr, app_sockaddr);
+ if (NACL_SRPC_RESULT_OK != result) {
+ fprintf(stderr, "create process failed (%d): %s\n", result,
+ NaClSrpcErrorString(result));
+ return 0;
+ }
+ return 1;
+}
+
+ServiceRuntimeClient* KernelServiceClient::ServiceRuntimeClientFactory(
+ int child_sockaddr) {
+ ServiceRuntimeClient* src = new ServiceRuntimeClient;
+ if (!src->InitializeFromConnectionCapability(child_sockaddr)) {
+ delete src;
+ return NULL;
+ }
+ return src;
+}
+
+} // namespace nacl
« no previous file with comments | « src/untrusted/init/kernel_service.h ('k') | src/untrusted/init/nacl.scons » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698