chromium/content/browser/zygote_host/zygote_host_impl_linux.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/browser/zygote_host/zygote_host_impl_linux.h"

#include <stdlib.h>
#include <sys/socket.h>
#include <sys/types.h>

#include "base/files/file_enumerator.h"
#include "base/logging.h"
#include "base/posix/unix_domain_socket.h"
#include "base/process/kill.h"
#include "base/process/memory.h"
#include "base/strings/string_number_conversions.h"
#include "base/types/fixed_array.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "content/common/zygote/zygote_commands_linux.h"
#include "content/common/zygote/zygote_communication_linux.h"
#include "content/common/zygote/zygote_handle_impl_linux.h"
#include "content/public/common/zygote/zygote_handle.h"
#include "sandbox/linux/services/credentials.h"
#include "sandbox/linux/services/namespace_sandbox.h"
#include "sandbox/linux/suid/client/setuid_sandbox_host.h"
#include "sandbox/linux/suid/common/sandbox.h"
#include "sandbox/policy/linux/sandbox_linux.h"
#include "sandbox/policy/switches.h"

#if BUILDFLAG(IS_CHROMEOS)
#include "content/common/zygote/zygote_communication_linux.h"
#include "content/common/zygote/zygote_handle_impl_linux.h"
#include "content/public/common/zygote/zygote_handle.h"
#endif  // BUILDFLAG(IS_CHROMEOS)

namespace content {

namespace {

// Receive a fixed message on fd and return the sender's PID.
// Returns true if the message received matches the expected message.
bool ReceiveFixedMessage(int fd,
                         const char* expect_msg,
                         size_t expect_len,
                         base::ProcessId* sender_pid) {}

}  // namespace

// static
ZygoteHost* ZygoteHost::GetInstance() {}

ZygoteHostImpl::ZygoteHostImpl()
    :{}

ZygoteHostImpl::~ZygoteHostImpl() {}

// static
ZygoteHostImpl* ZygoteHostImpl::GetInstance() {}

void ZygoteHostImpl::Init(const base::CommandLine& command_line) {}

void ZygoteHostImpl::AddZygotePid(pid_t pid) {}

bool ZygoteHostImpl::IsZygotePid(pid_t pid) {}

void ZygoteHostImpl::SetRendererSandboxStatus(int status) {}

int ZygoteHostImpl::GetRendererSandboxStatus() {}

pid_t ZygoteHostImpl::LaunchZygote(
    base::CommandLine* cmd_line,
    base::ScopedFD* control_fd,
    base::FileHandleMappingVector additional_remapped_fds) {}

#if !BUILDFLAG(IS_OPENBSD)
void ZygoteHostImpl::AdjustRendererOOMScore(base::ProcessHandle pid,
                                            int score) {}
#endif

#if BUILDFLAG(IS_CHROMEOS)
void ZygoteHostImpl::ReinitializeLogging(uint32_t logging_dest,
                                         base::PlatformFile log_file_fd) {
  if (!HasZygote()) {
    return;
  }

  content::ZygoteCommunication* generic_zygote = content::GetGenericZygote();
  content::ZygoteCommunication* unsandboxed_zygote =
      content::GetUnsandboxedZygote();

  generic_zygote->ReinitializeLogging(logging_dest, log_file_fd);
  if (unsandboxed_zygote) {
    unsandboxed_zygote->ReinitializeLogging(logging_dest, log_file_fd);
  }
}
#endif  // BUILDFLAG(IS_CHROMEOS)

}  // namespace content