[PATCH 03/10] ss: removed obsolet fmt functions
Those functions are obsoleted since the new fmt handler mechanism subsumes their tasks. Rendundancy would be contradictory to the new mechanism. Signed-off-by: Matthias Tafelmeier matthias.tafelme...@gmx.net Suggested-by: Hagen Paul Pfeifer ha...@jauu.net --- misc/ss.c | 190 -- 1 file changed, 190 deletions(-) diff --git a/misc/ss.c b/misc/ss.c index 3d31b81..e241b2f 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -647,43 +647,6 @@ static const char *sstate_namel[] = { [SS_CLOSING] = closing, }; -static void sock_state_print(struct sockstat *s, const char *sock_name) -{ - if (netid_width) - printf(%-*s , netid_width, sock_name); - if (state_width) - printf(%-*s , state_width, sstate_name[s-state]); - - printf(%-6d %-6d , s-rq, s-wq); -} - -static void sock_details_print(struct sockstat *s) -{ - if (s-uid) - printf( uid:%u, s-uid); - - printf( ino:%u, s-ino); - printf( sk:%llx, s-sk); -} - -static void sock_addr_print_width(int addr_len, const char *addr, char *delim, - int port_len, const char *port, const char *ifname) -{ - if (ifname) { - printf(%*s%%%s%s%-*s , addr_len, addr, ifname, delim, - port_len, port); - } - else { - printf(%*s%s%-*s , addr_len, addr, delim, port_len, port); - } -} - -static void sock_addr_print(const char *addr, char *delim, const char *port, - const char *ifname) -{ - sock_addr_print_width(addr_width, addr, delim, serv_width, port, ifname); -} - static const char *tmr_name[] = { off, on, @@ -693,33 +656,6 @@ static const char *tmr_name[] = { unknown }; -static const char *print_ms_timer(int timeout) -{ - static char buf[64]; - int secs, msecs, minutes; - if (timeout 0) - timeout = 0; - secs = timeout/1000; - minutes = secs/60; - secs = secs%60; - msecs = timeout%1000; - buf[0] = 0; - if (minutes) { - msecs = 0; - snprintf(buf, sizeof(buf)-16, %dmin, minutes); - if (minutes 9) - secs = 0; - } - if (secs) { - if (secs 9) - msecs = 0; - sprintf(buf+strlen(buf), %d%s, secs, msecs ? . : sec); - } - if (msecs) - sprintf(buf+strlen(buf), %03dms, msecs); - return buf; -} - struct scache *rlist; static void init_service_resolver(void) @@ -1482,122 +1418,6 @@ static int proc_inet_split_line(char *line, char **loc, char **rem, char **data) return 0; } -static char *sprint_bw(char *buf, double bw) -{ - if (bw 100.) - sprintf(buf,%.1fM, bw / 100.); - else if (bw 1000.) - sprintf(buf,%.1fK, bw / 1000.); - else - sprintf(buf, %g, bw); - - return buf; -} - -static void tcp_stats_print(struct tcpstat *s) -{ - char b1[64]; - - if (s-has_ts_opt) - printf( ts); - if (s-has_sack_opt) - printf( sack); - if (s-has_ecn_opt) - printf( ecn); - if (s-has_ecnseen_opt) - printf( ecnseen); - if (s-has_fastopen_opt) - printf( fastopen); - if (s-cong_alg[0]) - printf( %s, s-cong_alg); - if (s-has_wscale_opt) - printf( wscale:%d,%d, s-snd_wscale, s-rcv_wscale); - if (s-rto) - printf( rto:%g, s-rto); - if (s-backoff) - printf( backoff:%u, s-backoff); - if (s-rtt) - printf( rtt:%g/%g, s-rtt, s-rttvar); - if (s-ato) - printf( ato:%g, s-ato); - - if (s-qack) - printf( qack:%d, s-qack); - if (s-qack 1) - printf( bidir); - - if (s-mss) - printf( mss:%d, s-mss); - if (s-cwnd) - printf( cwnd:%d, s-cwnd); - if (s-ssthresh) - printf( ssthresh:%d, s-ssthresh); - - if (s-bytes_acked) - printf( bytes_acked:%llu, s-bytes_acked); - if (s-bytes_received) - printf( bytes_received:%llu, s-bytes_received); - if (s-segs_out) - printf( segs_out:%u, s-segs_out); - if (s-segs_in) - printf( segs_in:%u, s-segs_in); - - if (s-dctcp s-dctcp-enabled) { - struct dctcpstat *dctcp = s-dctcp; - - printf( dctcp:(ce_state:%u,alpha:%u,ab_ecn:%u,ab_tot:%u), - dctcp-ce_state, dctcp-alpha, dctcp-ab_ecn, - dctcp-ab_tot); - } else if (s-dctcp) { - printf( dctcp:fallback_mode); - } - - if (s-send_bps) - printf( send %sbps, sprint_bw(b1, s-send_bps)); - if (s-lastsnd) - printf( lastsnd:%u,
[PATCH 03/10] ss: removed obsolet fmt functions
Those functions are obsoleted since the new fmt handler mechanism subsumes their tasks. Rendundancy would be contradictory to the new mechanism. Signed-off-by: Matthias Tafelmeier matthias.tafelme...@gmx.net Suggested-by: Hagen Paul Pfeifer ha...@jauu.net --- misc/ss.c | 190 -- 1 file changed, 190 deletions(-) diff --git a/misc/ss.c b/misc/ss.c index 3d31b81..e241b2f 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -647,43 +647,6 @@ static const char *sstate_namel[] = { [SS_CLOSING] = closing, }; -static void sock_state_print(struct sockstat *s, const char *sock_name) -{ - if (netid_width) - printf(%-*s , netid_width, sock_name); - if (state_width) - printf(%-*s , state_width, sstate_name[s-state]); - - printf(%-6d %-6d , s-rq, s-wq); -} - -static void sock_details_print(struct sockstat *s) -{ - if (s-uid) - printf( uid:%u, s-uid); - - printf( ino:%u, s-ino); - printf( sk:%llx, s-sk); -} - -static void sock_addr_print_width(int addr_len, const char *addr, char *delim, - int port_len, const char *port, const char *ifname) -{ - if (ifname) { - printf(%*s%%%s%s%-*s , addr_len, addr, ifname, delim, - port_len, port); - } - else { - printf(%*s%s%-*s , addr_len, addr, delim, port_len, port); - } -} - -static void sock_addr_print(const char *addr, char *delim, const char *port, - const char *ifname) -{ - sock_addr_print_width(addr_width, addr, delim, serv_width, port, ifname); -} - static const char *tmr_name[] = { off, on, @@ -693,33 +656,6 @@ static const char *tmr_name[] = { unknown }; -static const char *print_ms_timer(int timeout) -{ - static char buf[64]; - int secs, msecs, minutes; - if (timeout 0) - timeout = 0; - secs = timeout/1000; - minutes = secs/60; - secs = secs%60; - msecs = timeout%1000; - buf[0] = 0; - if (minutes) { - msecs = 0; - snprintf(buf, sizeof(buf)-16, %dmin, minutes); - if (minutes 9) - secs = 0; - } - if (secs) { - if (secs 9) - msecs = 0; - sprintf(buf+strlen(buf), %d%s, secs, msecs ? . : sec); - } - if (msecs) - sprintf(buf+strlen(buf), %03dms, msecs); - return buf; -} - struct scache *rlist; static void init_service_resolver(void) @@ -1482,122 +1418,6 @@ static int proc_inet_split_line(char *line, char **loc, char **rem, char **data) return 0; } -static char *sprint_bw(char *buf, double bw) -{ - if (bw 100.) - sprintf(buf,%.1fM, bw / 100.); - else if (bw 1000.) - sprintf(buf,%.1fK, bw / 1000.); - else - sprintf(buf, %g, bw); - - return buf; -} - -static void tcp_stats_print(struct tcpstat *s) -{ - char b1[64]; - - if (s-has_ts_opt) - printf( ts); - if (s-has_sack_opt) - printf( sack); - if (s-has_ecn_opt) - printf( ecn); - if (s-has_ecnseen_opt) - printf( ecnseen); - if (s-has_fastopen_opt) - printf( fastopen); - if (s-cong_alg[0]) - printf( %s, s-cong_alg); - if (s-has_wscale_opt) - printf( wscale:%d,%d, s-snd_wscale, s-rcv_wscale); - if (s-rto) - printf( rto:%g, s-rto); - if (s-backoff) - printf( backoff:%u, s-backoff); - if (s-rtt) - printf( rtt:%g/%g, s-rtt, s-rttvar); - if (s-ato) - printf( ato:%g, s-ato); - - if (s-qack) - printf( qack:%d, s-qack); - if (s-qack 1) - printf( bidir); - - if (s-mss) - printf( mss:%d, s-mss); - if (s-cwnd) - printf( cwnd:%d, s-cwnd); - if (s-ssthresh) - printf( ssthresh:%d, s-ssthresh); - - if (s-bytes_acked) - printf( bytes_acked:%llu, s-bytes_acked); - if (s-bytes_received) - printf( bytes_received:%llu, s-bytes_received); - if (s-segs_out) - printf( segs_out:%u, s-segs_out); - if (s-segs_in) - printf( segs_in:%u, s-segs_in); - - if (s-dctcp s-dctcp-enabled) { - struct dctcpstat *dctcp = s-dctcp; - - printf( dctcp:(ce_state:%u,alpha:%u,ab_ecn:%u,ab_tot:%u), - dctcp-ce_state, dctcp-alpha, dctcp-ab_ecn, - dctcp-ab_tot); - } else if (s-dctcp) { - printf( dctcp:fallback_mode); - } - - if (s-send_bps) - printf( send %sbps, sprint_bw(b1, s-send_bps)); - if (s-lastsnd) - printf( lastsnd:%u,