libbase-fix-includes.patch
1 | This patch fixes the build of adb on linux. It was taken from archlinux. |
2 | |
3 | diff --git a/adb/sysdeps.h b/adb/sysdeps.h |
4 | index 75dcc86..867f3ec 100644 |
5 | --- a/adb/sysdeps.h |
6 | +++ b/adb/sysdeps.h |
7 | @@ -25,6 +25,7 @@ |
8 | #endif |
9 | |
10 | #include <errno.h> |
11 | +#include <sys/syscall.h> |
12 | |
13 | #include <string> |
14 | #include <vector> |
15 | @@ -831,7 +832,16 @@ static __inline__ int adb_is_absolute_host_path(const char* path) { |
16 | |
17 | static __inline__ unsigned long adb_thread_id() |
18 | { |
19 | - return (unsigned long)gettid(); |
20 | + // TODO: this function should be merged with GetThreadId |
21 | +#if defined(__BIONIC__) |
22 | + return gettid(); |
23 | +#elif defined(__APPLE__) |
24 | + return syscall(SYS_thread_selfid); |
25 | +#elif defined(__linux__) |
26 | + return syscall(__NR_gettid); |
27 | +#elif defined(_WIN32) |
28 | + return GetCurrentThreadId(); |
29 | +#endif |
30 | } |
31 | |
32 | #endif /* !_WIN32 */ |
33 | diff --git a/base/errors_unix.cpp b/base/errors_unix.cpp |
34 | index 296995e..48269b6 100644 |
35 | --- a/base/errors_unix.cpp |
36 | +++ b/base/errors_unix.cpp |
37 | @@ -17,6 +17,7 @@ |
38 | #include "android-base/errors.h" |
39 | |
40 | #include <errno.h> |
41 | +#include <string.h> |
42 | |
43 | namespace android { |
44 | namespace base { |
45 | diff --git a/base/file.cpp b/base/file.cpp |
46 | index da1adba..91a3901 100644 |
47 | --- a/base/file.cpp |
48 | +++ b/base/file.cpp |
49 | @@ -20,6 +20,7 @@ |
50 | #include <fcntl.h> |
51 | #include <sys/stat.h> |
52 | #include <sys/types.h> |
53 | +#include <string.h> |
54 | |
55 | #include <string> |
56 | |
57 | diff --git a/base/logging.cpp b/base/logging.cpp |
58 | index 1741871..e97c7f1 100644 |
59 | --- a/base/logging.cpp |
60 | +++ b/base/logging.cpp |
61 | @@ -21,6 +21,7 @@ |
62 | #include "android-base/logging.h" |
63 | |
64 | #include <libgen.h> |
65 | +#include <string.h> |
66 | |
67 | // For getprogname(3) or program_invocation_short_name. |
68 | #if defined(__ANDROID__) || defined(__APPLE__) |
69 |