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