blob: b5d383f383392ed65488e899000c4e8812243a0b [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001From 62d957a1271c88ec08d67984fbe31601f0bd41a9 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 15 Sep 2017 15:50:57 -0700
4Subject: [PATCH] adb: Musl fixes
5
6__nonnull is gcc specific
7include sys/types.h for size_t
8Do not redefine close() and lseek()
9
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 adb/adb.h | 2 ++
13 adb/disable_verity_service.c | 13 ++++++++-----
14 adb/framebuffer_service.c | 7 ++++---
15 adb/sysdeps.h | 12 ++++++------
16 4 files changed, 20 insertions(+), 14 deletions(-)
17
18diff --git a/adb/adb.h b/adb/adb.h
19index 44e5981bdc..bcdc49f63c 100644
20--- a/adb/adb.h
21+++ b/adb/adb.h
22@@ -18,7 +18,9 @@
23 #define __ADB_H
24
25 #include <limits.h>
26+#include <sys/types.h>
27
28+#include "fdevent.h"
29 #include "adb_trace.h"
30 #include "transport.h" /* readx(), writex() */
31
32diff --git a/adb/disable_verity_service.c b/adb/disable_verity_service.c
33index ed3da52108..29fa3d65a9 100644
34--- a/adb/disable_verity_service.c
35+++ b/adb/disable_verity_service.c
36@@ -14,25 +14,28 @@
37 * limitations under the License.
38 */
39
40-#include "sysdeps.h"
41
42 #define TRACE_TAG TRACE_ADB
43 #include "adb.h"
44+#include "sysdeps.h"
45+#include "cutils/properties.h"
46+#include "ext4_sb.h"
47+#include <fs_mgr.h>
48
49 #include <stdio.h>
50 #include <stdarg.h>
51 #include <sys/stat.h>
52 #include <fcntl.h>
53 #include <inttypes.h>
54+#include <unistd.h>
55+#include <errno.h>
56+#include <stdbool.h>
57
58-#include "cutils/properties.h"
59-#include "ext4_sb.h"
60-#include <fs_mgr.h>
61
62 #define FSTAB_PREFIX "/fstab."
63 struct fstab *fstab;
64
65-__attribute__((__format__(printf, 2, 3))) __nonnull((2))
66+__attribute__((__format__(printf, 2, 3))) __attribute__((nonnull((2))))
67 static void write_console(int fd, const char* format, ...)
68 {
69 char buffer[256];
70diff --git a/adb/framebuffer_service.c b/adb/framebuffer_service.c
71index 8cbe8403cc..8f0ccfb7aa 100644
72--- a/adb/framebuffer_service.c
73+++ b/adb/framebuffer_service.c
74@@ -14,6 +14,10 @@
75 * limitations under the License.
76 */
77
78+#include "fdevent.h"
79+#include "adb.h"
80+#include "sysdeps.h"
81+
82 #include <stdlib.h>
83 #include <stdio.h>
84 #include <unistd.h>
85@@ -23,9 +27,6 @@
86 #include <sys/types.h>
87 #include <sys/wait.h>
88
89-#include "fdevent.h"
90-#include "adb.h"
91-
92 #include <linux/fb.h>
93 #include <sys/ioctl.h>
94 #include <sys/mman.h>
95diff --git a/adb/sysdeps.h b/adb/sysdeps.h
96index cc1f839e9f..ea39ac39cc 100644
97--- a/adb/sysdeps.h
98+++ b/adb/sysdeps.h
99@@ -123,8 +123,8 @@ static __inline__ int unix_close(int fd)
100 {
101 return close(fd);
102 }
103-#undef close
104-#define close ____xxx_close
105+//#undef close
106+//#define close ____xxx_close
107
108 static __inline__ int unix_read(int fd, void* buf, size_t len)
109 {
110@@ -369,8 +369,8 @@ static __inline__ int adb_close(int fd)
111 {
112 return close(fd);
113 }
114-#undef close
115-#define close ____xxx_close
116+//#undef close
117+//#define close ____xxx_close
118
119
120 static __inline__ int adb_read(int fd, void* buf, size_t len)
121@@ -392,8 +392,8 @@ static __inline__ int adb_lseek(int fd, int pos, int where)
122 {
123 return lseek(fd, pos, where);
124 }
125-#undef lseek
126-#define lseek ___xxx_lseek
127+//#undef lseek
128+//#define lseek ___xxx_lseek
129
130 static __inline__ int adb_unlink(const char* path)
131 {