From 52f2321cba8486169779773dc13a213410fc853b Mon Sep 17 00:00:00 2001 From: athenian200 Date: Wed, 2 Oct 2019 01:16:38 -0500 Subject: MoonchildProductions#1251 - Part 10: ipc_channel_posix.cc should use IOV_MAX. https://bugzilla.mozilla.org/show_bug.cgi?id=1345102 I assess this change to be low-risk for the following reasons: 1. It has been in Firefox since version 55 without issues. 2. The current behavior is not POSIX compliant, and is retained in the one instance where the new functionality causes issues. 3. It makes safer assumptions about implementation details than what we have now. --- ipc/chromium/src/chrome/common/ipc_channel_posix.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'ipc') diff --git a/ipc/chromium/src/chrome/common/ipc_channel_posix.cc b/ipc/chromium/src/chrome/common/ipc_channel_posix.cc index 0d3a2b16c..9a8858656 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 #include +#include #if defined(OS_MACOSX) #include #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" -- cgit v1.2.3