| 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
|
|
|