diff options
author | Dan Albert <danalbert@google.com> | 2015-04-30 12:52:21 -0700 |
---|---|---|
committer | Christopher Ferris <cferris@google.com> | 2015-05-13 13:44:34 -0700 |
commit | 428fad97a0c9c3def1489b16f0257a9cbcfd43f8 (patch) | |
tree | 78dd414554390090d9b9f436b006f9a634d067f7 /libbacktrace | |
parent | cd206b3900639c44767cd892bccfbffabf222f67 (diff) | |
download | core-428fad97a0c9c3def1489b16f0257a9cbcfd43f8.tar.gz core-428fad97a0c9c3def1489b16f0257a9cbcfd43f8.tar.bz2 core-428fad97a0c9c3def1489b16f0257a9cbcfd43f8.zip |
Remove libbacktrace definition of gettid.
Also simplifies the Darwin implementation of gettid, because
apparently libbacktrace had a better way of doing it.
Bug: 19517541
(cherry picked from commit 23f750b068ddf5b20fb5d153a798b22562368992)
Change-Id: I2f888e8ed7a2f5719973786cbcbb399a81867ee9
Diffstat (limited to 'libbacktrace')
-rw-r--r-- | libbacktrace/Backtrace.cpp | 2 | ||||
-rw-r--r-- | libbacktrace/BacktraceCurrent.cpp | 2 | ||||
-rw-r--r-- | libbacktrace/backtrace_test.cpp | 17 | ||||
-rw-r--r-- | libbacktrace/thread_utils.c | 17 | ||||
-rw-r--r-- | libbacktrace/thread_utils.h | 2 |
5 files changed, 15 insertions, 25 deletions
diff --git a/libbacktrace/Backtrace.cpp b/libbacktrace/Backtrace.cpp index d75c2106b..4e4003e60 100644 --- a/libbacktrace/Backtrace.cpp +++ b/libbacktrace/Backtrace.cpp @@ -27,6 +27,8 @@ #include <backtrace/Backtrace.h> #include <backtrace/BacktraceMap.h> +#include <cutils/threads.h> + #include "BacktraceLog.h" #include "thread_utils.h" #include "UnwindCurrent.h" diff --git a/libbacktrace/BacktraceCurrent.cpp b/libbacktrace/BacktraceCurrent.cpp index fd1f4da7b..14f04de5e 100644 --- a/libbacktrace/BacktraceCurrent.cpp +++ b/libbacktrace/BacktraceCurrent.cpp @@ -29,6 +29,8 @@ #include <backtrace/Backtrace.h> #include <backtrace/BacktraceMap.h> +#include <cutils/threads.h> + #include "BacktraceCurrent.h" #include "BacktraceLog.h" #include "ThreadEntry.h" diff --git a/libbacktrace/backtrace_test.cpp b/libbacktrace/backtrace_test.cpp index ba3cbb58d..a086547dd 100644 --- a/libbacktrace/backtrace_test.cpp +++ b/libbacktrace/backtrace_test.cpp @@ -30,20 +30,21 @@ #include <time.h> #include <unistd.h> +#include <algorithm> +#include <memory> +#include <string> +#include <vector> + #include <backtrace/Backtrace.h> #include <backtrace/BacktraceMap.h> -// For the THREAD_SIGNAL definition. -#include "BacktraceCurrent.h" - #include <cutils/atomic.h> -#include <gtest/gtest.h> +#include <cutils/threads.h> -#include <algorithm> -#include <memory> -#include <string> -#include <vector> +#include <gtest/gtest.h> +// For the THREAD_SIGNAL definition. +#include "BacktraceCurrent.h" #include "thread_utils.h" // Number of microseconds per milliseconds. diff --git a/libbacktrace/thread_utils.c b/libbacktrace/thread_utils.c index 6f4cd3c44..e75f56e39 100644 --- a/libbacktrace/thread_utils.c +++ b/libbacktrace/thread_utils.c @@ -16,25 +16,12 @@ #include "thread_utils.h" -#if defined(__APPLE__) +#if !defined(__BIONIC__) -#include <sys/syscall.h> - -// Mac OS >= 10.6 has a system call equivalent to Linux's gettid(). -pid_t gettid() { - return syscall(SYS_thread_selfid); -} - -#elif !defined(__BIONIC__) - -// glibc doesn't implement or export either gettid or tgkill. +// glibc doesn't implement or export tgkill. #include <unistd.h> #include <sys/syscall.h> -pid_t gettid() { - return syscall(__NR_gettid); -} - int tgkill(int tgid, int tid, int sig) { return syscall(__NR_tgkill, tgid, tid, sig); } diff --git a/libbacktrace/thread_utils.h b/libbacktrace/thread_utils.h index ae4c92904..df83581f1 100644 --- a/libbacktrace/thread_utils.h +++ b/libbacktrace/thread_utils.h @@ -23,8 +23,6 @@ __BEGIN_DECLS int tgkill(int tgid, int tid, int sig); -pid_t gettid(); - __END_DECLS #endif /* _LIBBACKTRACE_THREAD_UTILS_H */ |