[PATCH] users: new applet

gotrunks at gmail.com gotrunks at gmail.com
Wed Jul 27 16:03:48 UTC 2011


On Wed, Jul 27, 2011 at 4:43 PM, Tito <farmatito at tiscali.it> wrote:
> On Wednesday 27 July 2011 13:10:49 gotrunks at gmail.com wrote:
>> On Wed, Jul 27, 2011 at 10:29 AM, Tito <farmatito at tiscali.it> wrote:
>> > On Wednesday 27 July 2011 00:33:37 gotrunks at gmail.com wrote:
>> >> Hi,
>> >>
>> >> patch attached.
>> >>
>> >> Regards,
>> >>
>> >
>> > Hi,
>> > printf(ut->ut_user);  maybe adding a format string here would be a good thing.
>>
>> Ok.
>>
>> > BTW.: this code looks very similar to what the who applet does, couldn't
>> > they be merged?
>> >
>>
>> That was the first thing I tried, but I don't know how to do it
>> without unsightly impact the who applet.
>>
>> > Ciao,
>> > Tito
>> > _______________________________________________
>> > busybox mailing list
>> > busybox at busybox.net
>> > http://lists.busybox.net/mailman/listinfo/busybox
>> >
>>
>> Regards,
>>
>
> Hi,
> attached an example patch on how who and users could be merged.
> Denys will love my obfuscated code ;-)
>

I'm reading your code and I think it's great.

But maybe it's not perfect. If I'm not wrong, with your patch applied,
a build with defconfig without "users" applet is now a little bigger
(vs bb 19.0.git equivalent config).

$ make bloatcheck
function                                             old     new   delta
applet_main                                         2776    2784      +8
.rodata                                           148282  148290      +8
applet_names                                        2379    2383      +4
packed_usage                                       28326   28328      +2
applet_nameofs                                       694     696      +2
run_applet_and_exit                                  830     828      -2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/1 up/down: 24/-2)              Total: 22 bytes
   text	   data	    bss	    dec	    hex	filename
 931375	   4146	   9552	 945073	  e6bb1	busybox_old
 931381	   4146	   9552	 945079	  e6bb7	busybox_unstripped


So your patch is a lot better for a busybox build compiled with
"users" & "who" applets, but a little worse for a busybox build
compiled with "who" & without "users". When I was thinking in adding
applets to busybox I didn't want to impact busybox binaries compiled
without this new applets. In fact, if no one added "users" to busybox
probably most systems won't have busybox "users". Maybe it's better to
not hurt this systems.

Regards
-- 
Pere


More information about the busybox mailing list