Disable using the zygote process just like on macosx to make

chrome happy with rthreads.
This change is fine anyways because we are not using the setuid
sandboxing which would require the zygote process.
This commit is contained in:
robert 2012-03-20 20:52:44 +00:00
parent 805d47565c
commit 6e1993ad40
8 changed files with 265 additions and 1 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.85 2012/03/12 10:28:30 robert Exp $
# $OpenBSD: Makefile,v 1.86 2012/03/20 20:52:44 robert Exp $
ONLY_FOR_ARCHS= i386 amd64
@ -7,6 +7,8 @@ COMMENT= Chromium browser
V= 17.0.963.79
DISTNAME= chromium-${V}
REVISION= 0
CATEGORIES= www
HOMEPAGE= http://code.google.com/chromium/

View File

@ -0,0 +1,30 @@
$OpenBSD: patch-chrome_browser_memory_details_cc,v 1.7 2012/03/20 20:52:44 robert Exp $
--- chrome/browser/memory_details.cc.orig Tue Mar 20 13:11:43 2012
+++ chrome/browser/memory_details.cc Tue Mar 20 13:12:29 2012
@@ -29,7 +29,7 @@
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
#include "content/browser/renderer_host/render_sandbox_host_linux.h"
#include "content/browser/zygote_host_linux.h"
#endif
@@ -150,7 +150,7 @@ void MemoryDetails::CollectChildInfoOnIOThread() {
void MemoryDetails::CollectChildInfoOnUIThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
const pid_t zygote_pid = ZygoteHost::GetInstance()->pid();
const pid_t sandbox_helper_pid = RenderSandboxHostLinux::GetInstance()->pid();
#endif
@@ -298,7 +298,7 @@ void MemoryDetails::CollectChildInfoOnUIThread() {
}
}
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
if (process.pid == zygote_pid) {
process.type = content::PROCESS_TYPE_ZYGOTE;
} else if (process.pid == sandbox_helper_pid) {

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-chrome_browser_memory_details_linux_cc,v 1.1 2012/03/20 20:52:44 robert Exp $
--- chrome/browser/memory_details_linux.cc.orig Tue Mar 20 13:11:49 2012
+++ chrome/browser/memory_details_linux.cc Tue Mar 20 15:26:57 2012
@@ -240,7 +240,7 @@ void MemoryDetails::CollectProcessData(
}
std::vector<pid_t> current_browser_processes;
- const pid_t zygote = ZygoteHost::GetInstance()->pid();
+ const pid_t zygote = 0;
GetAllChildren(processes, getpid(), zygote, &current_browser_processes);
ProcessData current_browser;
GetProcessDataMemoryInformation(current_browser_processes, &current_browser);

View File

@ -0,0 +1,37 @@
$OpenBSD: patch-chrome_browser_ui_webui_about_ui_cc,v 1.1 2012/03/20 20:52:44 robert Exp $
--- chrome/browser/ui/webui/about_ui.cc.orig Tue Mar 20 13:11:46 2012
+++ chrome/browser/ui/webui/about_ui.cc Tue Mar 20 13:13:22 2012
@@ -81,7 +81,7 @@
#include "chrome/browser/chromeos/version_loader.h"
#include "chrome/browser/oom_priority_manager.h"
#include "content/browser/zygote_host_linux.h"
-#elif defined(OS_LINUX) || defined(OS_OPENBSD)
+#elif defined(OS_LINUX)
#include "content/browser/zygote_host_linux.h"
#endif
@@ -936,6 +936,7 @@ std::string AboutLinuxProxyConfig() {
return data;
}
+#if defined(OS_LINUX)
void AboutSandboxRow(std::string* data, const std::string& prefix, int name_id,
bool good) {
data->append("<tr><td>");
@@ -992,6 +993,7 @@ std::string AboutSandbox() {
return data;
}
#endif
+#endif
std::string AboutVersionStaticContent(const std::string& query) {
return ResourceBundle::GetSharedInstance().GetRawDataResource(
@@ -1322,7 +1324,7 @@ void AboutUIHTMLSource::StartDataRequest(const std::st
response = ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_OS_CREDITS_HTML).as_string();
#endif
-#if defined(OS_LINUX) || defined(OS_OPENBSD)
+#if defined(OS_LINUX)
} else if (host == chrome::kChromeUISandboxHost) {
response = AboutSandbox();
#endif

View File

@ -0,0 +1,30 @@
$OpenBSD: patch-content_app_content_main_cc,v 1.4 2012/03/20 20:52:44 robert Exp $
--- content/app/content_main.cc.orig Tue Mar 20 15:27:41 2012
+++ content/app/content_main.cc Tue Mar 20 15:28:24 2012
@@ -68,7 +68,7 @@ extern int PpapiBrokerMain(const content::MainFunction
extern int RendererMain(const content::MainFunctionParams&);
extern int WorkerMain(const content::MainFunctionParams&);
extern int UtilityMain(const content::MainFunctionParams&);
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
extern int ZygoteMain(const content::MainFunctionParams&,
content::ZygoteForkDelegate* forkdelegate);
#endif
@@ -181,7 +181,7 @@ struct MainFunction {
int (*function)(const content::MainFunctionParams&);
};
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
// On platforms that use the zygote, we have a special subset of
// subprocesses that are launched via the zygote. This function
// fills in some process-launching bits around ZygoteMain().
@@ -263,7 +263,7 @@ int RunNamedProcessTypeMain(
return kMainFunctions[i].function(main_function_params);
}
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
// Zygote startup is special -- see RunZygote comments above
// for why we don't use ZygoteMain directly.
if (process_type == switches::kZygoteProcess)

View File

@ -0,0 +1,39 @@
$OpenBSD: patch-content_browser_browser_main_loop_cc,v 1.1 2012/03/20 20:52:44 robert Exp $
--- content/browser/browser_main_loop.cc.orig Tue Mar 20 12:51:42 2012
+++ content/browser/browser_main_loop.cc Tue Mar 20 12:56:04 2012
@@ -51,7 +51,7 @@
#include "ui/gfx/gtk_util.h"
#endif
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
#include <sys/stat.h>
#include "content/browser/renderer_host/render_sandbox_host_linux.h"
#include "content/browser/zygote_host_linux.h"
@@ -59,7 +59,7 @@
namespace {
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
void SetupSandbox(const CommandLine& parsed_command_line) {
// TODO(evanm): move this into SandboxWrapper; I'm just trying to move this
// code en masse out of chrome_main for now.
@@ -165,7 +165,7 @@ class BrowserShutdownImpl {
// At this point the message loop is still running yet we've shut everything
// down. If any messages are processed we'll likely crash. Exit now.
ExitProcess(content::RESULT_CODE_NORMAL_EXIT);
-#elif defined(OS_POSIX) && !defined(OS_MACOSX)
+#elif defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
_exit(content::RESULT_CODE_NORMAL_EXIT);
#else
NOTIMPLEMENTED();
@@ -233,7 +233,7 @@ void BrowserMainLoop::EarlyInitialization() {
}
#endif // !defined(USE_OPENSSL)
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
SetupSandbox(parsed_command_line_);
#endif

View File

@ -0,0 +1,101 @@
$OpenBSD: patch-content_browser_child_process_launcher_cc,v 1.4 2012/03/20 20:52:44 robert Exp $
--- content/browser/child_process_launcher.cc.orig Tue Mar 20 12:51:45 2012
+++ content/browser/child_process_launcher.cc Tue Mar 20 12:57:28 2012
@@ -50,7 +50,7 @@ class ChildProcessLauncher::Context
exit_code_(content::RESULT_CODE_NORMAL_EXIT),
starting_(true),
terminate_child_on_shutdown_(true)
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
, zygote_(false)
#endif
{
@@ -127,7 +127,7 @@ class ChildProcessLauncher::Context
// to reliably detect child termination.
file_util::ScopedFD ipcfd_closer(&ipcfd);
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
// On Linux, we need to add some extra file descriptors for crash handling.
std::string process_type =
cmd_line->GetSwitchValueASCII(switches::kProcessType);
@@ -152,7 +152,7 @@ class ChildProcessLauncher::Context
ipcfd,
kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor));
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
if (crash_signal_fd >= 0) {
fds_to_map.push_back(std::make_pair(
crash_signal_fd,
@@ -209,14 +209,14 @@ class ChildProcessLauncher::Context
base::Bind(
&Context::Notify,
this_object.get(),
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
use_zygote,
#endif
handle));
}
void Notify(
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
bool zygote,
#endif
base::ProcessHandle handle) {
@@ -225,7 +225,7 @@ class ChildProcessLauncher::Context
if (!handle)
LOG(ERROR) << "Failed to launch child process";
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
zygote_ = zygote;
#endif
if (client_) {
@@ -248,7 +248,7 @@ class ChildProcessLauncher::Context
BrowserThread::PROCESS_LAUNCHER, FROM_HERE,
base::Bind(
&Context::TerminateInternal,
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
zygote_,
#endif
process_.handle()));
@@ -262,7 +262,7 @@ class ChildProcessLauncher::Context
}
static void TerminateInternal(
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
bool zygote,
#endif
base::ProcessHandle handle) {
@@ -272,7 +272,7 @@ class ChildProcessLauncher::Context
process.Terminate(content::RESULT_CODE_NORMAL_EXIT);
// On POSIX, we must additionally reap the child.
#if defined(OS_POSIX)
-#if !defined(OS_MACOSX)
+#if !defined(OS_MACOSX) && !defined(OS_OPENBSD)
if (zygote) {
// If the renderer was created via a zygote, we have to proxy the reaping
// through the zygote process.
@@ -296,7 +296,7 @@ class ChildProcessLauncher::Context
// shutdown. Default behavior is to terminate the child.
bool terminate_child_on_shutdown_;
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
bool zygote_;
#endif
};
@@ -347,7 +347,7 @@ base::TerminationStatus ChildProcessLauncher::GetChild
*exit_code = context_->exit_code_;
return context_->termination_status_;
}
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
if (context_->zygote_) {
context_->termination_status_ = ZygoteHost::GetInstance()->
GetTerminationStatus(handle, &context_->exit_code_);

View File

@ -0,0 +1,13 @@
$OpenBSD: patch-content_content_browser_gypi,v 1.8 2012/03/20 20:52:44 robert Exp $
--- content/content_browser.gypi.orig Tue Mar 20 12:57:50 2012
+++ content/content_browser.gypi Tue Mar 20 12:57:59 2012
@@ -636,9 +636,6 @@
'browser/worker_host/worker_service.cc',
'browser/worker_host/worker_service.h',
'browser/worker_host/worker_service_observer.h',
- 'browser/zygote_host_linux.cc',
- 'browser/zygote_host_linux.h',
- 'browser/zygote_main_linux.cc',
],
'conditions': [
['p2p_apis==1', {