1 : /*
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.
5 : */
6 :
7 : #include <stdio.h>
8 :
9 : #include "native_client/src/shared/imc/nacl_imc_c.h"
10 : #include "native_client/src/shared/platform/nacl_error.h"
11 :
12 : /* Writes the last error message to the standard error. */
13 0 : static void failWithErrno(const char* message) {
14 : char buffer[256];
15 :
16 0 : if (0 == NaClGetLastErrorString(buffer, sizeof(buffer))) {
17 0 : fprintf(stderr, "%s: %s", message, buffer);
18 : }
19 0 : exit(EXIT_FAILURE);
20 : }
21 :
22 1 : int main(int argc, char* argv[]) {
23 : NaClHandle pair[2];
24 :
25 : UNREFERENCED_PARAMETER(argc);
26 : UNREFERENCED_PARAMETER(argv);
27 :
28 1 : if (0 != NaClSocketPair(pair)) {
29 0 : failWithErrno("SocketPair");
30 : }
31 :
32 1 : if (0 != NaClClose(pair[0])) {
33 0 : failWithErrno("NaClClose");
34 : }
35 :
36 1 : if (0 != NaClClose(pair[1])) {
37 0 : failWithErrno("NaClClose");
38 : }
39 :
40 1 : return 0;
41 1 : }
|