remove _stat from sigar_tcp names
This commit is contained in:
1 parent
7e0b4af3ca
commit
f8c583fbc8
16 files changed
+82
-84
No files matched your search
+12
-12
@@ -2264,8 +2264,8 @@ int sigar_net_connection_walk(sigar_net_connection_walker_t *walker)
|
||||
}
|
||||
|
||||
SIGAR_DECLARE(int)
|
||||
sigar_tcp_stat_get(sigar_t *sigar,
|
||||
sigar_tcp_stat_t *tcpstat)
|
||||
sigar_tcp_get(sigar_t *sigar,
|
||||
sigar_tcp_t *tcp)
|
||||
{
|
||||
perfstat_id_t id;
|
||||
perfstat_protocol_t proto;
|
||||
@@ -2280,16 +2280,16 @@ sigar_tcp_stat_get(sigar_t *sigar,
|
||||
return ENOENT;
|
||||
}
|
||||
|
||||
tcpstat->active_opens = proto.u.tcp.initiated;
|
||||
tcpstat->passive_opens = proto.u.tcp.accepted;
|
||||
tcpstat->attempt_fails = proto.u.tcp.dropped;
|
||||
tcpstat->estab_resets = proto.u.tcp.dropped;
|
||||
tcpstat->curr_estab = proto.u.tcp.established;
|
||||
tcpstat->in_segs = proto.u.tcp.ipackets;
|
||||
tcpstat->out_segs = proto.u.tcp.opackets;
|
||||
tcpstat->retrans_segs = 0;
|
||||
/* tcpstat->inerrs = proto.u.tcp.ierrors; */
|
||||
tcpstat->out_rsts = 0;
|
||||
tcp->active_opens = proto.u.tcp.initiated;
|
||||
tcp->passive_opens = proto.u.tcp.accepted;
|
||||
tcp->attempt_fails = proto.u.tcp.dropped;
|
||||
tcp->estab_resets = proto.u.tcp.dropped;
|
||||
tcp->curr_estab = proto.u.tcp.established;
|
||||
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->out_rsts = 0;
|
||||
}
|
||||
|
||||
#define NFS_V2_STAT_SET(type) \
|
||||
|
||||
@@ -2212,8 +2212,8 @@ int sigar_net_connection_walk(sigar_net_connection_walker_t *walker)
|
||||
#endif
|
||||
|
||||
SIGAR_DECLARE(int)
|
||||
sigar_tcp_stat_get(sigar_t *sigar,
|
||||
sigar_tcp_stat_t *tcpstat)
|
||||
sigar_tcp_get(sigar_t *sigar,
|
||||
sigar_tcp_t *tcp)
|
||||
{
|
||||
struct tcpstat mib;
|
||||
int var[4] = { CTL_NET, PF_INET, IPPROTO_TCP, TCPCTL_STATS };
|
||||
@@ -2223,17 +2223,17 @@ sigar_tcp_stat_get(sigar_t *sigar,
|
||||
return errno;
|
||||
}
|
||||
|
||||
tcpstat->active_opens = mib.tcps_connattempt;
|
||||
tcpstat->passive_opens = mib.tcps_accepts;
|
||||
tcpstat->attempt_fails = mib.tcps_conndrops;
|
||||
tcpstat->estab_resets = mib.tcps_drops;
|
||||
if (sigar_tcp_stat_curr_estab(sigar, tcpstat) != SIGAR_OK) {
|
||||
tcpstat->curr_estab = -1;
|
||||
tcp->active_opens = mib.tcps_connattempt;
|
||||
tcp->passive_opens = mib.tcps_accepts;
|
||||
tcp->attempt_fails = mib.tcps_conndrops;
|
||||
tcp->estab_resets = mib.tcps_drops;
|
||||
if (sigar_tcp_curr_estab(sigar, tcp) != SIGAR_OK) {
|
||||
tcp->curr_estab = -1;
|
||||
}
|
||||
tcpstat->in_segs = mib.tcps_rcvtotal;
|
||||
tcpstat->out_segs = mib.tcps_sndtotal - mib.tcps_sndrexmitpack;
|
||||
tcpstat->retrans_segs = mib.tcps_sndrexmitpack;
|
||||
tcpstat->out_rsts = mib.tcps_sndctrl - mib.tcps_closed;
|
||||
tcp->in_segs = mib.tcps_rcvtotal;
|
||||
tcp->out_segs = mib.tcps_sndtotal - mib.tcps_sndrexmitpack;
|
||||
tcp->retrans_segs = mib.tcps_sndrexmitpack;
|
||||
tcp->out_rsts = mib.tcps_sndctrl - mib.tcps_closed;
|
||||
|
||||
return SIGAR_OK;
|
||||
}
|
||||
|
||||
@@ -1070,8 +1070,8 @@ static struct {
|
||||
};
|
||||
|
||||
SIGAR_DECLARE(int)
|
||||
sigar_tcp_stat_get(sigar_t *sigar,
|
||||
sigar_tcp_stat_t *tcpstat)
|
||||
sigar_tcp_get(sigar_t *sigar,
|
||||
sigar_tcp_t *tcp)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -1087,7 +1087,7 @@ sigar_tcp_stat_get(sigar_t *sigar,
|
||||
val = -1;
|
||||
}
|
||||
|
||||
*(sigar_uint64_t *)((char *)tcpstat + tcps_lu[i].offset) = val;
|
||||
*(sigar_uint64_t *)((char *)tcp + tcps_lu[i].offset) = val;
|
||||
}
|
||||
|
||||
return SIGAR_OK;
|
||||
|
||||
+11
-11
@@ -2126,8 +2126,8 @@ static int sigar_net_connection_get(sigar_t *sigar,
|
||||
#define SNMP_TCP_PREFIX "Tcp: "
|
||||
|
||||
SIGAR_DECLARE(int)
|
||||
sigar_tcp_stat_get(sigar_t *sigar,
|
||||
sigar_tcp_stat_t *tcpstat)
|
||||
sigar_tcp_get(sigar_t *sigar,
|
||||
sigar_tcp_t *tcp)
|
||||
{
|
||||
FILE *fp;
|
||||
char buffer[1024], *ptr=buffer;
|
||||
@@ -2152,16 +2152,16 @@ sigar_tcp_stat_get(sigar_t *sigar,
|
||||
/* assuming field order, same in 2.2, 2.4 and 2.6 kernels */
|
||||
/* Tcp: RtoAlgorithm RtoMin RtoMax MaxConn */
|
||||
ptr = sigar_skip_multiple_token(ptr, 5);
|
||||
tcpstat->active_opens = sigar_strtoull(ptr);
|
||||
tcpstat->passive_opens = sigar_strtoull(ptr);
|
||||
tcpstat->attempt_fails = sigar_strtoull(ptr);
|
||||
tcpstat->estab_resets = sigar_strtoull(ptr);
|
||||
tcpstat->curr_estab = sigar_strtoull(ptr);
|
||||
tcpstat->in_segs = sigar_strtoull(ptr);
|
||||
tcpstat->out_segs = sigar_strtoull(ptr);
|
||||
tcpstat->retrans_segs = sigar_strtoull(ptr);
|
||||
tcp->active_opens = sigar_strtoull(ptr);
|
||||
tcp->passive_opens = sigar_strtoull(ptr);
|
||||
tcp->attempt_fails = sigar_strtoull(ptr);
|
||||
tcp->estab_resets = sigar_strtoull(ptr);
|
||||
tcp->curr_estab = sigar_strtoull(ptr);
|
||||
tcp->in_segs = sigar_strtoull(ptr);
|
||||
tcp->out_segs = sigar_strtoull(ptr);
|
||||
tcp->retrans_segs = sigar_strtoull(ptr);
|
||||
(void)sigar_strtoull(ptr); /* InErrs */
|
||||
tcpstat->out_rsts = sigar_strtoull(ptr);
|
||||
tcp->out_rsts = sigar_strtoull(ptr);
|
||||
}
|
||||
|
||||
return status;
|
||||
|
||||
@@ -540,8 +540,8 @@ int sigar_net_connection_walk(sigar_net_connection_walker_t *walker)
|
||||
}
|
||||
|
||||
SIGAR_DECLARE(int)
|
||||
sigar_tcp_stat_get(sigar_t *sigar,
|
||||
sigar_tcp_stat_t *tcpstat)
|
||||
sigar_tcp_get(sigar_t *sigar,
|
||||
sigar_tcp_t *tcp)
|
||||
{
|
||||
return SIGAR_ENOTIMPL;
|
||||
}
|
||||
|
||||
@@ -2386,8 +2386,8 @@ int sigar_net_connection_walk(sigar_net_connection_walker_t *walker)
|
||||
}
|
||||
|
||||
SIGAR_DECLARE(int)
|
||||
sigar_tcp_stat_get(sigar_t *sigar,
|
||||
sigar_tcp_stat_t *tcpstat)
|
||||
sigar_tcp_get(sigar_t *sigar,
|
||||
sigar_tcp_t *tcp)
|
||||
{
|
||||
char *data;
|
||||
int len;
|
||||
@@ -2403,15 +2403,15 @@ sigar_tcp_stat_get(sigar_t *sigar,
|
||||
}
|
||||
|
||||
if (mib) {
|
||||
tcpstat->active_opens = mib->tcpActiveOpens;
|
||||
tcpstat->passive_opens = mib->tcpPassiveOpens;
|
||||
tcpstat->attempt_fails = mib->tcpAttemptFails;
|
||||
tcpstat->estab_resets = mib->tcpEstabResets;
|
||||
tcpstat->curr_estab = mib->tcpCurrEstab;
|
||||
tcpstat->in_segs = mib->tcpInSegs;
|
||||
tcpstat->out_segs = mib->tcpOutSegs;
|
||||
tcpstat->retrans_segs = mib->tcpRetransSegs;
|
||||
tcpstat->out_rsts = mib->tcpOutRsts;
|
||||
tcp->active_opens = mib->tcpActiveOpens;
|
||||
tcp->passive_opens = mib->tcpPassiveOpens;
|
||||
tcp->attempt_fails = mib->tcpAttemptFails;
|
||||
tcp->estab_resets = mib->tcpEstabResets;
|
||||
tcp->curr_estab = mib->tcpCurrEstab;
|
||||
tcp->in_segs = mib->tcpInSegs;
|
||||
tcp->out_segs = mib->tcpOutSegs;
|
||||
tcp->retrans_segs = mib->tcpRetransSegs;
|
||||
tcp->out_rsts = mib->tcpOutRsts;
|
||||
return SIGAR_OK;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -254,8 +254,8 @@ int sigar_net_connection_walk(sigar_net_connection_walker_t *walker)
|
||||
}
|
||||
|
||||
SIGAR_DECLARE(int)
|
||||
sigar_tcp_stat_get(sigar_t *sigar,
|
||||
sigar_tcp_stat_t *tcpstat)
|
||||
sigar_tcp_get(sigar_t *sigar,
|
||||
sigar_tcp_t *tcp)
|
||||
{
|
||||
return SIGAR_ENOTIMPL;
|
||||
}
|
||||
|
||||
+11
-11
@@ -2786,8 +2786,8 @@ sigar_net_connection_walk(sigar_net_connection_walker_t *walker)
|
||||
sigar->iphlpapi.get_tcp_stats.func
|
||||
|
||||
SIGAR_DECLARE(int)
|
||||
sigar_tcp_stat_get(sigar_t *sigar,
|
||||
sigar_tcp_stat_t *tcpstat)
|
||||
sigar_tcp_get(sigar_t *sigar,
|
||||
sigar_tcp_t *tcp)
|
||||
{
|
||||
MIB_TCPSTATS mib;
|
||||
int status;
|
||||
@@ -2804,15 +2804,15 @@ sigar_tcp_stat_get(sigar_t *sigar,
|
||||
return status;
|
||||
}
|
||||
|
||||
tcpstat->active_opens = mib.dwActiveOpens;
|
||||
tcpstat->passive_opens = mib.dwPassiveOpens;
|
||||
tcpstat->attempt_fails = mib.dwAttemptFails;
|
||||
tcpstat->estab_resets = mib.dwEstabResets;
|
||||
tcpstat->curr_estab = mib.dwCurrEstab;
|
||||
tcpstat->in_segs = mib.dwInSegs;
|
||||
tcpstat->out_segs = mib.dwOutSegs;
|
||||
tcpstat->retrans_segs = mib.dwRetransSegs;
|
||||
tcpstat->out_rsts = mib.dwOutRsts;
|
||||
tcp->active_opens = mib.dwActiveOpens;
|
||||
tcp->passive_opens = mib.dwPassiveOpens;
|
||||
tcp->attempt_fails = mib.dwAttemptFails;
|
||||
tcp->estab_resets = mib.dwEstabResets;
|
||||
tcp->curr_estab = mib.dwCurrEstab;
|
||||
tcp->in_segs = mib.dwInSegs;
|
||||
tcp->out_segs = mib.dwOutSegs;
|
||||
tcp->retrans_segs = mib.dwRetransSegs;
|
||||
tcp->out_rsts = mib.dwOutRsts;
|
||||
|
||||
return SIGAR_OK;
|
||||
}
|
||||
|
||||
+4
-4
@@ -876,23 +876,23 @@ static int tcp_curr_estab_count(sigar_net_connection_walker_t *walker,
|
||||
if ((conn->state == SIGAR_TCP_ESTABLISHED) ||
|
||||
(conn->state == SIGAR_TCP_CLOSE_WAIT))
|
||||
{
|
||||
((sigar_tcp_stat_t *)walker->data)->curr_estab++;
|
||||
((sigar_tcp_t *)walker->data)->curr_estab++;
|
||||
}
|
||||
|
||||
return SIGAR_OK;
|
||||
}
|
||||
|
||||
/* TCP-MIB::tcpCurrEstab */
|
||||
int sigar_tcp_stat_curr_estab(sigar_t *sigar, sigar_tcp_stat_t *tcpstat)
|
||||
int sigar_tcp_curr_estab(sigar_t *sigar, sigar_tcp_t *tcp)
|
||||
{
|
||||
sigar_net_connection_walker_t walker;
|
||||
|
||||
walker.sigar = sigar;
|
||||
walker.data = tcpstat;
|
||||
walker.data = tcp;
|
||||
walker.add_connection = tcp_curr_estab_count;
|
||||
walker.flags = SIGAR_NETCONN_CLIENT|SIGAR_NETCONN_TCP;
|
||||
|
||||
tcpstat->curr_estab = 0;
|
||||
tcp->curr_estab = 0;
|
||||
|
||||
return sigar_net_connection_walk(&walker);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user