[PATCH] users: new applet

gotrunks at gmail.com gotrunks at gmail.com
Wed Jul 27 17:08:20 UTC 2011


On Wed, Jul 27, 2011 at 6:39 PM, Tito <farmatito at tiscali.it> wrote:
> On Wednesday 27 July 2011 18:03:48 you wrote:
>> 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
>>
>
> Hi,
> looks to me like some padding issues or the like as who_main does not show up
> in bloat-check.  For me old who vs. new who with users disabled:
>
> scripts/bloat-o-meter busybox_old busybox_unstripped
> function                                             old     new   delta
> ------------------------------------------------------------------------------
> (add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0)                 Total: 0 bytes
>
> Old who vs new who with users enabled:
>
>  scripts/bloat-o-meter busybox_old busybox_unstripped
> function                                             old     new   delta
> who_main                                             364     453     +89
> packed_usage                                        1068    1075      +7
> applet_names                                          85      91      +6
> applet_main                                           48      52      +4
> applet_nameofs                                        24      26      +2
> applet_install_loc                                     6       7      +1
> ------------------------------------------------------------------------------
> (add/remove: 0/0 grow/shrink: 6/0 up/down: 109/0)             Total: 109 bytes
>
> Ciao,
> Tito
>

Then I have something wrong in my system,

old who vs new who (users enabled):
$ scripts/bloat-o-meter busybox_old busybox_unstripped
function                                             old     new   delta
who_main                                             414     500     +86
.rodata                                           148282  148316     +34
applet_main                                         2776    2792     +16
applet_names                                        2379    2389     +10
applet_nameofs                                       694     698      +4
packed_usage                                       28326   28329      +3
applet_install_loc                                   174     175      +1
run_applet_and_exit                                  830     828      -2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 7/1 up/down: 154/-2)            Total: 152 bytes

old who vs new who (users disabled):
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

I'm on x64, will try on x86

Regards,
-- 
Pere


More information about the busybox mailing list