1 This patch fixes the build of adb on linux.
3 Copied from archlinux repository:
4 https://git.archlinux.org/svntogit/community.git/tree/trunk/fix_build.patch?h=packages/android-tools
6 diff --git a/adb/sysdeps.h b/adb/sysdeps.h
7 index 75dcc86..867f3ec 100644
14 +#include <sys/syscall.h>
18 @@ -831,7 +832,16 @@ static __inline__ int adb_is_absolute_host_path(const char* path) {
20 static __inline__ unsigned long adb_thread_id()
22 - return (unsigned long)gettid();
23 + // TODO: this function should be merged with GetThreadId
24 +#if defined(__BIONIC__)
26 +#elif defined(__APPLE__)
27 + return syscall(SYS_thread_selfid);
28 +#elif defined(__linux__)
29 + return syscall(__NR_gettid);
30 +#elif defined(_WIN32)
31 + return GetCurrentThreadId();
36 diff --git a/base/errors_unix.cpp b/base/errors_unix.cpp
37 index 296995e..48269b6 100644
38 --- a/base/errors_unix.cpp
39 +++ b/base/errors_unix.cpp
41 #include "android-base/errors.h"
48 diff --git a/base/file.cpp b/base/file.cpp
49 index da1adba..91a3901 100644
55 #include <sys/types.h>
60 diff --git a/base/logging.cpp b/base/logging.cpp
61 index 1741871..e97c7f1 100644
62 --- a/base/logging.cpp
63 +++ b/base/logging.cpp
65 #include "android-base/logging.h"
70 // For getprogname(3) or program_invocation_short_name.
71 #if defined(__ANDROID__) || defined(__APPLE__)