remove unused code
This commit is contained in:
		
							parent
							
								
									b18c9b2c3d
								
							
						
					
					
						commit
						b801cbc500
					
				@ -1724,62 +1724,6 @@ static int sigar_net_ifstat_get_lo(sigar_t *sigar, const char *name,
 | 
				
			|||||||
    return SIGAR_OK;
 | 
					    return SIGAR_OK;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if 0
 | 
					 | 
				
			||||||
/* looking for sigar_net_ifstat_get_any alternative,
 | 
					 | 
				
			||||||
 * but dont get much data this way.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
static int sigar_net_ifstat_get_mib2(sigar_t *sigar, const char *name,
 | 
					 | 
				
			||||||
                                     sigar_net_interface_stat_t *ifstat)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    char *data;
 | 
					 | 
				
			||||||
    int len;
 | 
					 | 
				
			||||||
    int rc;
 | 
					 | 
				
			||||||
    struct opthdr *op;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    while ((rc = get_mib2(&sigar->mib2, &op, &data, &len)) == GET_MIB2_OK) {
 | 
					 | 
				
			||||||
        mib2_ipAddrEntry_t *entry;
 | 
					 | 
				
			||||||
        char *end;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (!((op->level == MIB2_IP) && (op->name == MIB2_IP_ADDR))) {
 | 
					 | 
				
			||||||
            continue;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        for (entry = (mib2_ipAddrEntry_t *)data, end = data + len;
 | 
					 | 
				
			||||||
             (char *)entry < end; entry++)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            if (strEQ(name, entry->ipAdEntIfIndex.o_bytes)) {
 | 
					 | 
				
			||||||
                struct ipAdEntInfo_s *info = &entry->ipAdEntInfo;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                ifstat->rx_bytes      = -1;
 | 
					 | 
				
			||||||
                ifstat->rx_packets    = info->ae_ibcnt;
 | 
					 | 
				
			||||||
                ifstat->rx_errors     = -1;
 | 
					 | 
				
			||||||
                ifstat->rx_dropped    = -1;
 | 
					 | 
				
			||||||
                ifstat->rx_overruns   = -1;
 | 
					 | 
				
			||||||
                ifstat->rx_frame      = -1;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                ifstat->tx_bytes      = -1;
 | 
					 | 
				
			||||||
                ifstat->tx_packets    = info->ae_obcnt;
 | 
					 | 
				
			||||||
                ifstat->tx_errors     = -1;
 | 
					 | 
				
			||||||
                ifstat->tx_dropped    = -1;
 | 
					 | 
				
			||||||
                ifstat->tx_overruns   = -1;
 | 
					 | 
				
			||||||
                ifstat->tx_collisions = -1;
 | 
					 | 
				
			||||||
                ifstat->tx_carrier    = -1;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                close_mib2(&sigar->mib2);
 | 
					 | 
				
			||||||
                return SIGAR_OK;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (rc != GET_MIB2_EOD) {
 | 
					 | 
				
			||||||
        close_mib2(&sigar->mib2);
 | 
					 | 
				
			||||||
        return SIGAR_EMIB2;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return SIGAR_OK;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void ifstat_kstat_common(sigar_net_interface_stat_t *ifstat,
 | 
					static void ifstat_kstat_common(sigar_net_interface_stat_t *ifstat,
 | 
				
			||||||
                                kstat_named_t *data, int ndata)
 | 
					                                kstat_named_t *data, int ndata)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -1856,76 +1800,7 @@ static void ifstat_kstat_common(sigar_net_interface_stat_t *ifstat,
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#if 0
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
http://cvs.opensolaris.org/source/xref/usr/src/uts/common/io/bge/bge_kstats.c
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
static void ifstat_kstat_bge(sigar_net_interface_stat_t *ifstat,
 | 
					 | 
				
			||||||
                             kstat_named_t *data, int ndata)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    int i;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (i=0; i<ndata; i++) {
 | 
					 | 
				
			||||||
        sigar_uint64_t value = data[i].value.ui32;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        char *ptr = data[i].name;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        switch (*ptr) {
 | 
					 | 
				
			||||||
          case 'd':
 | 
					 | 
				
			||||||
            if (strEQ(ptr, "dot3StatsFrameTooLongs")) {
 | 
					 | 
				
			||||||
                ifstat->rx_frame = value;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            else if (strEQ(ptr, "dot3StatsCarrierSenseErrors")) {
 | 
					 | 
				
			||||||
                ifstat->tx_carrier = value;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
          case 'e':
 | 
					 | 
				
			||||||
            if (strEQ(ptr, "etherStatsCollisions")) {
 | 
					 | 
				
			||||||
                ifstat->tx_collisions = value;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            else if (strEQ(ptr, "etherStatsUndersizePkts")) {
 | 
					 | 
				
			||||||
                ifstat->rx_overruns = ifstat->tx_overruns =
 | 
					 | 
				
			||||||
                    value;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
          case 'i':
 | 
					 | 
				
			||||||
            if (strEQ(ptr, "ifHCInOctets")) {
 | 
					 | 
				
			||||||
                ifstat->rx_bytes = value;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            else if (strEQ(ptr, "ifHCOutOctets")) {
 | 
					 | 
				
			||||||
                ifstat->tx_bytes = value;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            else if (strEQ(ptr, "ifHCInUcastPkts") ||
 | 
					 | 
				
			||||||
                     strEQ(ptr, "ifHCInMulticastPkts") ||
 | 
					 | 
				
			||||||
                     strEQ(ptr, "ifHCInBroadcastPkts"))
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                ifstat->rx_packets += value;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            else if (strEQ(ptr, "ifHCOutUcastPkts") ||
 | 
					 | 
				
			||||||
                     strEQ(ptr, "ifHCOutMulticastPkts") ||
 | 
					 | 
				
			||||||
                     strEQ(ptr, "ifHCOutBroadcastPkts"))
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                ifstat->tx_packets += value;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            else if (strEQ(ptr, "ifInDiscards")) {
 | 
					 | 
				
			||||||
                ifstat->rx_dropped = value;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            else if (strEQ(ptr, "ifOutDiscards")) {
 | 
					 | 
				
			||||||
                ifstat->tx_dropped = value;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            else if (strEQ(ptr, "ifInErrors")) {
 | 
					 | 
				
			||||||
                ifstat->rx_errors = value;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            else if (strEQ(ptr, "ifOutErrors")) {
 | 
					 | 
				
			||||||
                ifstat->tx_errors = value;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
          default:
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
static int sigar_net_ifstat_get_any(sigar_t *sigar, const char *name,
 | 
					static int sigar_net_ifstat_get_any(sigar_t *sigar, const char *name,
 | 
				
			||||||
                                    sigar_net_interface_stat_t *ifstat)
 | 
					                                    sigar_net_interface_stat_t *ifstat)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user