summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/test/page_cycler/page_cycler_test.cc3
-rw-r--r--ipc/ipc_channel_posix.cc29
2 files changed, 23 insertions, 9 deletions
diff --git a/chrome/test/page_cycler/page_cycler_test.cc b/chrome/test/page_cycler/page_cycler_test.cc
index 845391a..099beab 100644
--- a/chrome/test/page_cycler/page_cycler_test.cc
+++ b/chrome/test/page_cycler/page_cycler_test.cc
@@ -184,7 +184,8 @@ class PageCyclerTest : public UITest {
test_path = test_path.Append(FILE_PATH_LITERAL("data"));
test_path = test_path.Append(FILE_PATH_LITERAL("page_cycler"));
test_path = test_path.AppendASCII(name);
- ASSERT_TRUE(file_util::PathExists(test_path)) << "Missing test data";
+ ASSERT_TRUE(file_util::PathExists(test_path)) << "Missing test data"
+ << test_path.value();
#if defined(OS_MACOSX)
PopulateUBC(test_path);
diff --git a/ipc/ipc_channel_posix.cc b/ipc/ipc_channel_posix.cc
index 0d178d5..545ad0c 100644
--- a/ipc/ipc_channel_posix.cc
+++ b/ipc/ipc_channel_posix.cc
@@ -241,6 +241,25 @@ bool ClientConnectToFifo(const std::string &pipe_name, int* client_socket) {
return true;
}
+bool SocketWriteErrorIsRecoverable() {
+#if defined(OS_MACOSX)
+ // On OS X if sendmsg() is trying to send fds between processes and there
+ // isn't enough room in the output buffer to send the fd structure over
+ // atomically then EMSGSIZE is returned.
+ //
+ // EMSGSIZE presents a problem since the system APIs can only call us when
+ // there's room in the socket buffer and not when there is "enough" room.
+ //
+ // The current behavior is to return to the event loop when EMSGSIZE is
+ // received and hopefull service another FD. This is however still
+ // technically a busy wait since the event loop will call us right back until
+ // the receiver has read enough data to allow passing the FD over atomically.
+ return errno == EAGAIN || errno == EMSGSIZE;
+#else
+ return errno == EAGAIN;
+#endif
+}
+
} // namespace
//------------------------------------------------------------------------------
@@ -815,7 +834,7 @@ bool Channel::ChannelImpl::ProcessOutgoingMessages() {
if (bytes_written > 0)
msg->file_descriptor_set()->CommitAll();
- if (bytes_written < 0 && errno != EAGAIN) {
+ if (bytes_written < 0 && !SocketWriteErrorIsRecoverable()) {
#if defined(OS_MACOSX)
// On OSX writing to a pipe with no listener returns EPERM.
if (errno == EPERM) {
@@ -830,13 +849,7 @@ bool Channel::ChannelImpl::ProcessOutgoingMessages() {
PLOG(ERROR) << "pipe error on "
<< fd_written
<< " Currently writing message of size:"
- << msg->size()
- << " msgh.msg_iovlen:"
- << msgh.msg_iovlen
- << " amt_to_write: "
- << amt_to_write
- << " num FDs to send:"
- << msg->file_descriptor_set()->size();
+ << msg->size();
return false;
}