Index: mojo/edk/embedder/platform_channel_pair_posix.cc |
diff --git a/mojo/edk/embedder/platform_channel_pair_posix.cc b/mojo/edk/embedder/platform_channel_pair_posix.cc |
index 9c3883922fdb004d3ba0a6f11628f71835818953..4dcf48bd71bfe417588e9ba2d0dfd7b1bb67d65f 100644 |
--- a/mojo/edk/embedder/platform_channel_pair_posix.cc |
+++ b/mojo/edk/embedder/platform_channel_pair_posix.cc |
@@ -7,7 +7,6 @@ |
#include <fcntl.h> |
#include <stddef.h> |
#include <stdint.h> |
-#include <sys/socket.h> |
#include <sys/types.h> |
#include <unistd.h> |
@@ -21,6 +20,12 @@ |
#include "build/build_config.h" |
#include "mojo/edk/embedder/platform_handle.h" |
+#if !defined(OS_NACL) || defined(OS_NACL_NONSFI) |
+#include <sys/socket.h> |
+#else |
+#include "native_client/src/public/imc_syscalls.h" |
+#endif |
+ |
#if !defined(SO_PEEK_OFF) |
#define SO_PEEK_OFF 42 |
#endif |
@@ -47,6 +52,9 @@ PlatformChannelPair::PlatformChannelPair(bool client_is_blocking) { |
int fds[2]; |
// TODO(vtl): Maybe fail gracefully if |socketpair()| fails. |
+#if defined(OS_NACL) && !defined(OS_NACL_NONSFI) |
+ PCHECK(imc_socketpair(fds) == 0); |
+#else |
PCHECK(socketpair(AF_UNIX, SOCK_STREAM, 0, fds) == 0); |
// Set the ends to nonblocking. |
@@ -64,6 +72,7 @@ PlatformChannelPair::PlatformChannelPair(bool client_is_blocking) { |
PCHECK(setsockopt(fds[1], SOL_SOCKET, SO_NOSIGPIPE, &no_sigpipe, |
sizeof(no_sigpipe)) == 0); |
#endif // defined(OS_MACOSX) |
+#endif // defined(OS_NACL) && !defined(OS_NACL_NONSFI) |
server_handle_.reset(PlatformHandle(fds[0])); |
DCHECK(server_handle_.is_valid()); |