ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/libstatgrab/network_stats.c
(Generate patch)

Comparing projects/libstatgrab/src/libstatgrab/network_stats.c (file contents):
Revision 1.6 by pajs, Fri Mar 7 11:56:44 2003 UTC vs.
Revision 1.8 by pajs, Tue Mar 11 16:16:20 2003 UTC

# Line 107 | Line 107 | network_stat_t *get_network_stats(int *entries){
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                          }
# Line 117 | Line 127 | network_stat_t *get_network_stats(int *entries){
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                          }
# Line 178 | Line 188 | network_stat_t *get_network_stats(int *entries){
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){

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines