gperftools: prepare for musl 1.2.2
Support was added to musl in v1.2.1-76-g7c71792e
This commit is contained in:
parent
b06e4d7456
commit
bac9bbc351
65
srcpkgs/gperftools/patches/sigev_notify_thread_id.patch
Normal file
65
srcpkgs/gperftools/patches/sigev_notify_thread_id.patch
Normal file
@ -0,0 +1,65 @@
|
||||
From d9c4c3b481e641b719d3d790987ed7d094157bf2 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
|
||||
<congdanhqx@gmail.com>
|
||||
Date: Fri, 12 Feb 2021 19:21:18 +0700
|
||||
Subject: [PATCH] profile-handler: use documented sigev_notify_thread_id in
|
||||
sigevent
|
||||
|
||||
sigevent(7) is documented to have sigev_notify_thread_id as its member.
|
||||
In glibc system, it's a macro expanded to the legacy _sigev_un._tid,
|
||||
_sigev_un._tid is obviously an internal implementation detail as
|
||||
signaled by its underscore prefix. And this macro was hidden inside
|
||||
linux/signal.h in older version of glibc.
|
||||
|
||||
On Linux that use musl libc, sigev_notify_thread_id is also a macro, but
|
||||
it's expanded to __sev_fields.sigev_notify_thread_id
|
||||
|
||||
[alkondratenko@gmail.com: amputated broken linux/signal.h dependency]
|
||||
[alkondratenko@gmail.com: see https://github.com/gperftools/gperftools/pull/1250]
|
||||
Signed-off-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
|
||||
---
|
||||
src/profile-handler.cc | 17 ++++++++++++++++-
|
||||
1 file changed, 16 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git src/profile-handler.cc src/profile-handler.cc
|
||||
index 7fdcb693..fe3715b1 100644
|
||||
--- src/profile-handler.cc
|
||||
+++ src/profile-handler.cc
|
||||
@@ -49,6 +49,9 @@
|
||||
#if HAVE_LINUX_SIGEV_THREAD_ID
|
||||
// for timer_{create,settime} and associated typedefs & constants
|
||||
#include <time.h>
|
||||
+// for sigevent
|
||||
+#include <signal.h>
|
||||
+
|
||||
// for sys_gettid
|
||||
#include "base/linux_syscall_support.h"
|
||||
// for perftools_pthread_key_create
|
||||
@@ -61,6 +64,18 @@
|
||||
#include "base/spinlock.h"
|
||||
#include "maybe_threads.h"
|
||||
|
||||
+// Some Linux systems don't have sigev_notify_thread_id defined in
|
||||
+// signal.h (despite having SIGEV_THREAD_ID defined) and also lack
|
||||
+// working linux/signal.h. So lets workaround. Note, we know that at
|
||||
+// least on Linux sigev_notify_thread_id is macro.
|
||||
+//
|
||||
+// See https://sourceware.org/bugzilla/show_bug.cgi?id=27417 and
|
||||
+// https://bugzilla.kernel.org/show_bug.cgi?id=200081
|
||||
+//
|
||||
+#if __linux__ && HAVE_LINUX_SIGEV_THREAD_ID && !defined(sigev_notify_thread_id)
|
||||
+#define sigev_notify_thread_id _sigev_un._tid
|
||||
+#endif
|
||||
+
|
||||
using std::list;
|
||||
using std::string;
|
||||
|
||||
@@ -272,7 +287,7 @@ static void StartLinuxThreadTimer(int timer_type, int signal_number,
|
||||
struct itimerspec its;
|
||||
memset(&sevp, 0, sizeof(sevp));
|
||||
sevp.sigev_notify = SIGEV_THREAD_ID;
|
||||
- sevp._sigev_un._tid = sys_gettid();
|
||||
+ sevp.sigev_notify_thread_id = sys_gettid();
|
||||
sevp.sigev_signo = signal_number;
|
||||
clockid_t clock = CLOCK_THREAD_CPUTIME_ID;
|
||||
if (timer_type == ITIMER_REAL) {
|
Loading…
x
Reference in New Issue
Block a user