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
4 * found in the LICENSE file.
11 #include <sys/fcntl.h>
15 #include "native_client/src/include/nacl_assert.h"
16 #include "native_client/src/public/imc_syscalls.h"
17 #include "native_client/src/public/name_service.h"
18 #include "native_client/src/shared/srpc/nacl_srpc.h"
22 NaClSrpcChannel channel;
27 if (!NaClSrpcModuleInit()) {
28 fprintf(stderr, "srpc module init failed\n");
31 printf("Hello world\n");
33 nacl_nameservice(&ns);
34 printf("ns = %d\n", ns);
37 connected_socket = imc_connect(ns);
38 assert(-1 != connected_socket);
39 if (!NaClSrpcClientCtor(&channel, connected_socket)) {
40 fprintf(stderr, "Srpc client channel ctor failed\n");
43 printf("NaClSrpcClientCtor succeeded\n");
44 if (NACL_SRPC_RESULT_OK !=
45 NaClSrpcInvokeBySignature(&channel, NACL_NAME_SERVICE_LOOKUP,
46 "SecureRandom", O_RDONLY, &status, &rng)) {
47 fprintf(stderr, "nameservice lookup failed, status %d\n", status);
50 printf("rpc status %d\n", status);
52 * Now that the "SecureRandom" service has been removed, there is no
53 * service that is registered with the name service by default that we
54 * can test here. "ManifestNameService" only gets registered after the
55 * "reverse service" is initialized, which doesn't normally happen in
56 * standalone sel_ldr. So we just check that querying returns a sensible
59 ASSERT_EQ(NACL_NAME_SERVICE_NAME_NOT_FOUND, status);