1From 2fa414c8655c421e7eb0bb1719928babb0ecf7c6 Mon Sep 17 00:00:00 2001 2From: Thomas Petazzoni <thomas.petazzoni@bootlin.com> 3Date: Thu, 26 Dec 2019 22:21:33 +0100 4Subject: [PATCH] src/client/linux/handler/exception_handler.cc: rename tgkill 5 to BreakpadTgkill() 6MIME-Version: 1.0 7Content-Type: text/plain; charset=UTF-8 8Content-Transfer-Encoding: 8bit 9 10Since glibc 2.30, a tgkill() function was added in the C library, and 11its definition obviously conflicts with the internal definition of 12google-breakpad, causing build failures: 13 14src/client/linux/handler/exception_handler.cc:109:12: error: ‘int tgkill(pid_t, pid_t, int)’ was declared ‘extern’ and later ‘static’ [-fpermissive] 15 109 | static int tgkill(pid_t tgid, pid_t tid, int sig) { 16 | ^~~~~~ 17In file included from /usr/include/signal.h:374, 18 from ./src/client/linux/handler/exception_handler.h:33, 19 from src/client/linux/handler/exception_handler.cc:66: 20/usr/include/bits/signal_ext.h:29:12: note: previous declaration of ‘int tgkill(__pid_t, __pid_t, int)’ 21 29 | extern int tgkill (__pid_t __tgid, __pid_t __tid, int __signal); 22 | ^~~~~~ 23 24Upstream google-breakpad simply dropped the use of the internal 25tgkill() in commit 26https://chromium.googlesource.com/breakpad/breakpad/+/7e3c165000d44fa153a3270870ed500bc8bbb461. However, 27this is not realistic for Buildroot, since we do support old systems 28where the system C library will not necessarily provide tgkill(). 29 30Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> 31--- 32 src/client/linux/handler/exception_handler.cc | 4 ++-- 33 1 file changed, 2 insertions(+), 2 deletions(-) 34 35diff --git a/src/client/linux/handler/exception_handler.cc b/src/client/linux/handler/exception_handler.cc 36index b63f973b..b4c279b8 100644 37--- a/src/client/linux/handler/exception_handler.cc 38+++ b/src/client/linux/handler/exception_handler.cc 39@@ -106,7 +106,7 @@ 40 #endif 41 42 // A wrapper for the tgkill syscall: send a signal to a specific thread. 43-static int tgkill(pid_t tgid, pid_t tid, int sig) { 44+static int BreakpadTgkill(pid_t tgid, pid_t tid, int sig) { 45 return syscall(__NR_tgkill, tgid, tid, sig); 46 return 0; 47 } 48@@ -387,7 +387,7 @@ void ExceptionHandler::SignalHandler(int sig, siginfo_t* info, void* uc) { 49 // In order to retrigger it, we have to queue a new signal by calling 50 // kill() ourselves. The special case (si_pid == 0 && sig == SIGABRT) is 51 // due to the kernel sending a SIGABRT from a user request via SysRQ. 52- if (tgkill(getpid(), syscall(__NR_gettid), sig) < 0) { 53+ if (BreakpadTgkill(getpid(), syscall(__NR_gettid), sig) < 0) { 54 // If we failed to kill ourselves (e.g. because a sandbox disallows us 55 // to do so), we instead resort to terminating our process. This will 56 // result in an incorrect exit code. 57-- 582.24.1 59 60