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