diff options
-rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc b/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc index 8670fc34fa0..13e790a8972 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc @@ -538,7 +538,8 @@ uptr GetRSS() { // Starting with the L release, syslog() works and is preferable to // __android_log_write. #if SANITIZER_LINUX -#if SANITIZER_ANDROID && __ANDROID_API__ < 21 + +#if SANITIZER_ANDROID static atomic_uint8_t android_log_initialized; void AndroidLogInit() { @@ -548,17 +549,19 @@ void AndroidLogInit() { static bool IsSyslogAvailable() { return atomic_load(&android_log_initialized, memory_order_acquire); } - -static void WriteOneLineToSyslog(const char *s) { - __android_log_write(ANDROID_LOG_INFO, NULL, s); -} #else void AndroidLogInit() {} static bool IsSyslogAvailable() { return true; } +#endif // SANITIZER_ANDROID -static void WriteOneLineToSyslog(const char *s) { syslog(LOG_INFO, "%s", s); } +static void WriteOneLineToSyslog(const char *s) { +#if SANITIZER_ANDROID &&__ANDROID_API__ < 21 + __android_log_write(ANDROID_LOG_INFO, NULL, s); +#else + syslog(LOG_INFO, "%s", s); #endif +} void WriteToSyslog(const char *buffer) { if (!IsSyslogAvailable()) |