2 * Copyright 2014 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 "native_client/src/include/nacl_assert.h"
13 void ClosePipe(int fds[2]) {
14 int rc = close(fds[0]);
20 int main(int argc, char *argv[]) {
27 ssize_t num_read = read(fds[0], &msg, sizeof(msg));
28 ASSERT_EQ(num_read, sizeof(msg));
36 /* In the parent process. */
40 ssize_t num_written = write(fds[1], &msg, sizeof(msg));
41 ASSERT_EQ(num_written, sizeof(msg));
45 pid_t pid_waited = waitpid(pid, &status, 0);
46 ASSERT_EQ(pid_waited, pid);
47 ASSERT(WIFEXITED(status));
48 ASSERT_EQ(WEXITSTATUS(status), msg);