bug 1245745 include libpulse version in update URL r=glandium
authorKarl Tomlinson <karlt+@karlt.net>
Tue, 09 Feb 2016 14:35:03 +1300
changeset 283713 bbd61f93a1642f2d4990d62d995f451fabfb50e5
parent 283712 4cc0e594e139bc04cc0f756c4536fc55dd9c2949
child 283714 181e4142e652a62ec6d1dbf96d0efcd382b31173
push id29988
push usercbook@mozilla.com
push dateWed, 10 Feb 2016 10:47:59 +0000
treeherdermozilla-central@7042e8a19f94 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1245745
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 1245745 include libpulse version in update URL r=glandium
xpcom/base/nsSystemInfo.cpp
--- a/xpcom/base/nsSystemInfo.cpp
+++ b/xpcom/base/nsSystemInfo.cpp
@@ -26,16 +26,17 @@
 #endif
 
 #ifdef XP_MACOSX
 #include "MacHelpers.h"
 #endif
 
 #ifdef MOZ_WIDGET_GTK
 #include <gtk/gtk.h>
+#include <dlfcn.h>
 #include <unistd.h>
 #include <fstream>
 #include "mozilla/Tokenizer.h"
 #include "nsCharSeparatedTokenizer.h"
 
 #include <map>
 #include <string>
 #endif
@@ -697,23 +698,43 @@ nsSystemInfo::Init()
 #endif
 
   if (gtkver_len <= 0) {
     gtkver_len = snprintf(gtkver, sizeof(gtkver), "GTK %u.%u.%u",
                           gtk_major_version, gtk_minor_version,
                           gtk_micro_version);
   }
 
+  nsAutoCString secondaryLibrary;
   if (gtkver_len > 0) {
-    rv = SetPropertyAsACString(NS_LITERAL_STRING("secondaryLibrary"),
-                               nsDependentCSubstring(gtkver, gtkver_len));
-    if (NS_WARN_IF(NS_FAILED(rv))) {
-      return rv;
+    secondaryLibrary.Append(nsDependentCSubstring(gtkver, gtkver_len));
+  }
+
+  void* libpulse = dlopen("libpulse.so.0", RTLD_LAZY);
+  const char* libpulseVersion = "not-available";
+  if (libpulse) {
+    auto pa_get_library_version = reinterpret_cast<const char* (*)()>
+      (dlsym(libpulse, "pa_get_library_version"));
+
+    if (pa_get_library_version) {
+      libpulseVersion = pa_get_library_version();
     }
   }
+
+  secondaryLibrary.AppendPrintf(",libpulse %s", libpulseVersion);
+
+  if (libpulse) {
+    dlclose(libpulse);
+  }
+
+  rv = SetPropertyAsACString(NS_LITERAL_STRING("secondaryLibrary"),
+                             secondaryLibrary);
+  if (NS_WARN_IF(NS_FAILED(rv))) {
+    return rv;
+  }
 #endif
 
 #ifdef MOZ_WIDGET_ANDROID
   AndroidSystemInfo info;
   if (XRE_IsContentProcess()) {
     dom::ContentChild* child = dom::ContentChild::GetSingleton();
     if (child) {
       child->SendGetAndroidSystemInfo(&info);