107 |
|
if (!strcmp(ksp->ks_class, "net")) { |
108 |
|
kstat_read(kc, ksp, NULL); |
109 |
|
|
110 |
< |
if((knp=kstat_data_lookup(ksp, "rbytes64"))==NULL){ |
110 |
> |
#ifdef SOL7 |
111 |
> |
#define RLOOKUP "rbytes" |
112 |
> |
#define WLOOKUP "obytes" |
113 |
> |
#define VALTYPE value.ui32 |
114 |
> |
#else |
115 |
> |
#define RLOOKUP "rbytes64" |
116 |
> |
#define WLOOKUP "obytes64" |
117 |
> |
#define VALTYPE value.ui64 |
118 |
> |
#endif |
119 |
> |
|
120 |
> |
if((knp=kstat_data_lookup(ksp, RLOOKUP))==NULL){ |
121 |
|
/* Not a network interface, so skip to the next entry */ |
122 |
|
continue; |
123 |
|
} |
127 |
|
return NULL; |
128 |
|
} |
129 |
|
network_stat_ptr=network_stats+interfaces; |
130 |
< |
network_stat_ptr->rx=knp->value.ui64; |
130 |
> |
network_stat_ptr->rx=knp->VALTYPE; |
131 |
|
|
132 |
< |
if((knp=kstat_data_lookup(ksp, "obytes64"))==NULL){ |
132 |
> |
if((knp=kstat_data_lookup(ksp, WLOOKUP))==NULL){ |
133 |
|
/* Not a network interface, so skip to the next entry */ |
134 |
|
continue; |
135 |
|
} |
136 |
< |
network_stat_ptr->tx=knp->value.ui64; |
136 |
> |
network_stat_ptr->tx=knp->VALTYPE; |
137 |
|
if(network_stat_ptr->interface_name!=NULL){ |
138 |
|
free(network_stat_ptr->interface_name); |
139 |
|
} |
188 |
|
*entries=interfaces; |
189 |
|
|
190 |
|
return network_stats; |
191 |
+ |
} |
192 |
+ |
|
193 |
+ |
long long transfer_diff(long long new, long long old){ |
194 |
+ |
#ifdef SOL7 |
195 |
+ |
#define MAXVAL 4294967296 |
196 |
+ |
#else |
197 |
+ |
#define MAXVAL 18446744073709551616 |
198 |
+ |
#endif |
199 |
+ |
long long result; |
200 |
+ |
if(new>old){ |
201 |
+ |
result = (new-old); |
202 |
+ |
}else{ |
203 |
+ |
result = (MAXVAL+(new-old)); |
204 |
+ |
} |
205 |
+ |
|
206 |
+ |
return result; |
207 |
+ |
|
208 |
|
} |
209 |
|
|
210 |
|
network_stat_t *get_network_stats_diff(int *entries){ |