$OpenBSD: patch-chrome_browser_child_process_launcher_cc,v 1.2 2011/02/08 09:43:02 espie Exp $
--- chrome/browser/child_process_launcher.cc.orig	Fri Jan 21 10:20:26 2011
+++ chrome/browser/child_process_launcher.cc	Sun Jan 23 23:27:31 2011
@@ -20,8 +20,9 @@
 #if defined(OS_WIN)
 #include "base/file_path.h"
 #include "chrome/common/sandbox_policy.h"
-#elif defined(OS_LINUX)
+#elif defined(OS_LINUX) || defined(OS_OPENBSD)
 #include "base/singleton.h"
+// XXX rene: use OpenBSD-specific versions for these?
 #include "chrome/browser/crash_handler_host_linux.h"
 #include "chrome/browser/zygote_host_linux.h"
 #include "chrome/browser/renderer_host/render_sandbox_host_linux.h"
@@ -45,7 +46,7 @@ class ChildProcessLauncher::Context
       : client_(NULL),
         client_thread_id_(BrowserThread::UI),
         starting_(true)
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_OPENBSD)
         , zygote_(false)
 #endif
         {
@@ -110,7 +111,7 @@ class ChildProcessLauncher::Context
     handle = sandbox::StartProcessWithAccess(cmd_line, exposed_dir);
 #elif defined(OS_POSIX)
 
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_OPENBSD)
     if (use_zygote) {
       base::GlobalDescriptors::Mapping mapping;
       mapping.push_back(std::pair<uint32_t, int>(kPrimaryIPCChannel, ipcfd));
@@ -130,8 +131,8 @@ class ChildProcessLauncher::Context
           ipcfd,
           kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor));
 
-#if defined(OS_LINUX)
-      // On Linux, we need to add some extra file descriptors for crash handling
+#if defined(OS_LINUX) || defined(OS_OPENBSD)
+      // On Linux/OpenBSD, we need to add some extra file descriptors for crash handling
       // and the sandbox.
       bool is_renderer =
           cmd_line->GetSwitchValueASCII(switches::kProcessType) ==
@@ -162,7 +163,7 @@ class ChildProcessLauncher::Context
             sandbox_fd,
             kSandboxIPCChannel + base::GlobalDescriptors::kBaseDescriptor));
       }
-#endif  // defined(OS_LINUX)
+#endif  // defined(OS_LINUX) || defined(OS_OPENBSD)
 
       bool launched = false;
 #if defined(OS_MACOSX)
@@ -198,20 +199,20 @@ class ChildProcessLauncher::Context
         NewRunnableMethod(
             this,
             &ChildProcessLauncher::Context::Notify,
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_OPENBSD)
             use_zygote,
 #endif
             handle));
   }
 
   void Notify(
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_OPENBSD)
       bool zygote,
 #endif
       base::ProcessHandle handle) {
     starting_ = false;
     process_.set_handle(handle);
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_OPENBSD)
     zygote_ = zygote;
 #endif
     if (client_) {
@@ -231,7 +232,7 @@ class ChildProcessLauncher::Context
         BrowserThread::PROCESS_LAUNCHER, FROM_HERE,
         NewRunnableFunction(
             &ChildProcessLauncher::Context::TerminateInternal,
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_OPENBSD)
             zygote_,
 #endif
             process_.handle()));
@@ -239,7 +240,7 @@ class ChildProcessLauncher::Context
   }
 
   static void TerminateInternal(
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_OPENBSD)
       bool zygote,
 #endif
       base::ProcessHandle handle) {
@@ -249,13 +250,13 @@ class ChildProcessLauncher::Context
     process.Terminate(ResultCodes::NORMAL_EXIT);
     // On POSIX, we must additionally reap the child.
 #if defined(OS_POSIX)
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_OPENBSD)
     if (zygote) {
       // If the renderer was created via a zygote, we have to proxy the reaping
       // through the zygote process.
       Singleton<ZygoteHost>()->EnsureProcessTerminated(handle);
     } else
-#endif  // OS_LINUX
+#endif  // OS_LINUX || OS_OPENBSD
     {
       ProcessWatcher::EnsureProcessTerminated(handle);
     }
@@ -268,7 +269,7 @@ class ChildProcessLauncher::Context
   base::Process process_;
   bool starting_;
 
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_OPENBSD)
   bool zygote_;
 #endif
 };
@@ -313,7 +314,7 @@ base::ProcessHandle ChildProcessLauncher::GetHandle() 
 bool ChildProcessLauncher::DidProcessCrash() {
   bool did_crash, child_exited;
   base::ProcessHandle handle = context_->process_.handle();
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_OPENBSD)
   if (context_->zygote_) {
     did_crash = Singleton<ZygoteHost>()->DidProcessCrash(handle, &child_exited);
   } else
