[git commit] Resolve linker issues with Android API 21 (dprintf, tcdrain)

Denys Vlasenko vda.linux at googlemail.com
Thu Dec 17 15:42:41 UTC 2015


commit: http://git.busybox.net/busybox/commit/?id=6df961257d584714c5690b1f4197c677e4f832ec
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Chris Renshaw <osm0sis at outlook.com>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 include/platform.h       | 7 ++++++-
 libbb/missing_syscalls.c | 2 ++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/include/platform.h b/include/platform.h
index 1706b18..026ebbe 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -481,9 +481,14 @@ typedef unsigned smalluint;
 
 #if defined(ANDROID) || defined(__ANDROID__)
 # if __ANDROID_API__ < 8
+   /* ANDROID < 8 has no [f]dprintf at all */
 #  undef HAVE_DPRINTF
-# else
+# elif __ANDROID_API__ < 21
+   /* ANDROID < 21 has fdprintf */
 #  define dprintf fdprintf
+# else
+   /* ANDROID >= 21 has standard dprintf */
+# endif
 # endif
 # if __ANDROID_API__ < 21
 #  undef HAVE_TTYNAME_R
diff --git a/libbb/missing_syscalls.c b/libbb/missing_syscalls.c
index e3c1e92..0934128 100644
--- a/libbb/missing_syscalls.c
+++ b/libbb/missing_syscalls.c
@@ -40,8 +40,10 @@ int pivot_root(const char *new_root, const char *put_old)
 	return syscall(__NR_pivot_root, new_root, put_old);
 }
 
+# if __ANDROID_API__ < 21
 int tcdrain(int fd)
 {
 	return ioctl(fd, TCSBRK, 1);
 }
+# endif
 #endif


More information about the busybox-cvs mailing list