[Toybox] [PATCH] libcutils isn't in the NDK.

Rob Landley rob at landley.net
Sun Oct 7 15:12:33 PDT 2018


On 10/07/2018 11:30 AM, enh wrote:
> Bug: https://github.com/landley/toybox/issues/43

That fixes that one (once I pulled your email out of the spam filter, and yes I
got unsubscribed from my own list again because gmail false positived on the
"sorry if this one's a duplicate" email from earlier today and refused delivery.
It's pretty much a daily occurrence at this point.)

But there's another problem, your redo of getconf works wth glibc and bionic,
but not with a musl-cross-make toolchain:

toys/posix/getconf.c:140:8: error: 'UIO_MAXIOV' undeclared here (not in a
function); did you mean '_SC_UIO_MAXIOV'?
   CONF(UIO_MAXIOV), CONF(CHAR_BIT),
        ^

Trying its suggestion and switching to _SC_UIO_MAXIOV, ala:

--- a/toys/posix/getconf.c
+++ b/toys/posix/getconf.c
@@ -86,7 +86,7 @@ struct config sysconfs[] = {
   CONF(PAGESIZE), CONF(RAW_SOCKETS), CONF(RE_DUP_MAX), CONF(RTSIG_MAX),
   CONF(SEM_NSEMS_MAX), CONF(SEM_VALUE_MAX), CONF(SIGQUEUE_MAX),
   CONF(STREAM_MAX), CONF(SYMLOOP_MAX), CONF(TIMER_MAX), CONF(TTY_NAME_MAX),
-  CONF(TZNAME_MAX),
+  CONF(TZNAME_MAX), CONF(UIO_MAXIOV),

   /* Names that just don't match the symbol, do it by hand */
   {"_AVPHYS_PAGES", _SC_AVPHYS_PAGES}, {"_PHYS_PAGES", _SC_PHYS_PAGES},
@@ -137,7 +137,7 @@ struct config limits[] = {
   CONF(CHAR_MAX), CONF(CHAR_MIN), CONF(INT_MAX), CONF(INT_MIN), CONF(SCHAR_MAX)
   CONF(SCHAR_MIN), CONF(SHRT_MAX), CONF(SHRT_MIN), CONF(SSIZE_MAX),
   CONF(UCHAR_MAX), CONF(UINT_MAX), CONF(ULONG_MAX), CONF(USHRT_MAX),
-  CONF(UIO_MAXIOV), CONF(CHAR_BIT),
+  CONF(CHAR_BIT),
   /* Not available in glibc without _GNU_SOURCE. */
   {"LONG_BIT", 8*sizeof(long)},
   {"WORD_BIT", 8*sizeof(int)},

Then it works with glibc and musl, but _not_ with the android NDKr18:

toys/posix/getconf.c:89:21: error: use of undeclared identifier '_SC_UIO_MAXIOV'
  CONF(TZNAME_MAX), CONF(UIO_MAXIOV),

I can fix this up with portabiliy.h glue (not sure which direction's right
though), but it's why I was trying the header generation approach in the first
place. If anybody ever does try to build this command on macosx or freebsd, it's
likely to be a nightmare. The sed version had a bug and was hard to read, but
was at least portable in _theory_...

Rob



More information about the Toybox mailing list