[patch] netstat -W (wide) option

Cristian Ionescu-Idbohrn cristian.ionescu-idbohrn at axis.com
Sat May 12 12:33:45 UTC 2007


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.

Tha patch applies cleanly to today's svn.
Please consider for inclusion.


Cheers,
Cristian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: busybox-netstat-massive-rewrite-with-wide-option.diff
Type: text/x-diff
Size: 11518 bytes
Desc: 
Url : http://lists.busybox.net/pipermail/busybox/attachments/20070512/58702287/attachment-0002.bin 


More information about the busybox mailing list