Bug 950401 - Add process logging to OS X / BSD. r=bsmedberg, a=lizzard
authorHenrik Skupin <mail@hskupin.info>
Fri, 03 Jun 2016 18:26:15 +0200
changeset 341749 26ba0781a8e286fd187a3a803d296c26c73f4e46
parent 341748 96cf57b4015f62baf1ad2ffb6b1a8e9dc4232cbb
child 341750 dcc1086117447e34a1037967b5d80024a54593dc
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg, lizzard
bugs950401
milestone49.0a2
Bug 950401 - Add process logging to OS X / BSD. r=bsmedberg, a=lizzard MozReview-Commit-ID: bEPQabbSP1
ipc/chromium/src/base/process_util_bsd.cc
ipc/chromium/src/base/process_util_mac.mm
--- a/ipc/chromium/src/base/process_util_bsd.cc
+++ b/ipc/chromium/src/base/process_util_bsd.cc
@@ -12,16 +12,22 @@
 #include <spawn.h>
 #include <sys/wait.h>
 
 #include <string>
 
 #include "nspr.h"
 #include "base/eintr_wrapper.h"
 
+namespace {
+
+static mozilla::EnvironmentLog gProcessLog("MOZ_PROCESS_LOG");
+
+}  // namespace
+
 namespace base {
 
 void FreeEnvVarsArray(char* array[], int length)
 {
   for (int i = 0; i < length; i++) {
     free(array[i]);
   }
   delete[] array;
@@ -130,16 +136,18 @@ bool LaunchApp(const std::vector<std::st
   FreeEnvVarsArray(vars, varsLen);
 
   posix_spawn_file_actions_destroy(&file_actions);
 
   bool process_handle_valid = pid > 0;
   if (!spawn_succeeded || !process_handle_valid) {
     retval = false;
   } else {
+    gProcessLog.print("==> process %d launched child process %d\n",
+                      GetCurrentProcId(), pid);
     if (wait)
       HANDLE_EINTR(waitpid(pid, 0, 0));
 
     if (process_handle)
       *process_handle = pid;
   }
 
   return retval;
--- a/ipc/chromium/src/base/process_util_mac.mm
+++ b/ipc/chromium/src/base/process_util_mac.mm
@@ -13,16 +13,22 @@
 #include <string>
 
 #include "base/eintr_wrapper.h"
 #include "base/logging.h"
 #include "base/rand_util.h"
 #include "base/string_util.h"
 #include "base/time.h"
 
+namespace {
+
+static mozilla::EnvironmentLog gProcessLog("MOZ_PROCESS_LOG");
+
+}  // namespace
+
 namespace base {
 
 void FreeEnvVarsArray(char* array[], int length)
 {
   for (int i = 0; i < length; i++) {
     free(array[i]);
   }
   delete[] array;
@@ -165,16 +171,18 @@ bool LaunchApp(const std::vector<std::st
   posix_spawn_file_actions_destroy(&file_actions);
 
   posix_spawnattr_destroy(&spawnattr);
 
   bool process_handle_valid = pid > 0;
   if (!spawn_succeeded || !process_handle_valid) {
     retval = false;
   } else {
+    gProcessLog.print("==> process %d launched child process %d\n",
+                      GetCurrentProcId(), pid);
     if (wait)
       HANDLE_EINTR(waitpid(pid, 0, 0));
 
     if (process_handle)
       *process_handle = pid;
   }
 
   return retval;