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.78 by tdb, Mon Oct 9 14:09:38 2006 UTC vs.
Revision 1.80 by tdb, Mon Oct 9 17:25:06 2006 UTC

# Line 235 | Line 235 | sg_network_io_stats *sg_get_network_io_stats(int *entr
235                          }
236                          network_stat_ptr=network_stats+interfaces;
237  
238 +                        /* Read interface name */
239 +                        if (sg_update_string(&network_stat_ptr->interface_name,
240 +                                             ksp->ks_name) < 0) {
241 +                                kstat_close(kc);
242 +                                return NULL;
243 +                        }
244 +
245                          /* Finish reading rx */
246                          network_stat_ptr->rx=knp->VALTYPE;
247  
# Line 274 | Line 281 | sg_network_io_stats *sg_get_network_io_stats(int *entr
281                          }
282                          network_stat_ptr->collisions=knp->value.ui32;
283  
277                        /* Read interface name */
278                        if (sg_update_string(&network_stat_ptr->interface_name,
279                                             ksp->ks_name) < 0) {
280                                kstat_close(kc);
281                                return NULL;
282                        }
284  
285                          /* Store systime */
286                          network_stat_ptr->systime=time(NULL);
# Line 697 | Line 698 | sg_network_iface_stats *sg_get_network_iface_stats(int
698                          }
699  
700                          if ((ifr.ifr_flags & IFF_UP) != 0) {
701 <                                network_iface_stat_ptr->up = 1;
701 >                                if ((knp = kstat_data_lookup(ksp, "link_up")) != NULL) {
702 >                                        /* take in to account if link
703 >                                         * is up as well as interface */
704 >                                        if (knp->value.ui32 != 0u) {
705 >                                                network_iface_stat_ptr->up = 1;
706 >                                        } else {
707 >                                                network_iface_stat_ptr->up = 0;
708 >                                        }
709 >                                }
710 >                                else {
711 >                                        /* maintain compatibility */
712 >                                        network_iface_stat_ptr->up = 1;
713 >                                }
714                          } else {
715                                  network_iface_stat_ptr->up = 0;
716                          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines