[PATCH] D73561: [scudo][standalone] Fix Android logging

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 28 11:10:15 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGa1f6ff26814b: [scudo][standalone] Fix Android logging (authored by cryptoad).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73561/new/

https://reviews.llvm.org/D73561

Files:
  compiler-rt/lib/scudo/standalone/linux.cpp


Index: compiler-rt/lib/scudo/standalone/linux.cpp
===================================================================
--- compiler-rt/lib/scudo/standalone/linux.cpp
+++ compiler-rt/lib/scudo/standalone/linux.cpp
@@ -164,10 +164,17 @@
   return (ReadBytes == static_cast<ssize_t>(Length));
 }
 
+// Allocation free syslog-like API.
+extern "C" WEAK int async_safe_write_log(int pri, const char *tag,
+                                         const char *msg);
+
 void outputRaw(const char *Buffer) {
-  static HybridMutex Mutex;
-  ScopedLock L(Mutex);
-  write(2, Buffer, strlen(Buffer));
+  if (&async_safe_write_log) {
+    constexpr s32 AndroidLogInfo = 4;
+    async_safe_write_log(AndroidLogInfo, "scudo", Buffer);
+  } else {
+    write(2, Buffer, strlen(Buffer));
+  }
 }
 
 extern "C" WEAK void android_set_abort_message(const char *);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73561.240947.patch
Type: text/x-patch
Size: 844 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200128/657b3e84/attachment.bin>


More information about the llvm-commits mailing list