blob: c7aebb6411e4749c0eeaed449e1611f03bf42de7 [file] [log] [blame]
Brad Bishopd7bf8c12018-02-25 22:55:05 -05001From f8653ed0ede4aa781ab758fcd44fdc05ffbe0b0a 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 2/2] 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 system/core/adb/adb.h | 2 ++
13 system/core/adb/disable_verity_service.c | 13 ++++++++-----
14 system/core/adb/framebuffer_service.c | 7 ++++---
15 system/core/adb/sysdeps.h | 12 ++++++------
16 4 files changed, 20 insertions(+), 14 deletions(-)
17
18diff --git a/system/core/adb/adb.h b/system/core/adb/adb.h
19index 44e5981..bcdc49f 100644
20--- a/system/core/adb/adb.h
21+++ b/system/core/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/system/core/adb/disable_verity_service.c b/system/core/adb/disable_verity_service.c
33index ed3da52..29fa3d6 100644
34--- a/system/core/adb/disable_verity_service.c
35+++ b/system/core/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/system/core/adb/framebuffer_service.c b/system/core/adb/framebuffer_service.c
71index 8cbe840..8f0ccfb 100644
72--- a/system/core/adb/framebuffer_service.c
73+++ b/system/core/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/system/core/adb/sysdeps.h b/system/core/adb/sysdeps.h
96index cc1f839..ea39ac3 100644
97--- a/system/core/adb/sysdeps.h
98+++ b/system/core/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 {
132--
1332.14.1
134