[patch] minor size optimization for dmesg.c

Bernhard Fischer rep.nop at aon.at
Thu Mar 23 13:53:01 UTC 2006


On Sun, Mar 19, 2006 at 09:26:18PM -0500, Rob Landley wrote:
>On Saturday 18 March 2006 8:32 am, Bernhard Fischer wrote:
>> Hi,
>>
>> Attached patch touches dmesg and saves a very few bytes.
>>
>>    text	   data	    bss	    dec	    hex	filename
>>     276	      0	      0	    276	    114	util-linux/dmesg.o.orig
>>     271	      0	      0	    271	    10f	util-linux/dmesg.o.01
>>      44	      0	      0	     44	     2c	util-linux/dmesg.o.mine
>>
>>
>> PS: the .mine is just a quick and dirty minimal dump of the buffer, à la
>> $ cat dmess.c
>> #include <sys/klog.h>
>> #include <stdlib.h>
>> #include <unistd.h>
>> int main(int argc, char **argv)
>> {
>> 	char *buffer = malloc(128*1024);
>> 	int i;
>>
>> 	i = klogctl(3, buffer, sizeof(buffer));
>> 	if (i > 0)
>> 		write(1, buffer, i);
>> }
>
>That looks like the busybox approach to things.  Why aren't we doing that now?

No idea, i admit. dmesg.c appears to have been put into busybox by Erik.
Personally, i'm using my dumb version as it it's sufficient for my
needs.

Should we make the option-parsing (and thus all dependant code) optional
and add a CONFIG_FEATURE_DMESG_OPTIONS or the like? If so please add a
short comment to TODO, TIA.




More information about the busybox mailing list