From eec869f6d768a06209e3070f2f610b21547d0113 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Wed, 8 Aug 2007 06:11:20 +0000 Subject: [PATCH] add tcp.in_errs --- bindings/java/src/jni/generate.pl | 5 +++++ bindings/java/src/org/hyperic/sigar/cmd/Netstat.java | 2 +- include/sigar.h | 1 + src/os/aix/aix_sigar.c | 2 +- src/os/darwin/darwin_sigar.c | 5 +++++ src/os/hpux/hpux_sigar.c | 2 -- src/os/linux/linux_sigar.c | 2 +- src/os/solaris/solaris_sigar.c | 1 + src/os/win32/win32_sigar.c | 1 + 9 files changed, 16 insertions(+), 5 deletions(-) diff --git a/bindings/java/src/jni/generate.pl b/bindings/java/src/jni/generate.pl index 2d6943cf..d7336a64 100644 --- a/bindings/java/src/jni/generate.pl +++ b/bindings/java/src/jni/generate.pl @@ -1063,6 +1063,11 @@ my %classes = ( desc => '', plat => '' }, + { + name => 'in_errs', type => 'Long', + desc => '', + plat => '' + }, { name => 'out_rsts', type => 'Long', desc => '', diff --git a/bindings/java/src/org/hyperic/sigar/cmd/Netstat.java b/bindings/java/src/org/hyperic/sigar/cmd/Netstat.java index c8f84e2b..c0f8d223 100644 --- a/bindings/java/src/org/hyperic/sigar/cmd/Netstat.java +++ b/bindings/java/src/org/hyperic/sigar/cmd/Netstat.java @@ -171,7 +171,7 @@ public class Netstat extends SigarCommandBase { println(dnt + stat.getInSegs() + " segments received"); println(dnt + stat.getOutSegs() + " segments send out"); println(dnt + stat.getRetransSegs() + " segments retransmited"); - //println(dnt + stat.getInErrs() + " bad segments received."); + println(dnt + stat.getInErrs() + " bad segments received."); println(dnt + stat.getOutRsts() + " resets sent"); } diff --git a/include/sigar.h b/include/sigar.h index f7de7ce8..c1eca485 100644 --- a/include/sigar.h +++ b/include/sigar.h @@ -696,6 +696,7 @@ typedef struct { sigar_uint64_t in_segs; sigar_uint64_t out_segs; sigar_uint64_t retrans_segs; + sigar_uint64_t in_errs; sigar_uint64_t out_rsts; } sigar_tcp_t; diff --git a/src/os/aix/aix_sigar.c b/src/os/aix/aix_sigar.c index 223d4055..becca188 100644 --- a/src/os/aix/aix_sigar.c +++ b/src/os/aix/aix_sigar.c @@ -2288,7 +2288,7 @@ sigar_tcp_get(sigar_t *sigar, tcp->in_segs = proto.u.tcp.ipackets; tcp->out_segs = proto.u.tcp.opackets; tcp->retrans_segs = 0; - /* tcp->inerrs = proto.u.tcp.ierrors; */ + tcp->in_errs = proto.u.tcp.ierrors; tcp->out_rsts = 0; } diff --git a/src/os/darwin/darwin_sigar.c b/src/os/darwin/darwin_sigar.c index 495338d6..57d91add 100644 --- a/src/os/darwin/darwin_sigar.c +++ b/src/os/darwin/darwin_sigar.c @@ -2233,6 +2233,11 @@ sigar_tcp_get(sigar_t *sigar, tcp->in_segs = mib.tcps_rcvtotal; tcp->out_segs = mib.tcps_sndtotal - mib.tcps_sndrexmitpack; tcp->retrans_segs = mib.tcps_sndrexmitpack; + tcp->in_errs = + mib.tcps_rcvbadsum + + mib.tcps_rcvbadoff + + mib.tcps_rcvmemdrop + + mib.tcps_rcvshort; tcp->out_rsts = mib.tcps_sndctrl - mib.tcps_closed; return SIGAR_OK; diff --git a/src/os/hpux/hpux_sigar.c b/src/os/hpux/hpux_sigar.c index 1c6e0914..76235e3a 100644 --- a/src/os/hpux/hpux_sigar.c +++ b/src/os/hpux/hpux_sigar.c @@ -1063,9 +1063,7 @@ static struct { { ID_tcpInSegs, tcpsoff(in_segs) }, { ID_tcpOutSegs, tcpsoff(out_segs) }, { ID_tcpRetransSegs, tcpsoff(retrans_segs) }, -#if 0 { ID_tcpInErrs, tcpsoff(in_errs) }, -#endif { ID_tcpOutRsts, tcpsoff(out_rsts) } }; diff --git a/src/os/linux/linux_sigar.c b/src/os/linux/linux_sigar.c index f8e4bd2f..3c801285 100644 --- a/src/os/linux/linux_sigar.c +++ b/src/os/linux/linux_sigar.c @@ -2160,7 +2160,7 @@ sigar_tcp_get(sigar_t *sigar, tcp->in_segs = sigar_strtoull(ptr); tcp->out_segs = sigar_strtoull(ptr); tcp->retrans_segs = sigar_strtoull(ptr); - (void)sigar_strtoull(ptr); /* InErrs */ + tcp->in_errs = sigar_strtoull(ptr); tcp->out_rsts = sigar_strtoull(ptr); } diff --git a/src/os/solaris/solaris_sigar.c b/src/os/solaris/solaris_sigar.c index 1014ddee..790817df 100644 --- a/src/os/solaris/solaris_sigar.c +++ b/src/os/solaris/solaris_sigar.c @@ -2411,6 +2411,7 @@ sigar_tcp_get(sigar_t *sigar, tcp->in_segs = mib->tcpInSegs; tcp->out_segs = mib->tcpOutSegs; tcp->retrans_segs = mib->tcpRetransSegs; + tcp->in_errs = SIGAR_FIELD_NOTIMPL; /* XXX mib2_ip_t.tcpInErrs */ tcp->out_rsts = mib->tcpOutRsts; return SIGAR_OK; } diff --git a/src/os/win32/win32_sigar.c b/src/os/win32/win32_sigar.c index 4394d6f0..43f06c9f 100644 --- a/src/os/win32/win32_sigar.c +++ b/src/os/win32/win32_sigar.c @@ -2812,6 +2812,7 @@ sigar_tcp_get(sigar_t *sigar, tcp->in_segs = mib.dwInSegs; tcp->out_segs = mib.dwOutSegs; tcp->retrans_segs = mib.dwRetransSegs; + tcp->in_errs = mib.dwInErrs; tcp->out_rsts = mib.dwOutRsts; return SIGAR_OK;