1 From 7e3c165000d44fa153a3270870ed500bc8bbb461 Mon Sep 17 00:00:00 2001
2 From: Nicholas Baldwin <baldwinn@google.com>
3 Date: Fri, 27 Oct 2017 11:44:36 -0700
4 Subject: [PATCH] Fix double declaration of tgkill when using Android NDK
7 As of Android API level 16 tgkill is declared in the NDK version of
8 signal.h, which conflicts with the static definition found in
9 src/client/linux/handler/exception_handler.cc. This change removes
10 the static tgkill definition and replaces its use with sys_tgkill
11 from the linux syscall support library.
14 Change-Id: Ic70addd8a064cfa36345d86b7e36409e2089e909
15 Reviewed-on: https://chromium-review.googlesource.com/738912
16 Reviewed-by: Mike Frysinger <vapier@chromium.org>
18 src/client/linux/handler/exception_handler.cc | 8 +-------
19 1 file changed, 1 insertion(+), 7 deletions(-)
21 diff --git a/src/client/linux/handler/exception_handler.cc b/src/client/linux/handler/exception_handler.cc
22 index 95005209..cd94e3b5 100644
23 --- a/src/client/linux/handler/exception_handler.cc
24 +++ b/src/client/linux/handler/exception_handler.cc
26 #define PR_SET_PTRACER 0x59616d61
29 -// A wrapper for the tgkill syscall: send a signal to a specific thread.
30 -static int tgkill(pid_t tgid, pid_t tid, int sig) {
31 - return syscall(__NR_tgkill, tgid, tid, sig);
35 namespace google_breakpad {
38 @@ -400,7 +394,7 @@ void ExceptionHandler::SignalHandler(int sig, siginfo_t* info, void* uc) {
39 // In order to retrigger it, we have to queue a new signal by calling
40 // kill() ourselves. The special case (si_pid == 0 && sig == SIGABRT) is
41 // due to the kernel sending a SIGABRT from a user request via SysRQ.
42 - if (tgkill(getpid(), syscall(__NR_gettid), sig) < 0) {
43 + if (sys_tgkill(getpid(), syscall(__NR_gettid), sig) < 0) {
44 // If we failed to kill ourselves (e.g. because a sandbox disallows us
45 // to do so), we instead resort to terminating our process. This will
46 // result in an incorrect exit code.