Refactor OS_LINUX usage for coming LaCrOs update.

We're working to decouple ChromeOS and Linux builds of Chrome.

Currently OS_CHROMEOS sets OS_LINUX, so we need to refactor
current OS_LINUX usage to make this explicit.

More information can be found at go/cros_is_linux_os_linux

BUG=chromium:1110266
TEST=manual build

Change-Id: Ie765da1ab6a0bf0286538ae1df3697abaa29aeaa
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2391116
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
Sean McAllister 2020-09-03 12:48:55 -06:00 committed by Commit Bot
parent c4acae9f96
commit 3965bc7d78
36 changed files with 103 additions and 101 deletions

View File

@ -33,7 +33,7 @@
#elif defined(OS_WIN) #elif defined(OS_WIN)
#include <windows.h> #include <windows.h>
#include "util/win/scoped_handle.h" #include "util/win/scoped_handle.h"
#elif defined(OS_LINUX) || defined(OS_ANDROID) #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
#include <signal.h> #include <signal.h>
#include <ucontext.h> #include <ucontext.h>
#endif #endif
@ -121,7 +121,7 @@ class CrashpadClient {
bool asynchronous_start, bool asynchronous_start,
const std::vector<base::FilePath>& attachments = {}); const std::vector<base::FilePath>& attachments = {});
#if defined(OS_ANDROID) || defined(OS_LINUX) || DOXYGEN #if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS) || DOXYGEN
//! \brief Retrieve the socket and process ID for the handler. //! \brief Retrieve the socket and process ID for the handler.
//! //!
//! `StartHandler()` must have successfully been called before calling this //! `StartHandler()` must have successfully been called before calling this
@ -166,7 +166,7 @@ class CrashpadClient {
//! //!
//! \return `true` on success. Otherwise `false` with a message logged. //! \return `true` on success. Otherwise `false` with a message logged.
static bool InitializeSignalStackForThread(); static bool InitializeSignalStackForThread();
#endif // OS_ANDROID || OS_LINUX || DOXYGEN #endif // OS_ANDROID || OS_LINUX || OS_CHROMEOS || DOXYGEN
#if defined(OS_ANDROID) || DOXYGEN #if defined(OS_ANDROID) || DOXYGEN
//! \brief Installs a signal handler to execute `/system/bin/app_process` and //! \brief Installs a signal handler to execute `/system/bin/app_process` and
@ -337,7 +337,7 @@ class CrashpadClient {
int socket); int socket);
#endif // OS_ANDROID || DOXYGEN #endif // OS_ANDROID || DOXYGEN
#if defined(OS_LINUX) || defined(OS_ANDROID) || DOXYGEN #if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_CHROMEOS) || DOXYGEN
//! \brief Installs a signal handler to launch a handler process in reponse to //! \brief Installs a signal handler to launch a handler process in reponse to
//! a crash. //! a crash.
//! //!
@ -450,7 +450,7 @@ class CrashpadClient {
//! //!
//! \param[in] unhandled_signals The set of unhandled signals //! \param[in] unhandled_signals The set of unhandled signals
void SetUnhandledSignals(const std::set<int>& unhandled_signals); void SetUnhandledSignals(const std::set<int>& unhandled_signals);
#endif // OS_LINUX || OS_ANDROID || DOXYGEN #endif // OS_LINUX || OS_ANDROID || OS_CHROMEOS || DOXYGEN
#if defined(OS_IOS) || DOXYGEN #if defined(OS_IOS) || DOXYGEN
//! \brief Configures the process to direct its crashes to the iOS in-process //! \brief Configures the process to direct its crashes to the iOS in-process
@ -662,7 +662,7 @@ class CrashpadClient {
#elif defined(OS_WIN) #elif defined(OS_WIN)
std::wstring ipc_pipe_; std::wstring ipc_pipe_;
ScopedKernelHANDLE handler_start_thread_; ScopedKernelHANDLE handler_start_thread_;
#elif defined(OS_LINUX) || defined(OS_ANDROID) #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
std::set<int> unhandled_signals_; std::set<int> unhandled_signals_;
#endif // OS_APPLE #endif // OS_APPLE

View File

@ -411,7 +411,7 @@ bool CrashpadClient::StartHandler(
std::move(client_sock), handler_pid, &unhandled_signals_); std::move(client_sock), handler_pid, &unhandled_signals_);
} }
#if defined(OS_ANDROID) || defined(OS_LINUX) #if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS)
// static // static
bool CrashpadClient::GetHandlerSocket(int* sock, pid_t* pid) { bool CrashpadClient::GetHandlerSocket(int* sock, pid_t* pid) {
auto signal_handler = RequestCrashDumpHandler::Get(); auto signal_handler = RequestCrashDumpHandler::Get();
@ -515,7 +515,7 @@ bool CrashpadClient::InitializeSignalStackForThread() {
} }
return true; return true;
} }
#endif // OS_ANDROID || OS_LINUX #endif // OS_ANDROID || OS_LINUX || OS_CHROMEOS
#if defined(OS_ANDROID) #if defined(OS_ANDROID)

View File

