blob: 53f7bcb8e8d09697463e862fa3f5495de2a687e4 [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
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080018--- a/adb/adb.h
19+++ b/adb/adb.h
20@@ -18,7 +18,9 @@
21 #define __ADB_H
22
23 #include <limits.h>
24+#include <sys/types.h>
25
26+#include "fdevent.h"
27 #include "adb_trace.h"
28 #include "transport.h" /* readx(), writex() */
29
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080030--- a/adb/disable_verity_service.c
31+++ b/adb/disable_verity_service.c
Andrew Geissler517393d2023-01-13 08:55:19 -060032@@ -14,25 +14,32 @@
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080033 * limitations under the License.
34 */
35
36-#include "sysdeps.h"
37
38 #define TRACE_TAG TRACE_ADB
39 #include "adb.h"
40+#include "sysdeps.h"
41+#include "cutils/properties.h"
42+#include "ext4_sb.h"
43+#include <fs_mgr.h>
44
45 #include <stdio.h>
46 #include <stdarg.h>
47 #include <sys/stat.h>
48 #include <fcntl.h>
49 #include <inttypes.h>
Andrew Geissler517393d2023-01-13 08:55:19 -060050-
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080051-#include "cutils/properties.h"
52-#include "ext4_sb.h"
53-#include <fs_mgr.h>
Andrew Geissler517393d2023-01-13 08:55:19 -060054+#include <unistd.h>
55+#include <errno.h>
56+#include <stdbool.h>
57+
58+#if defined(__linux__) && !defined(__GLIBC__)
59+#define lseek64 lseek
60+#define off64_t off_t
61+#endif
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080062
63 #define FSTAB_PREFIX "/fstab."
64 struct fstab *fstab;
65
66-__attribute__((__format__(printf, 2, 3))) __nonnull((2))
67+__attribute__((__format__(printf, 2, 3))) __attribute__((nonnull((2))))
68 static void write_console(int fd, const char* format, ...)
69 {
70 char buffer[256];
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080071--- a/adb/framebuffer_service.c
72+++ b/adb/framebuffer_service.c
73@@ -14,6 +14,10 @@
74 * limitations under the License.
75 */
76
77+#include "fdevent.h"
78+#include "adb.h"
79+#include "sysdeps.h"
80+
81 #include <stdlib.h>
82 #include <stdio.h>
83 #include <unistd.h>
84@@ -23,9 +27,6 @@
85 #include <sys/types.h>
86 #include <sys/wait.h>
87
88-#include "fdevent.h"
89-#include "adb.h"
90-
91 #include <linux/fb.h>
92 #include <sys/ioctl.h>
93 #include <sys/mman.h>
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080094--- a/adb/sysdeps.h
95+++ b/adb/sysdeps.h
Andrew Geissler517393d2023-01-13 08:55:19 -060096@@ -123,8 +123,8 @@ static __inline__ int unix_close(int fd
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080097 {
98 return close(fd);
99 }
100-#undef close
101-#define close ____xxx_close
102+//#undef close
103+//#define close ____xxx_close
104
105 static __inline__ int unix_read(int fd, void* buf, size_t len)
106 {
107@@ -369,8 +369,8 @@ static __inline__ int adb_close(int fd)
108 {
109 return close(fd);
110 }
111-#undef close
112-#define close ____xxx_close
113+//#undef close
114+//#define close ____xxx_close
115
116
117 static __inline__ int adb_read(int fd, void* buf, size_t len)
Andrew Geissler517393d2023-01-13 08:55:19 -0600118@@ -392,8 +392,8 @@ static __inline__ int adb_lseek(int f
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800119 {
120 return lseek(fd, pos, where);
121 }
122-#undef lseek
123-#define lseek ___xxx_lseek
124+//#undef lseek
125+//#define lseek ___xxx_lseek
126
127 static __inline__ int adb_unlink(const char* path)
128 {