Package: thunderbird / 1:68.10.0-1~deb9u1

porting-kfreebsd-hurd/ipc-chromium-fix-if-define-for-kFreeBSD-and-Hurd.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
From: Christoph Goehre <chris@sigxcpu.org>
Date: Wed, 31 Oct 2012 13:27:07 -0400
Subject: ipc/chromium: fix #if define() for kFreeBSD and Hurd

The kFreeBSD and Hurd platforms need some other macros to include
the correct needed headers.
Depended on this some minor changes to call the correct functions
also needed. Also the list of the cpp source file for the chromium
things needs to expanded.
The changes is an adoption of the previous dropped patch 'Fix
ipc/chromium on kFreeBSD and Hurd' from the version 17.
---
 ipc/chromium/src/base/platform_thread_posix.cc | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/ipc/chromium/src/base/platform_thread_posix.cc b/ipc/chromium/src/base/platform_thread_posix.cc
index e0d6726..31b1592 100644
--- a/ipc/chromium/src/base/platform_thread_posix.cc
+++ b/ipc/chromium/src/base/platform_thread_posix.cc
@@ -13,7 +13,7 @@
 #  include <mach/mach.h>
 #elif defined(OS_NETBSD)
 #  include <lwp.h>
-#elif defined(OS_LINUX)
+#elif defined(OS_LINUX) && !defined(__FreeBSD_kernel__) && !defined(__GNU__)
 #  include <sys/syscall.h>
 #  include <sys/prctl.h>
 #endif
@@ -22,7 +22,7 @@
 #  include <unistd.h>
 #endif
 
-#if defined(OS_BSD) && !defined(OS_NETBSD) && !defined(__GLIBC__)
+#if defined(OS_BSD) && !defined(OS_NETBSD) && !defined(__GLIBC__) && !defined(__FreeBSD_kernel__)
 #  include <pthread_np.h>
 #endif
 
@@ -100,6 +100,22 @@ void PlatformThread::SetName(const char* name) {
   // also sets the thread name on the PRThread wrapper, and allows us to
   // retrieve it using PR_GetThreadName.
   NS_SetCurrentThreadName(name);
+
+  // http://0pointer.de/blog/projects/name-your-threads.html
+  // Set the name for the LWP (which gets truncated to 15 characters).
+  // Note that glibc also has a 'pthread_setname_np' api, but it may not be
+  // available everywhere and it's only benefit over using prctl directly is
+  // that it can set the name of threads other than the current thread.
+#if defined(OS_LINUX) && !defined(__FreeBSD_kernel__) && !defined(__GNU__)
+  prctl(PR_SET_NAME, reinterpret_cast<uintptr_t>(name), 0, 0, 0); 
+#elif defined(OS_NETBSD)
+  pthread_setname_np(pthread_self(), "%s", (void *)name);
+#elif defined(OS_BSD) && !defined(__GLIBC__)
+  pthread_set_name_np(pthread_self(), name);
+#elif defined(OS_SOLARIS)
+  pthread_setname_np(pthread_self(), name);
+#else
+#endif
 }
 #endif  // !OS_MACOSX