@ -94,7 +94,8 @@ extern "C" int* CRASHPAD_NOTE_REFERENCE;
// static // static
CrashpadInfo* CrashpadInfo::GetCrashpadInfo() { CrashpadInfo* CrashpadInfo::GetCrashpadInfo() {
#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FUCHSIA) #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \
defined(OS_FUCHSIA)
// This otherwise-unused reference is used so that any module that // This otherwise-unused reference is used so that any module that
// references GetCrashpadInfo() will also include the note in the // references GetCrashpadInfo() will also include the note in the
// .note.crashpad.info section. That note in turn contains the address of // .note.crashpad.info section. That note in turn contains the address of

View File

@ -21,7 +21,7 @@
#include "client/simulate_crash_mac.h" #include "client/simulate_crash_mac.h"
#elif defined(OS_WIN) #elif defined(OS_WIN)
#include "client/simulate_crash_win.h" #include "client/simulate_crash_win.h"
#elif defined(OS_LINUX) || defined(OS_ANDROID) #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
#include "client/simulate_crash_linux.h" #include "client/simulate_crash_linux.h"
#endif #endif

View File

@ -60,7 +60,7 @@
#include "handler/linux/cros_crash_report_exception_handler.h" #include "handler/linux/cros_crash_report_exception_handler.h"
#endif #endif
#if defined(OS_LINUX) || defined(OS_ANDROID) #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
#include <unistd.h> #include <unistd.h>
#include "handler/linux/crash_report_exception_handler.h" #include "handler/linux/crash_report_exception_handler.h"
@ -86,9 +86,6 @@
#include "util/win/handle.h" #include "util/win/handle.h"
#include "util/win/initial_client_data.h" #include "util/win/initial_client_data.h"
#include "util/win/session_end_watcher.h" #include "util/win/session_end_watcher.h"
#elif defined(OS_LINUX)
#include "handler/linux/crash_report_exception_handler.h"
#include "handler/linux/exception_handler_server.h"
#endif // OS_APPLE #endif // OS_APPLE
namespace crashpad { namespace crashpad {
@ -125,9 +122,9 @@ void Usage(const base::FilePath& me) {
" Address_debug_critical_section\n" " Address_debug_critical_section\n"
" use precreated data to register initial client\n" " use precreated data to register initial client\n"
#endif // OS_WIN #endif // OS_WIN
#if defined(OS_ANDROID) || defined(OS_LINUX) #if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS)
" --initial-client-fd=FD a socket connected to a client.\n" " --initial-client-fd=FD a socket connected to a client.\n"
#endif // OS_ANDROID || OS_LINUX #endif // OS_ANDROID || OS_LINUX || OS_CHROMEOS
#if defined(OS_APPLE) #if defined(OS_APPLE)
" --mach-service=SERVICE register SERVICE with the bootstrap server\n" " --mach-service=SERVICE register SERVICE with the bootstrap server\n"
#endif // OS_APPLE #endif // OS_APPLE
@ -154,7 +151,7 @@ void Usage(const base::FilePath& me) {
" --reset-own-crash-exception-port-to-system-default\n" " --reset-own-crash-exception-port-to-system-default\n"
" reset the server's exception handler to default\n" " reset the server's exception handler to default\n"
#endif // OS_APPLE #endif // OS_APPLE
#if defined(OS_LINUX) || defined(OS_ANDROID) #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
" --sanitization-information=SANITIZATION_INFORMATION_ADDRESS\n" " --sanitization-information=SANITIZATION_INFORMATION_ADDRESS\n"
" the address of a SanitizationInformation struct.\n" " the address of a SanitizationInformation struct.\n"
" --shared-client-connection the file descriptor provided by\n" " --shared-client-connection the file descriptor provided by\n"
@ -162,7 +159,7 @@ void Usage(const base::FilePath& me) {
" clients\n" " clients\n"
" --trace-parent-with-exception=EXCEPTION_INFORMATION_ADDRESS\n" " --trace-parent-with-exception=EXCEPTION_INFORMATION_ADDRESS\n"
" request a dump for the handler's parent process\n" " request a dump for the handler's parent process\n"
#endif // OS_LINUX || OS_ANDROID #endif // OS_LINUX || OS_CHROMEOS || OS_ANDROID
" --url=URL send crash reports to this Breakpad server URL,\n" " --url=URL send crash reports to this Breakpad server URL,\n"
" only if uploads are enabled for the database\n" " only if uploads are enabled for the database\n"
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
@ -197,7 +194,7 @@ struct Options {
std::string mach_service; std::string mach_service;
int handshake_fd; int handshake_fd;
bool reset_own_crash_exception_port_to_system_default; bool reset_own_crash_exception_port_to_system_default;
#elif defined(OS_LINUX) || defined(OS_ANDROID) #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
VMAddress exception_information_address; VMAddress exception_information_address;
VMAddress sanitization_information_address; VMAddress sanitization_information_address;
int initial_client_fd; int initial_client_fd;
@ -280,7 +277,8 @@ class CallMetricsRecordNormalExit {
DISALLOW_COPY_AND_ASSIGN(CallMetricsRecordNormalExit); DISALLOW_COPY_AND_ASSIGN(CallMetricsRecordNormalExit);
}; };
#if defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_ANDROID) #if defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \
defined(OS_ANDROID)
void HandleCrashSignal(int sig, siginfo_t* siginfo, void* context) { void HandleCrashSignal(int sig, siginfo_t* siginfo, void* context) {
MetricsRecordExit(Metrics::LifetimeMilestone::kCrashed); MetricsRecordExit(Metrics::LifetimeMilestone::kCrashed);
@ -539,9 +537,9 @@ int HandlerMain(int argc,
#if defined(OS_WIN) #if defined(OS_WIN)
kOptionInitialClientData, kOptionInitialClientData,
#endif // OS_WIN #endif // OS_WIN
#if defined(OS_ANDROID) || defined(OS_LINUX) #if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS)
kOptionInitialClientFD, kOptionInitialClientFD,
#endif // OS_ANDROID || OS_LINUX #endif // OS_ANDROID || OS_LINUX || OS_CHROMEOS
#if defined(OS_APPLE) #if defined(OS_APPLE)
kOptionMachService, kOptionMachService,
#endif // OS_APPLE #endif // OS_APPLE
@ -562,7 +560,7 @@ int HandlerMain(int argc,
#if defined(OS_APPLE) #if defined(OS_APPLE)
kOptionResetOwnCrashExceptionPortToSystemDefault, kOptionResetOwnCrashExceptionPortToSystemDefault,
#endif // OS_APPLE #endif // OS_APPLE
#if defined(OS_LINUX) || defined(OS_ANDROID) #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
kOptionSanitizationInformation, kOptionSanitizationInformation,
kOptionSharedClientConnection, kOptionSharedClientConnection,
kOptionTraceParentWithException, kOptionTraceParentWithException,
@ -597,9 +595,9 @@ int HandlerMain(int argc,
nullptr, nullptr,
kOptionInitialClientData}, kOptionInitialClientData},
#endif // OS_APPLE #endif // OS_APPLE
#if defined(OS_ANDROID) || defined(OS_LINUX) #if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS)
{"initial-client-fd", required_argument, nullptr, kOptionInitialClientFD}, {"initial-client-fd", required_argument, nullptr, kOptionInitialClientFD},
#endif // OS_ANDROID || OS_LINUX #endif // OS_ANDROID || OS_LINUX || OS_CHROMEOS
#if defined(OS_APPLE) #if defined(OS_APPLE)
{"mach-service", required_argument, nullptr, kOptionMachService}, {"mach-service", required_argument, nullptr, kOptionMachService},
#endif // OS_APPLE #endif // OS_APPLE
@ -635,7 +633,7 @@ int HandlerMain(int argc,
nullptr, nullptr,
kOptionResetOwnCrashExceptionPortToSystemDefault}, kOptionResetOwnCrashExceptionPortToSystemDefault},
#endif // OS_APPLE #endif // OS_APPLE
#if defined(OS_LINUX) || defined(OS_ANDROID) #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
{"sanitization-information", {"sanitization-information",
required_argument, required_argument,
nullptr, nullptr,
@ -648,7 +646,7 @@ int HandlerMain(int argc,
required_argument, required_argument,
nullptr, nullptr,
kOptionTraceParentWithException}, kOptionTraceParentWithException},
#endif // OS_LINUX || OS_ANDROID #endif // OS_LINUX || OS_CHROMEOS || OS_ANDROID
{"url", required_argument, nullptr, kOptionURL}, {"url", required_argument, nullptr, kOptionURL},
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
{"use-cros-crash-reporter", {"use-cros-crash-reporter",
@ -677,7 +675,7 @@ int HandlerMain(int argc,
options.handshake_fd = -1; options.handshake_fd = -1;
#endif #endif
options.identify_client_via_url = true; options.identify_client_via_url = true;
#if defined(OS_LINUX) || defined(OS_ANDROID) #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
options.initial_client_fd = kInvalidFileHandle; options.initial_client_fd = kInvalidFileHandle;
#endif #endif
options.periodic_tasks = true; options.periodic_tasks = true;
@ -733,7 +731,7 @@ int HandlerMain(int argc,
break; break;
} }
#endif // OS_WIN #endif // OS_WIN
#if defined(OS_ANDROID) || defined(OS_LINUX) #if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS)
case kOptionInitialClientFD: { case kOptionInitialClientFD: {
if (!base::StringToInt(optarg, &options.initial_client_fd)) { if (!base::StringToInt(optarg, &options.initial_client_fd)) {
ToolSupport::UsageHint(me, "failed to parse --initial-client-fd"); ToolSupport::UsageHint(me, "failed to parse --initial-client-fd");
@ -741,7 +739,7 @@ int HandlerMain(int argc,
} }
break; break;
} }
#endif // OS_ANDROID || OS_LINUX #endif // OS_ANDROID || OS_LINUX || OS_CHROMEOS
case kOptionMetrics: { case kOptionMetrics: {
options.metrics_dir = base::FilePath( options.metrics_dir = base::FilePath(
ToolSupport::CommandLineArgumentToFilePathStringType(optarg)); ToolSupport::CommandLineArgumentToFilePathStringType(optarg));
@ -797,7 +795,7 @@ int HandlerMain(int argc,
break; break;
} }
#endif // OS_APPLE #endif // OS_APPLE
#if defined(OS_LINUX) || defined(OS_ANDROID) #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
case kOptionSanitizationInformation: { case kOptionSanitizationInformation: {
if (!StringToNumber(optarg, if (!StringToNumber(optarg,
&options.sanitization_information_address)) { &options.sanitization_information_address)) {
@ -819,7 +817,7 @@ int HandlerMain(int argc,
} }
break; break;
} }
#endif // OS_LINUX || OS_ANDROID #endif // OS_LINUX || OS_CHROMEOS || OS_ANDROID
case kOptionURL: { case kOptionURL: {
options.url = optarg; options.url = optarg;
break; break;
@ -885,7 +883,7 @@ int HandlerMain(int argc,
me, "--initial-client-data and --pipe-name are incompatible"); me, "--initial-client-data and --pipe-name are incompatible");
return ExitFailure(); return ExitFailure();
} }
#elif defined(OS_LINUX) || defined(OS_ANDROID) #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
if (!options.exception_information_address && if (!options.exception_information_address &&
options.initial_client_fd == kInvalidFileHandle) { options.initial_client_fd == kInvalidFileHandle) {
ToolSupport::UsageHint( ToolSupport::UsageHint(
@ -978,7 +976,7 @@ int HandlerMain(int argc,
upload_thread.Get()->Start(); upload_thread.Get()->Start();
} }
#if defined(OS_LINUX) || defined(OS_ANDROID) #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
std::unique_ptr<ExceptionHandlerServer::Delegate> exception_handler; std::unique_ptr<ExceptionHandlerServer::Delegate> exception_handler;
#else #else
std::unique_ptr<CrashReportExceptionHandler> exception_handler; std::unique_ptr<CrashReportExceptionHandler> exception_handler;
@ -1029,7 +1027,7 @@ int HandlerMain(int argc,
user_stream_sources); user_stream_sources);
#endif // OS_CHROMEOS #endif // OS_CHROMEOS
#if defined(OS_LINUX) || defined(OS_ANDROID) #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
if (options.exception_information_address) { if (options.exception_information_address) {
ExceptionHandlerProtocol::ClientInformation info; ExceptionHandlerProtocol::ClientInformation info;
info.exception_information_address = options.exception_information_address; info.exception_information_address = options.exception_information_address;
@ -1039,7 +1037,7 @@ int HandlerMain(int argc,
? EXIT_SUCCESS ? EXIT_SUCCESS
: ExitFailure(); : ExitFailure();
} }
#endif // OS_LINUX || OS_ANDROID #endif // OS_LINUX || OS_CHROMEOS || OS_ANDROID
ScopedStoppable prune_thread; ScopedStoppable prune_thread;
if (options.periodic_tasks) { if (options.periodic_tasks) {
@ -1101,7 +1099,7 @@ int HandlerMain(int argc,
if (!options.pipe_name.empty()) { if (!options.pipe_name.empty()) {
exception_handler_server.SetPipeName(base::UTF8ToUTF16(options.pipe_name)); exception_handler_server.SetPipeName(base::UTF8ToUTF16(options.pipe_name));
} }
#elif defined(OS_LINUX) || defined(OS_ANDROID) #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
ExceptionHandlerServer exception_handler_server; ExceptionHandlerServer exception_handler_server;
#endif // OS_APPLE #endif // OS_APPLE
@ -1123,7 +1121,7 @@ int HandlerMain(int argc,
exception_handler_server.InitializeWithInheritedDataForInitialClient( exception_handler_server.InitializeWithInheritedDataForInitialClient(
options.initial_client_data, exception_handler.get()); options.initial_client_data, exception_handler.get());
} }
#elif defined(OS_LINUX) || defined(OS_ANDROID) #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
if (options.initial_client_fd == kInvalidFileHandle || if (options.initial_client_fd == kInvalidFileHandle ||
!exception_handler_server.InitializeWithClient( !exception_handler_server.InitializeWithClient(
ScopedFileHandle(options.initial_client_fd), ScopedFileHandle(options.initial_client_fd),

View File

@ -103,7 +103,7 @@ std::string MinidumpMiscInfoDebugBuildString() {
static constexpr char kOS[] = "mac"; static constexpr char kOS[] = "mac";
#elif defined(OS_ANDROID) #elif defined(OS_ANDROID)
static constexpr char kOS[] = "android"; static constexpr char kOS[] = "android";
#elif defined(OS_LINUX) #elif defined(OS_LINUX) || defined(OS_CHROMEOS)
static constexpr char kOS[] = "linux"; static constexpr char kOS[] = "linux";
#elif defined(OS_WIN) #elif defined(OS_WIN)
static constexpr char kOS[] = "win"; static constexpr char kOS[] = "win";

View File

@ -22,7 +22,7 @@
#if defined(OS_WIN) #if defined(OS_WIN)
#include "util/win/traits.h" #include "util/win/traits.h"
#elif defined(OS_LINUX) || defined(OS_ANDROID) #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
#include "util/linux/traits.h" #include "util/linux/traits.h"
#elif defined(OS_FUCHSIA) #elif defined(OS_FUCHSIA)
#include "util/fuchsia/traits.h" #include "util/fuchsia/traits.h"

View File

@ -35,7 +35,7 @@
#include "base/fuchsia/fuchsia_logging.h" #include "base/fuchsia/fuchsia_logging.h"
#elif defined(OS_LINUX) || defined(OS_ANDROID) #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
#include "test/linux/fake_ptrace_connection.h" #include "test/linux/fake_ptrace_connection.h"
#include "util/linux/auxiliary_vector.h" #include "util/linux/auxiliary_vector.h"
@ -84,7 +84,7 @@ void LocateExecutable(const ProcessType& process,
*elf_address = base; *elf_address = base;
} }
#elif defined(OS_LINUX) || defined(OS_ANDROID) #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
void LocateExecutable(PtraceConnection* connection, void LocateExecutable(PtraceConnection* connection,
ProcessMemory* memory, ProcessMemory* memory,
@ -133,7 +133,7 @@ void ReadThisExecutableInTarget(ProcessType process,
ASSERT_TRUE(range.Initialize(&memory, am_64_bit)); ASSERT_TRUE(range.Initialize(&memory, am_64_bit));
VMAddress elf_address; VMAddress elf_address;
#if defined(OS_LINUX) || defined(OS_ANDROID) #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
FakePtraceConnection connection; FakePtraceConnection connection;
ASSERT_TRUE(connection.Initialize(process)); ASSERT_TRUE(connection.Initialize(process));
LocateExecutable(&connection, &memory, &elf_address); LocateExecutable(&connection, &memory, &elf_address);

View File

@ -26,7 +26,7 @@
#include "util/misc/address_sanitizer.h" #include "util/misc/address_sanitizer.h"
#include "util/numeric/safe_assignment.h" #include "util/numeric/safe_assignment.h"
#if defined(OS_LINUX) || defined(OS_ANDROID) #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
#include <sys/syscall.h> #include <sys/syscall.h>
#include "snapshot/linux/process_snapshot_linux.h" #include "snapshot/linux/process_snapshot_linux.h"

View File

@ -26,7 +26,7 @@
#include "util/misc/scoped_forbid_return.h" #include "util/misc/scoped_forbid_return.h"
#include "util/posix/close_multiple.h" #include "util/posix/close_multiple.h"
#if defined(OS_LINUX) #if defined(OS_LINUX) || defined(OS_CHROMEOS)
#include <stdio_ext.h> #include <stdio_ext.h>
#endif #endif
@ -90,7 +90,7 @@ void MultiprocessExec::MultiprocessChild() {
int rv; int rv;
#if defined(OS_LINUX) #if defined(OS_LINUX) || defined(OS_CHROMEOS)
__fpurge(stdin); __fpurge(stdin);
#else #else
rv = fpurge(stdin); rv = fpurge(stdin);

View File

@ -143,7 +143,7 @@ void Multiprocess::Run() {
if (exception_swallower.get()) { if (exception_swallower.get()) {
ExceptionSwallower::SwallowExceptions(); ExceptionSwallower::SwallowExceptions();
} }
#elif defined(OS_LINUX) || defined(OS_ANDROID) #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
if (reason_ == kTerminationSignal && Signals::IsCrashSignal(code_)) { if (reason_ == kTerminationSignal && Signals::IsCrashSignal(code_)) {
Signals::InstallDefaultHandler(code_); Signals::InstallDefaultHandler(code_);
} }

View File

@ -16,7 +16,7 @@
#if defined(OS_FUCHSIA) #if defined(OS_FUCHSIA)
#include <lib/zx/process.h> #include <lib/zx/process.h>
#elif defined(OS_LINUX) || defined(OS_ANDROID) #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
#include <unistd.h> #include <unistd.h>
#endif #endif
@ -26,7 +26,7 @@ namespace test {
ProcessType GetSelfProcess() { ProcessType GetSelfProcess() {
#if defined(OS_FUCHSIA) #if defined(OS_FUCHSIA)
return zx::process::self(); return zx::process::self();
#elif defined(OS_LINUX) || defined(OS_ANDROID) #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
return getpid(); return getpid();
#elif defined(OS_WIN) #elif defined(OS_WIN)
return GetCurrentProcess(); return GetCurrentProcess();

View File

@ -19,7 +19,7 @@
#if defined(OS_FUCHSIA) #if defined(OS_FUCHSIA)
#include <lib/zx/process.h> #include <lib/zx/process.h>
#elif defined(OS_LINUX) || defined(OS_ANDROID) #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
#include <sys/types.h> #include <sys/types.h>
#elif defined(OS_WIN) #elif defined(OS_WIN)
#include <windows.h> #include <windows.h>
@ -32,7 +32,8 @@ namespace test {
#if defined(OS_FUCHSIA) #if defined(OS_FUCHSIA)
using ProcessType = zx::unowned_process; using ProcessType = zx::unowned_process;
#elif defined(OS_LINUX) || defined(OS_ANDROID) || DOXYGEN #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \
DOXYGEN
//! \brief Alias for platform-specific type to represent a process. //! \brief Alias for platform-specific type to represent a process.
using ProcessType = pid_t; using ProcessType = pid_t;
#elif defined(OS_WIN) #elif defined(OS_WIN)

View File

@ -47,7 +47,7 @@
#include "snapshot/win/process_snapshot_win.h" #include "snapshot/win/process_snapshot_win.h"
#include "util/win/scoped_process_suspend.h" #include "util/win/scoped_process_suspend.h"
#include "util/win/xp_compat.h" #include "util/win/xp_compat.h"
#elif defined(OS_LINUX) || defined(OS_ANDROID) #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
#include "snapshot/linux/process_snapshot_linux.h" #include "snapshot/linux/process_snapshot_linux.h"
#endif // OS_APPLE #endif // OS_APPLE
@ -196,7 +196,7 @@ int GenerateDumpMain(int argc, char* argv[]) {
0)) { 0)) {
return EXIT_FAILURE; return EXIT_FAILURE;
} }
#elif defined(OS_LINUX) || defined(OS_ANDROID) #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
// TODO(jperaza): https://crashpad.chromium.org/bug/30. // TODO(jperaza): https://crashpad.chromium.org/bug/30.
ProcessSnapshotLinux process_snapshot; ProcessSnapshotLinux process_snapshot;
if (!process_snapshot.Initialize(nullptr)) { if (!process_snapshot.Initialize(nullptr)) {

View File

@ -398,7 +398,7 @@ FileHandle LoggingOpenFileForWrite(const base::FilePath& path,
FileWriteMode mode, FileWriteMode mode,
FilePermissions permissions); FilePermissions permissions);
#if defined(OS_LINUX) #if defined(OS_LINUX) || defined(OS_CHROMEOS)
//! \brief Opens an in-memory file for input and output. //! \brief Opens an in-memory file for input and output.
//! //!
//! This function first attempts to open the file with `memfd_create()`. If //! This function first attempts to open the file with `memfd_create()`. If
@ -420,7 +420,7 @@ FileHandle LoggingOpenFileForWrite(const base::FilePath& path,
//! \sa LoggingOpenFileForWrite //! \sa LoggingOpenFileForWrite
//! \sa LoggingOpenFileForReadAndWrite //! \sa LoggingOpenFileForReadAndWrite
FileHandle LoggingOpenMemoryFileForReadAndWrite(const base::FilePath& name); FileHandle LoggingOpenMemoryFileForReadAndWrite(const base::FilePath& name);
#endif // OS_LINUX #endif // OS_LINUX || OS_CHROMEOS
//! \brief Wraps OpenFileForReadAndWrite(), logging an error if the operation //! \brief Wraps OpenFileForReadAndWrite(), logging an error if the operation
//! fails. //! fails.

View File

@ -153,7 +153,7 @@ FileHandle LoggingOpenFileForWrite(const base::FilePath& path,
return fd; return fd;
} }
#if defined(OS_LINUX) #if defined(OS_LINUX) || defined(OS_CHROMEOS)
FileHandle LoggingOpenMemoryFileForReadAndWrite(const base::FilePath& name) { FileHandle LoggingOpenMemoryFileForReadAndWrite(const base::FilePath& name) {
DCHECK(name.value().find('/') == std::string::npos); DCHECK(name.value().find('/') == std::string::npos);

View File

@ -473,7 +473,7 @@ TEST(FileIO, LoggingOpenFileForReadAndWrite) {
TestOpenFileForWrite(LoggingOpenFileForReadAndWrite); TestOpenFileForWrite(LoggingOpenFileForReadAndWrite);
} }
#if defined(OS_LINUX) #if defined(OS_LINUX) || defined(OS_CHROMEOS)
TEST(FileIO, LoggingOpenMemoryFileForReadAndWrite) { TEST(FileIO, LoggingOpenMemoryFileForReadAndWrite) {
ScopedFileHandle handle( ScopedFileHandle handle(
LoggingOpenMemoryFileForReadAndWrite(base::FilePath("memfile"))); LoggingOpenMemoryFileForReadAndWrite(base::FilePath("memfile")));
@ -488,7 +488,7 @@ TEST(FileIO, LoggingOpenMemoryFileForReadAndWrite) {
ASSERT_TRUE(LoggingReadFileExactly(handle.get(), buffer, sizeof(buffer))); ASSERT_TRUE(LoggingReadFileExactly(handle.get(), buffer, sizeof(buffer)));
EXPECT_EQ(memcmp(buffer, kTestData, sizeof(buffer)), 0); EXPECT_EQ(memcmp(buffer, kTestData, sizeof(buffer)), 0);
} }
#endif // OS_LINUX #endif // OS_LINUX || OS_CHROMEOS
enum class ReadOrWrite : bool { enum class ReadOrWrite : bool {
kRead, kRead,

View File

@ -171,7 +171,7 @@ bool FileWriter::Open(const base::FilePath& path,
return true; return true;
} }
#if defined(OS_LINUX) #if defined(OS_LINUX) || defined(OS_CHROMEOS)
bool FileWriter::OpenMemfd(const base::FilePath& path) { bool FileWriter::OpenMemfd(const base::FilePath& path) {
CHECK(!file_.is_valid()); CHECK(!file_.is_valid());
file_.reset(LoggingOpenMemoryFileForReadAndWrite(path)); file_.reset(LoggingOpenMemoryFileForReadAndWrite(path));

View File

@ -131,7 +131,7 @@ class FileWriter : public FileWriterInterface {
FileWriteMode write_mode, FileWriteMode write_mode,
FilePermissions permissions); FilePermissions permissions);
#if defined(OS_LINUX) #if defined(OS_LINUX) || defined(OS_CHROMEOS)
//! \brief Wraps LoggingOpenMemoryFileForWrite(). //! \brief Wraps LoggingOpenMemoryFileForWrite().
//! //!
//! \return `true` if the operation succeeded, `false` if it failed, with an //! \return `true` if the operation succeeded, `false` if it failed, with an

View File

@ -19,9 +19,9 @@ namespace crashpad {
ExceptionHandlerProtocol::ClientInformation::ClientInformation() ExceptionHandlerProtocol::ClientInformation::ClientInformation()
: exception_information_address(0), : exception_information_address(0),
sanitization_information_address(0) sanitization_information_address(0)
#if defined(OS_LINUX) #if defined(OS_LINUX) || defined(OS_CHROMEOS)
, crash_loop_before_time(0) , crash_loop_before_time(0)
#endif // OS_LINUX #endif // OS_LINUX || OS_CHROMEOS
{} {}
ExceptionHandlerProtocol::ClientToServerMessage::ClientToServerMessage() ExceptionHandlerProtocol::ClientToServerMessage::ClientToServerMessage()

View File

@ -52,7 +52,7 @@ class ExceptionHandlerProtocol {
//! SanitizationInformation struct, or 0 if there is no such struct. //! SanitizationInformation struct, or 0 if there is no such struct.
VMAddress sanitization_information_address; VMAddress sanitization_information_address;
#if defined(OS_LINUX) #if defined(OS_LINUX) || defined(OS_CHROMEOS)
//! \brief Indicates that the client is likely in a crash loop if a crash //! \brief Indicates that the client is likely in a crash loop if a crash
//! occurs before this timestamp. This value is only used by ChromeOS's //! occurs before this timestamp. This value is only used by ChromeOS's
//! `/sbin/crash_reporter`. //! `/sbin/crash_reporter`.

View File

@ -25,7 +25,7 @@
#include <mach/mach_types.h> #include <mach/mach_types.h>
#elif defined(OS_WIN) #elif defined(OS_WIN)
#include "util/win/address_types.h" #include "util/win/address_types.h"
#elif defined(OS_LINUX) || defined(OS_ANDROID) #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
#include "util/linux/address_types.h" #include "util/linux/address_types.h"
#elif defined(OS_FUCHSIA) #elif defined(OS_FUCHSIA)
#include <zircon/types.h> #include <zircon/types.h>
@ -55,7 +55,7 @@ using VMSize = mach_vm_size_t;
using VMAddress = WinVMAddress; using VMAddress = WinVMAddress;
using VMSize = WinVMSize; using VMSize = WinVMSize;
#elif defined(OS_LINUX) || defined(OS_ANDROID) #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
using VMAddress = LinuxVMAddress; using VMAddress = LinuxVMAddress;
using VMSize = LinuxVMSize; using VMSize = LinuxVMSize;

View File

@ -21,7 +21,7 @@
#include <mach/mach.h> #include <mach/mach.h>
#elif defined(OS_WIN) #elif defined(OS_WIN)
#include <windows.h> #include <windows.h>
#elif defined(OS_LINUX) || defined(OS_ANDROID) #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
#include <ucontext.h> #include <ucontext.h>
#elif defined(OS_FUCHSIA) #elif defined(OS_FUCHSIA)
#include <signal.h> #include <signal.h>
@ -37,7 +37,8 @@ using NativeCPUContext = arm_unified_thread_state;
#endif #endif
#elif defined(OS_WIN) #elif defined(OS_WIN)
using NativeCPUContext = CONTEXT; using NativeCPUContext = CONTEXT;
#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FUCHSIA) #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \
defined(OS_FUCHSIA)
using NativeCPUContext = ucontext_t; using NativeCPUContext = ucontext_t;
#endif // OS_APPLE #endif // OS_APPLE

View File

@ -25,7 +25,7 @@
#define METRICS_OS_NAME "Win" #define METRICS_OS_NAME "Win"
#elif defined(OS_ANDROID) #elif defined(OS_ANDROID)
#define METRICS_OS_NAME "Android" #define METRICS_OS_NAME "Android"
#elif defined(OS_LINUX) #elif defined(OS_LINUX) || defined(OS_CHROMEOS)
#define METRICS_OS_NAME "Linux" #define METRICS_OS_NAME "Linux"
#elif defined(OS_FUCHSIA) #elif defined(OS_FUCHSIA)
#define METRICS_OS_NAME "Fuchsia" #define METRICS_OS_NAME "Fuchsia"

View File

@ -69,13 +69,13 @@ void GetTimeOfDay(timeval* tv);
#endif // OS_WIN #endif // OS_WIN
#if defined(OS_LINUX) || defined(OS_ANDROID) || DOXYGEN #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || DOXYGEN
//! \brief Get the kernel boot time. Subsequent calls to this function may //! \brief Get the kernel boot time. Subsequent calls to this function may
//! return different results due to the system clock being changed or //! return different results due to the system clock being changed or
//! imprecision in measuring the boot time. //! imprecision in measuring the boot time.
//! \return `true` on success. Otherwise, `false` with a message logged. //! \return `true` on success. Otherwise, `false` with a message logged.
bool GetBootTime(timespec* ts); bool GetBootTime(timespec* ts);
#endif // OS_LINUX || OS_ANDROID || DOXYGEN #endif // OS_LINUX || OS_CHROMEOS || OS_ANDROID || DOXYGEN
} // namespace crashpad } // namespace crashpad

View File

@ -93,8 +93,8 @@ bool UUID::InitializeWithNew() {
uuid_generate(uuid); uuid_generate(uuid);
InitializeFromBytes(uuid); InitializeFromBytes(uuid);
return true; return true;
#elif defined(OS_WIN) || defined(OS_LINUX) || defined(OS_ANDROID) || \ #elif defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \
defined(OS_FUCHSIA) defined(OS_ANDROID) || defined(OS_FUCHSIA)
// Linux, Android, and Fuchsia do not provide a UUID generator in a // Linux, Android, and Fuchsia do not provide a UUID generator in a
// widely-available system library. On Linux and Android, uuid_generate() // widely-available system library. On Linux and Android, uuid_generate()
// from libuuid is not available everywhere. // from libuuid is not available everywhere.

View File

@ -123,7 +123,7 @@ class SSLStream : public Stream {
return false; return false;
} }
} else { } else {
#if defined(OS_LINUX) #if defined(OS_LINUX) || defined(OS_CHROMEOS)
if (SSL_CTX_load_verify_locations( if (SSL_CTX_load_verify_locations(
ctx_.get(), nullptr, "/etc/ssl/certs") <= 0) { ctx_.get(), nullptr, "/etc/ssl/certs") <= 0) {
LOG(ERROR) << "SSL_CTX_load_verify_locations"; LOG(ERROR) << "SSL_CTX_load_verify_locations";

View File

@ -22,7 +22,7 @@
#include <mach/mach.h> #include <mach/mach.h>
#elif defined(OS_WIN) #elif defined(OS_WIN)
#include "util/win/address_types.h" #include "util/win/address_types.h"
#elif defined(OS_LINUX) || defined(OS_ANDROID) #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
#include "util/linux/address_types.h" #include "util/linux/address_types.h"
#elif defined(OS_FUCHSIA) #elif defined(OS_FUCHSIA)
#include <zircon/types.h> #include <zircon/types.h>
@ -130,7 +130,7 @@ std::string CheckedAddressRangeGeneric<ValueType, SizeType>::AsString() const {
template class CheckedAddressRangeGeneric<mach_vm_address_t, mach_vm_size_t>; template class CheckedAddressRangeGeneric<mach_vm_address_t, mach_vm_size_t>;
#elif defined(OS_WIN) #elif defined(OS_WIN)
template class CheckedAddressRangeGeneric<WinVMAddress, WinVMSize>; template class CheckedAddressRangeGeneric<WinVMAddress, WinVMSize>;
#elif defined(OS_LINUX) || defined(OS_ANDROID) #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
template class CheckedAddressRangeGeneric<LinuxVMAddress, LinuxVMSize>; template class CheckedAddressRangeGeneric<LinuxVMAddress, LinuxVMSize>;
#elif defined(OS_FUCHSIA) #elif defined(OS_FUCHSIA)
template class CheckedAddressRangeGeneric<zx_vaddr_t, size_t>; template class CheckedAddressRangeGeneric<zx_vaddr_t, size_t>;

View File

@ -74,7 +74,7 @@ void CloseNowOrOnExec(int fd, bool ebadf_ok) {
bool CloseMultipleNowOrOnExecUsingFDDir(int min_fd, int preserve_fd) { bool CloseMultipleNowOrOnExecUsingFDDir(int min_fd, int preserve_fd) {
#if defined(OS_APPLE) #if defined(OS_APPLE)
static constexpr char kFDDir[] = "/dev/fd"; static constexpr char kFDDir[] = "/dev/fd";
#elif defined(OS_LINUX) || defined(OS_ANDROID) #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
static constexpr char kFDDir[] = "/proc/self/fd"; static constexpr char kFDDir[] = "/proc/self/fd";
#endif #endif
@ -135,7 +135,8 @@ void CloseMultipleNowOrOnExec(int fd, int preserve_fd) {
max_fd = std::max(max_fd, getdtablesize()); max_fd = std::max(max_fd, getdtablesize());
#endif #endif
#if !(defined(OS_LINUX) || defined(OS_ANDROID)) || defined(OPEN_MAX) #if !(defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)) || \
defined(OPEN_MAX)
// Linux does not provide OPEN_MAX. See // Linux does not provide OPEN_MAX. See
// https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/include/linux/limits.h?id=77293034696e3e0b6c8b8fc1f96be091104b3d2b. // https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/include/linux/limits.h?id=77293034696e3e0b6c8b8fc1f96be091104b3d2b.
max_fd = std::max(max_fd, OPEN_MAX); max_fd = std::max(max_fd, OPEN_MAX);
@ -162,7 +163,7 @@ void CloseMultipleNowOrOnExec(int fd, int preserve_fd) {
} else { } else {
PLOG(WARNING) << "sysctl"; PLOG(WARNING) << "sysctl";
} }
#elif defined(OS_LINUX) || defined(OS_ANDROID) #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
// See linux-4.4.27/fs/file.c sysctl_nr_open, referenced by kernel/sys.c // See linux-4.4.27/fs/file.c sysctl_nr_open, referenced by kernel/sys.c
// do_prlimit() and kernel/sysctl.c fs_table. Inability to open this file is // do_prlimit() and kernel/sysctl.c fs_table. Inability to open this file is
// not considered an error, because /proc may not be available or usable. // not considered an error, because /proc may not be available or usable.

View File

@ -73,7 +73,7 @@ void DropPrivileges() {
CHECK_EQ(setegid(egid), -1); CHECK_EQ(setegid(egid), -1);
} }
} }
#elif defined(OS_LINUX) || defined(OS_ANDROID) #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
PCHECK(setresgid(gid, gid, gid) == 0) << "setresgid"; PCHECK(setresgid(gid, gid, gid) == 0) << "setresgid";
PCHECK(setresuid(uid, uid, uid) == 0) << "setresuid"; PCHECK(setresuid(uid, uid, uid) == 0) << "setresuid";

View File

@ -33,7 +33,7 @@
#include <sys/sysctl.h> #include <sys/sysctl.h>
#endif #endif
#if defined(OS_LINUX) || defined(OS_ANDROID) #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
#include "util/linux/ptrace_connection.h" #include "util/linux/ptrace_connection.h"
#endif #endif
@ -44,7 +44,7 @@ class ProcessInfo {
ProcessInfo(); ProcessInfo();
~ProcessInfo(); ~ProcessInfo();
#if defined(OS_LINUX) || defined(OS_ANDROID) || DOXYGEN #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || DOXYGEN
//! \brief Initializes this object with information about the process whose ID //! \brief Initializes this object with information about the process whose ID
//! is \a pid using a PtraceConnection \a connection. //! is \a pid using a PtraceConnection \a connection.
//! //!
@ -59,7 +59,7 @@ class ProcessInfo {
//! //!
//! \return `true` on success, `false` on failure with a message logged. //! \return `true` on success, `false` on failure with a message logged.
bool InitializeWithPtrace(PtraceConnection* connection); bool InitializeWithPtrace(PtraceConnection* connection);
#endif // OS_LINUX || OS_ANDROID || DOXYGEN #endif // OS_LINUX || OS_CHROMEOS || OS_ANDROID || DOXYGEN
#if defined(OS_APPLE) || DOXYGEN #if defined(OS_APPLE) || DOXYGEN
//! \brief Initializes this object with information about the process whose ID //! \brief Initializes this object with information about the process whose ID
@ -168,7 +168,7 @@ class ProcessInfo {
private: private:
#if defined(OS_APPLE) #if defined(OS_APPLE)
kinfo_proc kern_proc_info_; kinfo_proc kern_proc_info_;
#elif defined(OS_LINUX) || defined(OS_ANDROID) #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
// Some members are marked mutable so that they can be lazily initialized by // Some members are marked mutable so that they can be lazily initialized by
// const methods. These are always InitializationState-protected so that // const methods. These are always InitializationState-protected so that
// multiple successive calls will always produce the same return value and out // multiple successive calls will always produce the same return value and out

View File

@ -33,7 +33,7 @@
#include "util/misc/implicit_cast.h" #include "util/misc/implicit_cast.h"
#include "util/string/split_string.h" #include "util/string/split_string.h"
#if defined(OS_LINUX) || defined(OS_ANDROID) #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
#include "util/linux/direct_ptrace_connection.h" #include "util/linux/direct_ptrace_connection.h"
#include "test/linux/fake_ptrace_connection.h" #include "test/linux/fake_ptrace_connection.h"
#endif #endif
@ -98,7 +98,7 @@ void TestProcessSelfOrClone(const ProcessInfo& process_info) {
const std::vector<std::string>& expect_argv = GetMainArguments(); const std::vector<std::string>& expect_argv = GetMainArguments();
#if defined(OS_ANDROID) || defined(OS_LINUX) #if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS)
// Prior to Linux 4.2, the kernel only allowed reading a single page from // Prior to Linux 4.2, the kernel only allowed reading a single page from
// /proc/<pid>/cmdline, causing any further arguments to be truncated. Disable // /proc/<pid>/cmdline, causing any further arguments to be truncated. Disable
// testing arguments in this case. // testing arguments in this case.
@ -124,7 +124,7 @@ void TestProcessSelfOrClone(const ProcessInfo& process_info) {
argv_size > static_cast<size_t>(getpagesize())) { argv_size > static_cast<size_t>(getpagesize())) {
return; return;
} }
#endif // OS_ANDROID || OS_LINUX #endif // OS_ANDROID || OS_LINUX || OS_CHROMEOS
std::vector<std::string> argv; std::vector<std::string> argv;
ASSERT_TRUE(process_info.Arguments(&argv)); ASSERT_TRUE(process_info.Arguments(&argv));
@ -161,13 +161,13 @@ void TestSelfProcess(const ProcessInfo& process_info) {
TEST(ProcessInfo, Self) { TEST(ProcessInfo, Self) {
ProcessInfo process_info; ProcessInfo process_info;
#if defined(OS_LINUX) || defined(OS_ANDROID) #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
FakePtraceConnection connection; FakePtraceConnection connection;
ASSERT_TRUE(connection.Initialize(getpid())); ASSERT_TRUE(connection.Initialize(getpid()));
ASSERT_TRUE(process_info.InitializeWithPtrace(&connection)); ASSERT_TRUE(process_info.InitializeWithPtrace(&connection));
#else #else
ASSERT_TRUE(process_info.InitializeWithPid(getpid())); ASSERT_TRUE(process_info.InitializeWithPid(getpid()));
#endif // OS_LINUX || OS_ANDROID #endif // OS_LINUX || OS_ANDROID || OS_CHROMEOS
TestSelfProcess(process_info); TestSelfProcess(process_info);
} }
@ -184,7 +184,7 @@ TEST(ProcessInfo, Pid1) {
// PID 1 is expected to be init or the systems equivalent. This tests reading // PID 1 is expected to be init or the systems equivalent. This tests reading
// information about another process. // information about another process.
ProcessInfo process_info; ProcessInfo process_info;
#if defined(OS_LINUX) || defined(OS_ANDROID) #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
FakePtraceConnection connection; FakePtraceConnection connection;
ASSERT_TRUE(connection.Initialize(1)); ASSERT_TRUE(connection.Initialize(1));
ASSERT_TRUE(process_info.InitializeWithPtrace(&connection)); ASSERT_TRUE(process_info.InitializeWithPtrace(&connection));
@ -212,7 +212,7 @@ class ProcessInfoForkedTest : public Multiprocess {
void MultiprocessParent() override { void MultiprocessParent() override {
const pid_t pid = ChildPID(); const pid_t pid = ChildPID();
#if defined(OS_LINUX) || defined(OS_ANDROID) #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
DirectPtraceConnection connection; DirectPtraceConnection connection;
ASSERT_TRUE(connection.Initialize(pid)); ASSERT_TRUE(connection.Initialize(pid));
@ -221,7 +221,7 @@ class ProcessInfoForkedTest : public Multiprocess {
#else #else
ProcessInfo process_info; ProcessInfo process_info;
ASSERT_TRUE(process_info.InitializeWithPid(pid)); ASSERT_TRUE(process_info.InitializeWithPid(pid));
#endif // OS_LINUX || OS_ANDROID #endif // OS_LINUX || OS_CHROMEOS || OS_ANDROID
EXPECT_EQ(process_info.ProcessID(), pid); EXPECT_EQ(process_info.ProcessID(), pid);
EXPECT_EQ(process_info.ParentProcessID(), getpid()); EXPECT_EQ(process_info.ParentProcessID(), getpid());

View File

@ -46,10 +46,10 @@ constexpr int kCrashSignals[] = {
#if defined(SIGEMT) #if defined(SIGEMT)
SIGEMT, SIGEMT,
#endif // defined(SIGEMT) #endif // defined(SIGEMT)
#if defined(OS_LINUX) #if defined(OS_LINUX) || defined(OS_CHROMEOS)
SIGXCPU, SIGXCPU,
SIGXFSZ, SIGXFSZ,
#endif // defined(OS_LINUX) #endif // defined(OS_LINUX) || defined(OS_CHROMEOS)
}; };
// These are the non-core-generating but terminating signals. // These are the non-core-generating but terminating signals.
@ -86,9 +86,9 @@ constexpr int kTerminateSignals[] = {
SIGXCPU, SIGXCPU,
SIGXFSZ, SIGXFSZ,
#endif // defined(OS_APPLE) #endif // defined(OS_APPLE)
#if defined(OS_LINUX) #if defined(OS_LINUX) || defined(OS_CHROMEOS)
SIGIO, SIGIO,
#endif // defined(OS_LINUX) #endif // defined(OS_LINUX) || defined(OS_CHROMEOS)
}; };
bool InstallHandlers(const std::vector<int>& signals, bool InstallHandlers(const std::vector<int>& signals,

View File

@ -64,7 +64,7 @@ constexpr const char* kSignalNames[] = {
"INFO", "INFO",
"USR1", "USR1",
"USR2", "USR2",
#elif defined(OS_LINUX) || defined(OS_ANDROID) #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
#if defined(ARCH_CPU_MIPS_FAMILY) #if defined(ARCH_CPU_MIPS_FAMILY)
"HUP", "HUP",
"INT", "INT",
@ -135,7 +135,7 @@ constexpr const char* kSignalNames[] = {
#endif // defined(ARCH_CPU_MIPS_FAMILY) #endif // defined(ARCH_CPU_MIPS_FAMILY)
#endif #endif
}; };
#if defined(OS_LINUX) || defined(OS_ANDROID) #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
// NSIG is 64 to account for real-time signals. // NSIG is 64 to account for real-time signals.
static_assert(base::size(kSignalNames) == 32, "kSignalNames length"); static_assert(base::size(kSignalNames) == 32, "kSignalNames length");
#else #else

View File

@ -66,7 +66,7 @@ constexpr struct {
#if defined(OS_APPLE) #if defined(OS_APPLE)
{SIGEMT, "SIGEMT", "EMT"}, {SIGEMT, "SIGEMT", "EMT"},
{SIGINFO, "SIGINFO", "INFO"}, {SIGINFO, "SIGINFO", "INFO"},
#elif defined(OS_LINUX) || defined(OS_ANDROID) #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
{SIGPWR, "SIGPWR", "PWR"}, {SIGPWR, "SIGPWR", "PWR"},
#if !defined(ARCH_CPU_MIPS_FAMILY) #if !defined(ARCH_CPU_MIPS_FAMILY)
{SIGSTKFLT, "SIGSTKFLT", "STKFLT"}, {SIGSTKFLT, "SIGSTKFLT", "STKFLT"},
@ -123,7 +123,7 @@ TEST(SymbolicConstantsPOSIX, SignalToString) {
kSignalTestData[index].short_name); kSignalTestData[index].short_name);
} }
#if defined(OS_LINUX) || defined(OS_ANDROID) #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
// NSIG is 64 to account for real-time signals. // NSIG is 64 to account for real-time signals.
constexpr int kSignalCount = 32; constexpr int kSignalCount = 32;
#else #else

View File

@ -16,7 +16,7 @@
#if defined(OS_FUCHSIA) #if defined(OS_FUCHSIA)
#include "util/process/process_memory_fuchsia.h" #include "util/process/process_memory_fuchsia.h"
#elif defined(OS_LINUX) || defined(OS_ANDROID) #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
#include "util/process/process_memory_linux.h" #include "util/process/process_memory_linux.h"
#elif defined(OS_WIN) #elif defined(OS_WIN)
#include "util/process/process_memory_win.h" #include "util/process/process_memory_win.h"
@ -29,7 +29,7 @@ namespace crashpad {
#if defined(OS_FUCHSIA) || DOXYGEN #if defined(OS_FUCHSIA) || DOXYGEN
//! \brief Alias for platform-specific native implementation of ProcessMemory. //! \brief Alias for platform-specific native implementation of ProcessMemory.
using ProcessMemoryNative = ProcessMemoryFuchsia; using ProcessMemoryNative = ProcessMemoryFuchsia;
#elif defined(OS_LINUX) || defined(OS_ANDROID) #elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
using ProcessMemoryNative = ProcessMemoryLinux; using ProcessMemoryNative = ProcessMemoryLinux;
#elif defined(OS_WIN) #elif defined(OS_WIN)
using ProcessMemoryNative = ProcessMemoryWin; using ProcessMemoryNative = ProcessMemoryWin;