Re-add third-party/abseil-cpp
Bug: 261600888 Test: no build files yet Change-Id: If35de46c822c629640fa888126290b98ee4dc41d
This commit is contained in:
@ -42,7 +42,6 @@
|
||||
#include <ctime>
|
||||
|
||||
#include "absl/base/attributes.h"
|
||||
#include "absl/base/internal/errno_saver.h"
|
||||
#include "absl/base/internal/raw_logging.h"
|
||||
#include "absl/base/internal/sysinfo.h"
|
||||
#include "absl/debugging/internal/examine_stack.h"
|
||||
@ -51,8 +50,10 @@
|
||||
#ifndef _WIN32
|
||||
#define ABSL_HAVE_SIGACTION
|
||||
// Apple WatchOS and TVOS don't allow sigaltstack
|
||||
#if !(defined(TARGET_OS_WATCH) && TARGET_OS_WATCH) && \
|
||||
!(defined(TARGET_OS_TV) && TARGET_OS_TV)
|
||||
// Apple macOS has sigaltstack, but using it makes backtrace() unusable.
|
||||
#if !(defined(TARGET_OS_OSX) && TARGET_OS_OSX) && \
|
||||
!(defined(TARGET_OS_WATCH) && TARGET_OS_WATCH) && \
|
||||
!(defined(TARGET_OS_TV) && TARGET_OS_TV) && !defined(__QNX__)
|
||||
#define ABSL_HAVE_SIGALTSTACK
|
||||
#endif
|
||||
#endif
|
||||
@ -134,10 +135,11 @@ static bool SetupAlternateStackOnce() {
|
||||
#if defined(__wasm__) || defined (__asjms__)
|
||||
const size_t page_mask = getpagesize() - 1;
|
||||
#else
|
||||
const size_t page_mask = sysconf(_SC_PAGESIZE) - 1;
|
||||
const size_t page_mask = static_cast<size_t>(sysconf(_SC_PAGESIZE)) - 1;
|
||||
#endif
|
||||
size_t stack_size =
|
||||
(std::max<size_t>(SIGSTKSZ, 65536) + page_mask) & ~page_mask;
|
||||
(std::max(static_cast<size_t>(SIGSTKSZ), size_t{65536}) + page_mask) &
|
||||
~page_mask;
|
||||
#if defined(ABSL_HAVE_ADDRESS_SANITIZER) || \
|
||||
defined(ABSL_HAVE_MEMORY_SANITIZER) || defined(ABSL_HAVE_THREAD_SANITIZER)
|
||||
// Account for sanitizer instrumentation requiring additional stack space.
|
||||
@ -217,8 +219,7 @@ static void InstallOneFailureHandler(FailureSignalData* data,
|
||||
#endif
|
||||
|
||||
static void WriteToStderr(const char* data) {
|
||||
absl::base_internal::ErrnoSaver errno_saver;
|
||||
absl::raw_logging_internal::SafeWriteToStderr(data, strlen(data));
|
||||
absl::raw_log_internal::AsyncSignalSafeWriteToStderr(data, strlen(data));
|
||||
}
|
||||
|
||||
static void WriteSignalMessage(int signo, int cpu,
|
||||
@ -291,7 +292,7 @@ static void WriteFailureInfo(int signo, void* ucontext, int cpu,
|
||||
// some platforms.
|
||||
static void PortableSleepForSeconds(int seconds) {
|
||||
#ifdef _WIN32
|
||||
Sleep(seconds * 1000);
|
||||
Sleep(static_cast<DWORD>(seconds * 1000));
|
||||
#else
|
||||
struct timespec sleep_time;
|
||||
sleep_time.tv_sec = seconds;
|
||||
@ -325,9 +326,9 @@ static void AbslFailureSignalHandler(int signo, siginfo_t*, void* ucontext) {
|
||||
|
||||
const GetTidType this_tid = absl::base_internal::GetTID();
|
||||
GetTidType previous_failed_tid = 0;
|
||||
if (!failed_tid.compare_exchange_strong(
|
||||
previous_failed_tid, static_cast<intptr_t>(this_tid),
|
||||
std::memory_order_acq_rel, std::memory_order_relaxed)) {
|
||||
if (!failed_tid.compare_exchange_strong(previous_failed_tid, this_tid,
|
||||
std::memory_order_acq_rel,
|
||||
std::memory_order_relaxed)) {
|
||||
ABSL_RAW_LOG(
|
||||
ERROR,
|
||||
"Signal %d raised at PC=%p while already in AbslFailureSignalHandler()",
|
||||
@ -356,7 +357,7 @@ static void AbslFailureSignalHandler(int signo, siginfo_t*, void* ucontext) {
|
||||
if (fsh_options.alarm_on_failure_secs > 0) {
|
||||
alarm(0); // Cancel any existing alarms.
|
||||
signal(SIGALRM, ImmediateAbortSignalHandler);
|
||||
alarm(fsh_options.alarm_on_failure_secs);
|
||||
alarm(static_cast<unsigned int>(fsh_options.alarm_on_failure_secs));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user