[Toybox] [PATCH] Fix uptime.c to build when CFG_TOYBOX_UTMPX is false.

Rob Landley rob at landley.net
Sun Aug 30 04:06:01 PDT 2015


On 08/29/2015 03:58 PM, enh wrote:
> ping. i can't try switching Android over (to see if anyone notices)
> until i can actually build toybox uptime...

Sorry, turns out after presenting at three conferences in one week, I
might spend the next week in zombie-like recovery. (Who knew?)

> On Mon, Aug 17, 2015 at 11:12 AM, enh <enh at google.com> wrote:
>> Fix uptime.c to build when CFG_TOYBOX_UTMPX is false.
>>
>> The alternative is to provide dummy setutxent, getutxent, endutxent,
>> struct utmpx, and USER_PROCESS in portability.h, but that seems more
>> distasteful (and is the reason bionic is unlikely to ever have
>> <utmpx.h>).
>>
>> Note that there's an equivalent problem with CFG_TOYBOX_SHADOW, but
>> Android doesn't build the affected toybox commands because they're
>> useless on Android for the same reason Android doesn't have
>> <shadow.h>: our concept of user is fundamentally different.

I actually have a half-finished commit here that modifies uptime to have
-al options for the android and linux output formats, and selects the
default based on CFG_TOYBOX_ANDROID.

The android format is arguably more useful for android than the linux
one. For one thing, the "X users" field is meaningless on android, since
you repurposed UID to mean something else.

So I think the right fix is to extend toybox uptime, but we also need to
fix the android build issue and if I want to avoid #ifdefs in the code
(yup) that means I add stubs to portability.h.

I just checked in portability.h glue to make it build, if that's enough
for you let me know, but if you want the -al options it's not a big deal.

Thanks,

Rob

(I still need to set up a standalone android build environment...)

 1440932761.0


More information about the Toybox mailing list