$OpenBSD: patch-content_browser_zygote_host_linux_cc,v 1.2 2011/06/08 20:36:56 robert Exp $
--- content/browser/zygote_host_linux.cc.orig	Mon Jun  6 11:11:28 2011
+++ content/browser/zygote_host_linux.cc	Wed Jun  8 18:13:20 2011
@@ -61,7 +61,12 @@ ZygoteHost::ZygoteHost()
 }
 
 ZygoteHost::~ZygoteHost() {
+  Pickle pickle;
   if (init_)
+#if defined(OS_OPENBSD)
+    pickle.WriteInt(kCmdEnd);
+    HANDLE_EINTR(write(control_fd_, pickle.data(), pickle.size()));
+#endif
     close(control_fd_);
 }
 
@@ -81,7 +86,12 @@ void ZygoteHost::Init(const std::string& sandbox_cmd) 
   cmd_line.AppendSwitchASCII(switches::kProcessType, switches::kZygoteProcess);
 
   int fds[2];
+#if defined(OS_OPENBSD)
+  if (socketpair(PF_UNIX, SOCK_SEQPACKET, 0, fds) != 0)
+    CHECK(socketpair(PF_UNIX, SOCK_DGRAM, 0, fds) == 0);
+#else
   CHECK(socketpair(PF_UNIX, SOCK_SEQPACKET, 0, fds) == 0);
+#endif
   base::file_handle_mapping_vector fds_to_map;
   fds_to_map.push_back(std::make_pair(fds[1], 3));
 
@@ -153,6 +163,7 @@ void ZygoteHost::Init(const std::string& sandbox_cmd) 
     // We need to look for it.
     // But first, wait for the zygote to tell us it's running.
     // The sending code is in chrome/browser/zygote_main_linux.cc.
+#if defined(OS_LINUX) || defined(OS_OPENBSD)
     std::vector<int> fds_vec;
     const int kExpectedLength = sizeof(kZygoteMagic);
     char buf[kExpectedLength];
@@ -184,6 +195,7 @@ void ZygoteHost::Init(const std::string& sandbox_cmd) 
       ProcessWatcher::EnsureProcessGetsReaped(process);
     }
   } else {
+#endif
     // Not using the SUID sandbox.
     pid_ = process;
   }
@@ -250,12 +262,15 @@ pid_t ZygoteHost::ForkRenderer(
       return base::kNullProcessHandle;
   }
 
+#if defined(OS_LINUX)
   const int kRendererScore = 5;
   AdjustRendererOOMScore(pid, kRendererScore);
+#endif
 
   return pid;
 }
 
+#if defined(OS_LINUX)
 void ZygoteHost::AdjustRendererOOMScore(base::ProcessHandle pid, int score) {
   // 1) You can't change the oom_adj of a non-dumpable process (EPERM) unless
   //    you're root. Because of this, we can't set the oom_adj from the browser
@@ -307,6 +322,7 @@ void ZygoteHost::AdjustRendererOOMScore(base::ProcessH
       PLOG(ERROR) << "Failed to adjust OOM score of renderer with pid " << pid;
   }
 }
+#endif
 
 void ZygoteHost::EnsureProcessTerminated(pid_t process) {
   DCHECK(init_);
