1From 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--- 12Upstream-Status: Pending 13 14 adb/adb.h | 2 ++ 15 adb/disable_verity_service.c | 13 ++++++++----- 16 adb/framebuffer_service.c | 7 ++++--- 17 adb/sysdeps.h | 12 ++++++------ 18 4 files changed, 20 insertions(+), 14 deletions(-) 19 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 32--- a/adb/disable_verity_service.c 33+++ b/adb/disable_verity_service.c 34@@ -14,25 +14,32 @@ 35 * limitations under the License. 36 */ 37 38-#include "sysdeps.h" 39 40 #define TRACE_TAG TRACE_ADB 41 #include "adb.h" 42+#include "sysdeps.h" 43+#include "cutils/properties.h" 44+#include "ext4_sb.h" 45+#include <fs_mgr.h> 46 47 #include <stdio.h> 48 #include <stdarg.h> 49 #include <sys/stat.h> 50 #include <fcntl.h> 51 #include <inttypes.h> 52- 53-#include "cutils/properties.h" 54-#include "ext4_sb.h" 55-#include <fs_mgr.h> 56+#include <unistd.h> 57+#include <errno.h> 58+#include <stdbool.h> 59+ 60+#if defined(__linux__) && !defined(__GLIBC__) 61+#define lseek64 lseek 62+#define off64_t off_t 63+#endif 64 65 #define FSTAB_PREFIX "/fstab." 66 struct fstab *fstab; 67 68-__attribute__((__format__(printf, 2, 3))) __nonnull((2)) 69+__attribute__((__format__(printf, 2, 3))) __attribute__((nonnull((2)))) 70 static void write_console(int fd, const char* format, ...) 71 { 72 char buffer[256]; 73--- a/adb/framebuffer_service.c 74+++ b/adb/framebuffer_service.c 75@@ -14,6 +14,10 @@ 76 * limitations under the License. 77 */ 78 79+#include "fdevent.h" 80+#include "adb.h" 81+#include "sysdeps.h" 82+ 83 #include <stdlib.h> 84 #include <stdio.h> 85 #include <unistd.h> 86@@ -23,9 +27,6 @@ 87 #include <sys/types.h> 88 #include <sys/wait.h> 89 90-#include "fdevent.h" 91-#include "adb.h" 92- 93 #include <linux/fb.h> 94 #include <sys/ioctl.h> 95 #include <sys/mman.h> 96--- a/adb/sysdeps.h 97+++ b/adb/sysdeps.h 98@@ -123,8 +123,8 @@ static __inline__ int unix_close(int fd 99 { 100 return close(fd); 101 } 102-#undef close 103-#define close ____xxx_close 104+//#undef close 105+//#define close ____xxx_close 106 107 static __inline__ int unix_read(int fd, void* buf, size_t len) 108 { 109@@ -369,8 +369,8 @@ static __inline__ int adb_close(int fd) 110 { 111 return close(fd); 112 } 113-#undef close 114-#define close ____xxx_close 115+//#undef close 116+//#define close ____xxx_close 117 118 119 static __inline__ int adb_read(int fd, void* buf, size_t len) 120@@ -392,8 +392,8 @@ static __inline__ int adb_lseek(int f 121 { 122 return lseek(fd, pos, where); 123 } 124-#undef lseek 125-#define lseek ___xxx_lseek 126+//#undef lseek 127+//#define lseek ___xxx_lseek 128 129 static __inline__ int adb_unlink(const char* path) 130 { 131