Add support for musl am: da4d6df49d am: 1cc4627ff3 am: a520223a00 am: 21456aab6e

Original change: https://android-review.googlesource.com/c/platform/system/logging/+/1767165

Change-Id: I6220459d34ba8ef7e098cad241b0d69a68eb7c1c
diff --git a/liblog/logger_write.cpp b/liblog/logger_write.cpp
index 3481f8a..08ab6e2 100644
--- a/liblog/logger_write.cpp
+++ b/liblog/logger_write.cpp
@@ -108,11 +108,10 @@
 #endif
 }
 
-#if defined(__GLIBC__) || defined(_WIN32)
+// BSD-based systems like Android/macOS have getprogname(). Others need us to provide one.
+#if !defined(__APPLE__) && !defined(__BIONIC__)
 static const char* getprogname() {
-#if defined(__GLIBC__)
-  return program_invocation_short_name;
-#elif defined(_WIN32)
+#ifdef _WIN32
   static bool first = true;
   static char progname[MAX_PATH] = {};
 
@@ -129,6 +128,8 @@
   }
 
   return progname;
+#else
+  return program_invocation_short_name;
 #endif
 }
 #endif