File fix-gettid.patch of Package firefox45esr

Index: mozilla/tools/profiler/core/platform-linux.cc
===================================================================
--- mozilla.orig/tools/profiler/core/platform-linux.cc
+++ mozilla/tools/profiler/core/platform-linux.cc
@@ -56,6 +56,7 @@
 #include <sys/stat.h>   // open
 #include <fcntl.h>      // open
 #include <unistd.h>     // sysconf
+#include <asm-generic/unistd.h> // sys_gettid
 #include <semaphore.h>
 #ifdef __GLIBC__
 #include <execinfo.h>   // backtrace, backtrace_symbols
@@ -111,7 +112,7 @@ lul::LUL* sLUL = nullptr;
 static void sLUL_initialization_routine(void)
 {
   MOZ_ASSERT(!sLUL);
-  MOZ_ASSERT(gettid() == getpid()); /* "this is the main thread" */
+  MOZ_ASSERT(sys_gettid() == getpid()); /* "this is the main thread" */
   sLUL = new lul::LUL(logging_sink_for_LUL);
   // Read all the unwind info currently available.
   read_procmaps(sLUL);
@@ -121,7 +122,7 @@ static void sLUL_initialization_routine(
 /* static */ Thread::tid_t
 Thread::GetCurrentId()
 {
-  return gettid();
+  return sys_gettid();
 }
 
 #if !defined(ANDROID)
@@ -308,7 +309,7 @@ static void* SignalSender(void* arg) {
 #endif
 
   int vm_tgid_ = getpid();
-  DebugOnly<int> my_tid = gettid();
+  DebugOnly<int> my_tid = sys_gettid();
 
   unsigned int nSignalsSent = 0;
 
@@ -503,7 +504,7 @@ UpdateThreadId(void* aThreadInfo) {
   // calling this method is running. We can't try to acquire
   // Sampler::sRegisteredThreadsMutex because it could be held by another
   // thread.
-  info->SetThreadId(gettid());
+  info->SetThreadId(sys_gettid());
 }
 #endif
 
@@ -516,7 +517,7 @@ bool Sampler::RegisterCurrentThread(cons
 
   ::MutexAutoLock lock(*Sampler::sRegisteredThreadsMutex);
 
-  int id = gettid();
+  int id = sys_gettid();
   for (uint32_t i = 0; i < sRegisteredThreads->size(); i++) {
     ThreadInfo* info = sRegisteredThreads->at(i);
     if (info->ThreadId() == id && !info->IsPendingDelete()) {
@@ -564,7 +565,7 @@ void Sampler::UnregisterCurrentThread()
 
   ::MutexAutoLock lock(*Sampler::sRegisteredThreadsMutex);
 
-  int id = gettid();
+  int id = sys_gettid();
 
   for (uint32_t i = 0; i < sRegisteredThreads->size(); i++) {
     ThreadInfo* info = sRegisteredThreads->at(i);
Index: mozilla/tools/profiler/core/platform.h
===================================================================
--- mozilla.orig/tools/profiler/core/platform.h
+++ mozilla/tools/profiler/core/platform.h
@@ -59,15 +59,15 @@
 #include <vector>
 #include "StackTop.h"
 
-// We need a definition of gettid(), but glibc doesn't provide a
-// wrapper for it.
+// We need a definition of gettid()
 #if defined(__GLIBC__)
 #include <unistd.h>
 #include <sys/syscall.h>
-static inline pid_t gettid()
+static pid_t sys_gettid()
 {
   return (pid_t) syscall(SYS_gettid);
 }
+
 #endif
 
 #ifdef XP_WIN
Index: mozilla/tools/profiler/tasktracer/GeckoTaskTracer.cpp
===================================================================
--- mozilla.orig/tools/profiler/tasktracer/GeckoTaskTracer.cpp
+++ mozilla/tools/profiler/tasktracer/GeckoTaskTracer.cpp
@@ -22,10 +22,6 @@
 #if defined(__GLIBC__)
 // glibc doesn't implement gettid(2).
 #include <sys/syscall.h>
-static pid_t gettid()
-{
-  return (pid_t) syscall(SYS_gettid);
-}
 #endif
 
 // NS_ENSURE_TRUE_VOID() without the warning on the debug build.
@@ -257,7 +253,7 @@ GetOrCreateTraceInfo()
   }
 
   if (!info) {
-    info = AllocTraceInfo(gettid());
+    info = AllocTraceInfo(sys_gettid());
     sTraceInfoTLS.set(info);
   }
 
@@ -270,7 +266,7 @@ GenNewUniqueTaskId()
   TraceInfo* info = GetOrCreateTraceInfo();
   ENSURE_TRUE(info, 0);
 
-  pid_t tid = gettid();
+  pid_t tid = sys_gettid();
   uint64_t taskid = ((uint64_t)tid << 32) | ++info->mLastUniqueTaskId;
   return taskid;
 }
@@ -349,7 +345,7 @@ LogBegin(uint64_t aTaskId, uint64_t aSou
   nsCString* log = info->AppendLog();
   if (log) {
     log->AppendPrintf("%d %lld %lld %d %d",
-                      ACTION_BEGIN, aTaskId, GetTimestamp(), getpid(), gettid());
+                      ACTION_BEGIN, aTaskId, GetTimestamp(), getpid(), sys_gettid());
   }
 }
 
openSUSE Build Service is sponsored by