There's a problem within kstat concerning how it delivers information on the
chain. There's two empty members.
The following (crappy) code displays the problem:
################# kstatall.c##############
#include </usr/include/stdio.h>
#include </usr/include/kstat.h>
#include </usr/include/sys/kstat.h>
void print_named_kstats(kstat_t *);
main()
{
kstat_ctl_t *kc;
kstat_t *ksp;
if ((kc = kstat_open()) == NULL) {
printf ("kstat_open failed\n");
exit(-1);}
for (ksp = kc->kc_chain; ksp != NULL; ksp = ksp->ks_next) {
printf ("\nModule: %s Name: %s Class: %s Instance: %d Type:
%d\n",ksp->ks_module,ksp->ks_name,ksp->ks_class,ksp->ks_insta
nce,ksp->ks_type);
if (ksp->ks_type == KSTAT_TYPE_NAMED) {
if (kstat_read(kc, ksp, NULL) == -1) {
printf("kstat_read failure\n");
exit(-1);
}
print_named_kstats(ksp);
}
}
kstat_close(kc);
}
void
print_named_kstats(ksp)
kstat_t *ksp;
{
int i;
kstat_named_t *knp = ksp->ks_data;
for (i = 0; i < ksp->ks_ndata; i++, knp++) {
printf("%s : type %d : value :", knp->name,knp->data_type);
switch(knp->data_type) {
case KSTAT_DATA_CHAR:
printf("%s\n", knp->value.c);
continue;
case KSTAT_DATA_INT32:
printf("%d\n", knp->value.i32);
continue;
case KSTAT_DATA_UINT32:
printf("%u\n", knp->value.ui32);
continue;
case KSTAT_DATA_INT64:
printf("%lld\n", knp->value.i64);
continue;
case KSTAT_DATA_UINT64:
printf("%llu\n", knp->value.ui64);
continue;
default:
printf("bad data type\n");
continue;
}
}
}
############## end kstatall.c#########
Here's the output on an E450 running Open Solaris from November
Module: hme Name: hme0 Class: net Instance: 0 Type: 1
ipackets : type 2 : value :48855
ierrors : type 2 : value :0
opackets : type 2 : value :5673
oerrors : type 2 : value :0
collisions : type 2 : value :0
defer : type 2 : value :0
framing : type 2 : value :0
crc : type 2 : value :0
sqe : type 2 : value :0
code_violations : type 2 : value :0
len_errors : type 2 : value :0
ifspeed : type 4 : value :100000000
buff : type 2 : value :0
oflo : type 2 : value :0
uflo : type 2 : value :0
missed : type 2 : value :0
tx_late_collisions : type 2 : value :0
retry_error : type 2 : value :0
first_collisions : type 2 : value :0
nocanput : type 2 : value :0
allocbfail : type 2 : value :0
runt : type 2 : value :0
jabber : type 2 : value :0
babble : type 2 : value :0
tmd_error : type 2 : value :0
tx_late_error : type 2 : value :0
rx_late_error : type 2 : value :0
slv_parity_error : type 2 : value :0
tx_parity_error : type 2 : value :0
rx_parity_error : type 2 : value :0
slv_error_ack : type 2 : value :0
tx_error_ack : type 2 : value :0
rx_error_ack : type 2 : value :0
tx_tag_error : type 2 : value :0
rx_tag_error : type 2 : value :0
eop_error : type 2 : value :0
no_tmds : type 2 : value :0
no_tbufs : type 2 : value :0
no_rbufs : type 2 : value :0
rx_late_collisions : type 2 : value :0
rbytes : type 2 : value :63229785
obytes : type 2 : value :312279
multircv : type 2 : value :0
multixmt : type 2 : value :0
brdcstrcv : type 2 : value :7272
brdcstxmt : type 2 : value :12
norcvbuf : type 2 : value :0
noxmtbuf : type 2 : value :0
newfree : type 2 : value :0
ipackets64 : type 4 : value :48855
opackets64 : type 4 : value :5673
rbytes64 : type 4 : value :63229785
obytes64 : type 4 : value :312279
align_errors : type 2 : value :0
fcs_errors : type 2 : value :0
: type 0 : value :
sqe_errors : type 2 : value :0
defer_xmts : type 2 : value :0
ex_collisions : type 2 : value :0
macxmt_errors : type 2 : value :0
carrier_errors : type 2 : value :0
toolong_errors : type 2 : value :0
macrcv_errors : type 2 : value :0
link_duplex : type 2 : value :2
inits : type 2 : value :4
rxinits : type 2 : value :0
txinits : type 2 : value :0
dmarh_inits : type 2 : value :0
dmaxh_inits : type 2 : value :0
link_down_cnt : type 2 : value :0
phy_failures : type 2 : value :0
xcvr_vendor : type 4 : value :524311
asic_rev : type 2 : value :193
link_up : type 2 : value :1
In particular note:
fcs_errors : type 2 : value :0
: type 0 : value :
An earlier run had two sets of null values.
Are these supposed to be there or do I have to program around them?
--
This communication is intended for the use of the recipient to which it is
addressed, and may contain confidential, personal and or privileged
information. Please contact us immediately if you are not the intended
recipient of this communication, and do not copy, distribute, or take action
relying on it. Any communication received in error, or subsequent reply,
should be deleted or destroyed.
_______________________________________________
networking-discuss mailing list
[email protected]