OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Native Client Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "native_client/src/untrusted/init/process_lib.h" |
| 6 |
| 7 #include <errno.h> |
| 8 #include <fcntl.h> |
| 9 #include <stdlib.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/trusted/service_runtime/include/bits/nacl_syscalls.h
" |
| 15 #include "native_client/src/trusted/service_runtime/include/sys/nacl_kernel_serv
ice.h" |
| 16 |
| 17 #include "native_client/src/trusted/service_runtime/nacl_config.h" |
| 18 |
| 19 namespace nacl { |
| 20 |
| 21 bool KernelServiceClient::CreateProcess(int *child_sockaddr, |
| 22 int *app_sockaddr) { |
| 23 if (!initialized()) { |
| 24 return 0; |
| 25 } |
| 26 NaClSrpcResultCodes result; |
| 27 int status; |
| 28 result = NaClSrpcInvokeBySignature(chan(), NACL_KERNEL_SERVICE_CREATE_PROCESS, |
| 29 &status, child_sockaddr, app_sockaddr); |
| 30 if (NACL_SRPC_RESULT_OK != result) { |
| 31 fprintf(stderr, "create process failed (%d): %s\n", result, |
| 32 NaClSrpcErrorString(result)); |
| 33 return 0; |
| 34 } |
| 35 return 1; |
| 36 } |
| 37 |
| 38 ServiceRuntimeClient* KernelServiceClient::ServiceRuntimeClientFactory( |
| 39 int child_sockaddr) { |
| 40 ServiceRuntimeClient* src = new ServiceRuntimeClient; |
| 41 if (!src->InitializeFromConnectionCapability(child_sockaddr)) { |
| 42 delete src; |
| 43 return NULL; |
| 44 } |
| 45 return src; |
| 46 } |
| 47 |
| 48 } // namespace nacl |
OLD | NEW |