[patch] netstat -W (wide) option

Denis Vlasenko vda.linux at googlemail.com
Tue May 15 16:55:48 PDT 2007


On Saturday 12 May 2007 14:33, Cristian Ionescu-Idbohrn wrote:
> One of my collegues at work produced this patch, as we were requested
> to produce untruncated (ipv4 and ipv6) hostnames.
> It's actually first a rewrite which shrinks netstat:
> 
> CONFIG_FEATURE_IPV6=y
> CONFIG_NETSTAT=y
> # CONFIG_FEATURE_NETSTAT_WIDE is not set
> 
> function                                             old     new   delta
> build_ipv6_addr                                        -      81     +81
> build_ipv4_addr                                        -      28     +28
> netstat_main                                         457     470     +13
> snprint_ip_port                                      234     238      +4
> net_conn_line                                          -       4      +4
> net_conn_header                                        -       4      +4
> .rodata                                             1947    1883     -64
> udp_do_one                                           769     592    -177
> tcp_do_one                                           610     433    -177
> raw_do_one                                           748     571    -177
> ------------------------------------------------------------------------------
> (add/remove: 4/0 grow/shrink: 2/4 up/down: 134/-595)         Total: -461 bytes
> 
> The added -W (wide) option adds some bloat (136 bytes):
> 
> CONFIG_FEATURE_IPV6=y
> CONFIG_NETSTAT=y
> CONFIG_FEATURE_NETSTAT_WIDE=y
> 
> function                                             old     new   delta
> build_ipv6_addr                                        -      81     +81
> netstat_main                                         457     505     +48
> .rodata                                             1947    1979     +32
> build_ipv4_addr                                        -      28     +28
> snprint_ip_port                                      234     239      +5
> net_conn_line                                          -       4      +4
> net_conn_header                                        -       4      +4
> ip_print_width                                         -       4      +4
> udp_do_one                                           769     592    -177
> tcp_do_one                                           610     433    -177
> raw_do_one                                           748     571    -177
> ------------------------------------------------------------------------------
> (add/remove: 5/0 grow/shrink: 3/3 up/down: 206/-531)         Total: -325 bytes
> 
> though still manages to shrink netstat with 325 bytes.

Thanks! Applying, with attached patch on top
(further shringk by ~180 bytes + fix for bogus state
value for raw sockets)
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2.patch
Type: text/x-diff
Size: 15751 bytes
Desc: not available
Url : http://busybox.net/lists/busybox/attachments/20070516/239fefe6/attachment.bin 


More information about the busybox mailing list