Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 1 | From 62d957a1271c88ec08d67984fbe31601f0bd41a9 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Fri, 15 Sep 2017 15:50:57 -0700 |
| 4 | Subject: [PATCH] adb: Musl fixes |
| 5 | |
| 6 | __nonnull is gcc specific |
| 7 | include sys/types.h for size_t |
| 8 | Do not redefine close() and lseek() |
| 9 | |
| 10 | Signed-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 Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 18 | --- 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 Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 30 | --- a/adb/disable_verity_service.c |
| 31 | +++ b/adb/disable_verity_service.c |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame^] | 32 | @@ -14,25 +14,32 @@ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 33 | * 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 Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame^] | 50 | - |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 51 | -#include "cutils/properties.h" |
| 52 | -#include "ext4_sb.h" |
| 53 | -#include <fs_mgr.h> |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame^] | 54 | +#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 Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 62 | |
| 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 Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 71 | --- 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 Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 94 | --- a/adb/sysdeps.h |
| 95 | +++ b/adb/sysdeps.h |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame^] | 96 | @@ -123,8 +123,8 @@ static __inline__ int unix_close(int fd |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 97 | { |
| 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 Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame^] | 118 | @@ -392,8 +392,8 @@ static __inline__ int adb_lseek(int f |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 119 | { |
| 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 | { |