Considering porting acpi

Steven Honeyman stevenhoneyman at gmail.com
Fri Oct 10 19:04:44 UTC 2014


On 10 October 2014 18:16, Rich Felker <dalias at libc.org> wrote:
> On Fri, Oct 10, 2014 at 08:43:15AM -0700, Isaac Dunham wrote:
>> > > The code I have is currently using dirtree_read(), which corresponds to
>> > > recursive_action().
>> > > Basically it looks in /sys/class/*/*/, /sys/class/power_supply,
>> > > and /sys/class/thermal for device status.
>> > > I could make it shorter if I use glob() instead of a recursive callback;
>> > > does anyone know whether glob() is likely to be a bloat problem?
>> >
>> > There's a cut-down glob function you could borrow from the linux
>> > kernel ( lib/glob.c ) if you really wanted it slim.
>>
>> That would make a smaller static binary where only the "acpi" applet is
>> concerned, but it might well increase the net size; glob uses fnmatch,
>> which is use in several parts of busybox.
>
> Yes, I would think replacing glob would be a net increase in size
> unless you have an extremely minimal bb config to begin with.

Ah yes, you're both right, I'd somehow forgotten about the whole
multicall thing!

If curious how much difference there is (I was):
[all tests done using musl libc, static]

Standalone:

~15k for glob.c test program
~28k for fnmatch.h test program

Busybox:

=== fnmatch.h test ===
function                                             old     new   delta
globA_main                                             -     132    +132

=== linux kernel glob.c test ===
function                                             old     new   delta
glob_match                                             -     255    +255
globB_main                                             -     107    +107


Steven


More information about the busybox mailing list