(The attached patch subsumes the previous "Bionic lacks mempcpy; enable existing workaround".)
Bionic has been growing new features over the years, so platform.h should test the __ANDROID_API__ macro to determine which functions to polyfill. Specifically: * Bionic has supported fdprintf() since API level 8. This is a direct replacement for dprintf(). (The Bionic header chides Glibc for choosing the name "dprintf".) * Bionic has supported ttyname_r(), getline(), and stpcpy() since API level 21.
>From 3c0effb4ccab30fb59d70d5837ad46b50a196ef0 Mon Sep 17 00:00:00 2001 From: Matt Whitlock <busy...@mattwhitlock.name> Date: Tue, 28 Apr 2015 22:37:42 -0400 Subject: [PATCH] conditionally undefine feature macros depending on Android API level Also, undefine HAVE_MEMPCPY on Android, as Bionic lacks this function in all released versions (but upstream master does have it, so support is coming). --- include/platform.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/include/platform.h b/include/platform.h index d5ab7bc..1706b18 100644 --- a/include/platform.h +++ b/include/platform.h @@ -480,10 +480,17 @@ typedef unsigned smalluint; #endif #if defined(ANDROID) || defined(__ANDROID__) -# undef HAVE_DPRINTF -# undef HAVE_TTYNAME_R -# undef HAVE_GETLINE -# undef HAVE_STPCPY +# if __ANDROID_API__ < 8 +# undef HAVE_DPRINTF +# else +# define dprintf fdprintf +# endif +# if __ANDROID_API__ < 21 +# undef HAVE_TTYNAME_R +# undef HAVE_GETLINE +# undef HAVE_STPCPY +# endif +# undef HAVE_MEMPCPY # undef HAVE_STRCHRNUL # undef HAVE_STRVERSCMP # undef HAVE_UNLOCKED_LINE_OPS -- 2.3.6
_______________________________________________ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox