blob: b638886bcb203ba805e6901f4ba57f07b26e8f5e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
--- content/browser/browser_main_loop.cc.orig 2022-12-01 10:35:46 UTC
+++ content/browser/browser_main_loop.cc
@@ -241,6 +241,12 @@
#include "mojo/public/cpp/bindings/lib/test_random_mojo_delays.h"
#endif
+#if BUILDFLAG(IS_BSD)
+#include "content/browser/sandbox_host_linux.h"
+#include "content/public/common/zygote/sandbox_support_linux.h"
+#include "sandbox/policy/sandbox.h"
+#endif
+
// One of the linux specific headers defines this as a macro.
#ifdef DestroyAll
#undef DestroyAll
@@ -524,6 +530,12 @@ int BrowserMainLoop::EarlyInitialization() {
// by now since a thread to start the ServiceManager has been created
// before the browser main loop starts.
DCHECK(SandboxHostLinux::GetInstance()->IsInitialized());
+#elif BUILDFLAG(IS_BSD)
+ base::FileHandleMappingVector additional_remapped_fds;
+ base::LaunchOptions options;
+ SandboxHostLinux::GetInstance()->Init();
+ const int sfd = SandboxHostLinux::GetInstance()->GetChildSocket();
+ options.fds_to_remap.push_back(std::make_pair(sfd, GetSandboxFD()));
#endif
// GLib's spawning of new processes is buggy, so it's important that at this
@@ -555,7 +567,7 @@ int BrowserMainLoop::EarlyInitialization() {
base::PlatformThread::SetCurrentThreadType(base::ThreadType::kCompositing);
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
- BUILDFLAG(IS_ANDROID)
+ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
// We use quite a few file descriptors for our IPC as well as disk the disk
// cache,and the default limit on the Mac is low (256), so bump it up.
|