Bug 1464229 - Remove obsolete CPU-selection attributes when creating a new process on MacOS X; r?froydnj draft
authorGabriele Svelto <gsvelto@mozilla.com>
Thu, 24 May 2018 14:24:53 +0200
changeset 799518 52300f0fc70a349f07ee675d7e375cdd45586b11
parent 799267 043e4ab6e72469ed8121f4da98dcdfef983a49d9
push id111090
push usergsvelto@mozilla.com
push dateThu, 24 May 2018 20:59:51 +0000
reviewersfroydnj
bugs1464229
milestone62.0a1
Bug 1464229 - Remove obsolete CPU-selection attributes when creating a new process on MacOS X; r?froydnj MozReview-Commit-ID: DvqC9Vl8i6n
xpcom/threads/nsProcessCommon.cpp
--- a/xpcom/threads/nsProcessCommon.cpp
+++ b/xpcom/threads/nsProcessCommon.cpp
@@ -47,29 +47,16 @@
 #include <sys/errno.h>
 #endif
 #include <sys/types.h>
 #include <signal.h>
 #endif
 
 using namespace mozilla;
 
-#ifdef XP_MACOSX
-cpu_type_t pref_cpu_types[2] = {
-#if defined(__i386__)
-  CPU_TYPE_X86,
-#elif defined(__x86_64__)
-  CPU_TYPE_X86_64,
-#elif defined(__ppc__)
-  CPU_TYPE_POWERPC,
-#endif
-  CPU_TYPE_ANY
-};
-#endif
-
 //-------------------------------------------------------------------//
 // nsIProcess implementation
 //-------------------------------------------------------------------//
 NS_IMPL_ISUPPORTS(nsProcess, nsIProcess,
                   nsIObserver)
 
 //Constructor
 nsProcess::nsProcess()
@@ -543,40 +530,22 @@ nsProcess::RunProcess(bool aBlocking, ch
       return NS_ERROR_FILE_EXECUTION_FAILED;
     }
 
     mProcess = sinfo.hProcess;
   }
 
   mPid = GetProcessId(mProcess);
 #elif defined(XP_MACOSX)
-  // Initialize spawn attributes.
-  posix_spawnattr_t spawnattr;
-  if (posix_spawnattr_init(&spawnattr) != 0) {
-    return NS_ERROR_FAILURE;
-  }
-
-  // Set spawn attributes.
-  size_t attr_count = ArrayLength(pref_cpu_types);
-  size_t attr_ocount = 0;
-  if (posix_spawnattr_setbinpref_np(&spawnattr, attr_count, pref_cpu_types,
-                                    &attr_ocount) != 0 ||
-      attr_ocount != attr_count) {
-    posix_spawnattr_destroy(&spawnattr);
-    return NS_ERROR_FAILURE;
-  }
-
   // Note: |aMyArgv| is already null-terminated as required by posix_spawnp.
   pid_t newPid = 0;
-  int result = posix_spawnp(&newPid, aMyArgv[0], nullptr, &spawnattr, aMyArgv,
+  int result = posix_spawnp(&newPid, aMyArgv[0], nullptr, nullptr, aMyArgv,
                             *_NSGetEnviron());
   mPid = static_cast<int32_t>(newPid);
 
-  posix_spawnattr_destroy(&spawnattr);
-
   if (result != 0) {
     return NS_ERROR_FAILURE;
   }
 #elif defined(XP_UNIX)
   base::LaunchOptions options;
   std::vector<std::string> argvVec;
   for (char** arg = aMyArgv; *arg != nullptr; ++arg) {
     argvVec.push_back(*arg);