Commit 04e0dcae by Abseil Team Committed by Copybara-Service

Rename AsyncSignalSafeWriteToStderr to AsyncSignalSafeWriteError.

It no longer strictly writes to stderr, since Emscripten/WebAssembly now use _emscripten_err which might be replaced by something that is not the same as stderr by the host.

PiperOrigin-RevId: 540655336
Change-Id: Icc2a430a0db53a1282ef5558e9f3648db67e972c
parent 5922d129
...@@ -177,7 +177,7 @@ void RawLogVA(absl::LogSeverity severity, const char* file, int line, ...@@ -177,7 +177,7 @@ void RawLogVA(absl::LogSeverity severity, const char* file, int line,
} else { } else {
DoRawLog(&buf, &size, "%s", kTruncated); DoRawLog(&buf, &size, "%s", kTruncated);
} }
AsyncSignalSafeWriteToStderr(buffer, strlen(buffer)); AsyncSignalSafeWriteError(buffer, strlen(buffer));
} }
#else #else
static_cast<void>(format); static_cast<void>(format);
...@@ -205,7 +205,7 @@ void DefaultInternalLog(absl::LogSeverity severity, const char* file, int line, ...@@ -205,7 +205,7 @@ void DefaultInternalLog(absl::LogSeverity severity, const char* file, int line,
} // namespace } // namespace
void AsyncSignalSafeWriteToStderr(const char* s, size_t len) { void AsyncSignalSafeWriteError(const char* s, size_t len) {
absl::base_internal::ErrnoSaver errno_saver; absl::base_internal::ErrnoSaver errno_saver;
#if defined(__EMSCRIPTEN__) #if defined(__EMSCRIPTEN__)
// In WebAssembly, bypass filesystem emulation via fwrite. // In WebAssembly, bypass filesystem emulation via fwrite.
......
...@@ -130,7 +130,7 @@ void RawLog(absl::LogSeverity severity, const char* file, int line, ...@@ -130,7 +130,7 @@ void RawLog(absl::LogSeverity severity, const char* file, int line,
// Writes the provided buffer directly to stderr, in a signal-safe, low-level // Writes the provided buffer directly to stderr, in a signal-safe, low-level
// manner. Preserves errno. // manner. Preserves errno.
void AsyncSignalSafeWriteToStderr(const char* s, size_t len); void AsyncSignalSafeWriteError(const char* s, size_t len);
// compile-time function to get the "base" filename, that is, the part of // compile-time function to get the "base" filename, that is, the part of
// a filename after the last "/" or "\" path separator. The search starts at // a filename after the last "/" or "\" path separator. The search starts at
......
...@@ -378,8 +378,7 @@ static void AbslFailureSignalHandler(int signo, siginfo_t*, void* ucontext) { ...@@ -378,8 +378,7 @@ static void AbslFailureSignalHandler(int signo, siginfo_t*, void* ucontext) {
// First write to stderr. // First write to stderr.
WriteFailureInfo( WriteFailureInfo(
signo, ucontext, my_cpu, +[](const char* data) { signo, ucontext, my_cpu, +[](const char* data) {
absl::raw_log_internal::AsyncSignalSafeWriteToStderr(data, absl::raw_log_internal::AsyncSignalSafeWriteError(data, strlen(data));
strlen(data));
}); });
// Riskier code (because it is less likely to be async-signal-safe) // Riskier code (because it is less likely to be async-signal-safe)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment