summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ipc/chromium/src/chrome/common/ipc_channel_posix.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/ipc/chromium/src/chrome/common/ipc_channel_posix.cc b/ipc/chromium/src/chrome/common/ipc_channel_posix.cc
index 0d3a2b16c7..9a88586560 100644
--- a/ipc/chromium/src/chrome/common/ipc_channel_posix.cc
+++ b/ipc/chromium/src/chrome/common/ipc_channel_posix.cc
@@ -8,6 +8,7 @@
#include <errno.h>
#include <fcntl.h>
+#include <limits.h>
#if defined(OS_MACOSX)
#include <sched.h>
#endif
@@ -39,8 +40,16 @@
#include "mozilla/ipc/Faulty.h"
#endif
-// Work around possible OS limitations.
+// Use OS specific iovec array limit where it's possible
+#if defined(IOV_MAX)
+static const size_t kMaxIOVecSize = IOV_MAX;
+// IOV_MAX isn't defined on Android, but the hard-coded 256 works well.
+#elif defined(ANDROID)
static const size_t kMaxIOVecSize = 256;
+// On all other platforms, fallback to 16 (_XOPEN_IOV_MAX) as a safe bet.
+#else
+static const size_t kMaxIOVecSize = 16;
+#endif
#ifdef MOZ_TASK_TRACER
#include "GeckoTaskTracerImpl.h"