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.28 by tdb, Thu Feb 12 23:58:32 2004 UTC vs.
Revision 1.29 by pajs, Fri Feb 13 14:39:34 2004 UTC

# Line 339 | Line 339 | void network_iface_stat_init(int start, int end, netwo
339          for(net_stats+=start; start<end; start++){
340                  net_stats->interface_name=NULL;
341                  net_stats->speed=0;
342 <                net_stats->dup=NO_DUPLEX;
342 >                net_stats->dup=UNKNOWN_DUPEX;
343                  net_stats++;
344          }
345   }
# Line 469 | Line 469 | network_iface_stat_t *get_network_iface_stats(int *ent
469                  }else if( (ifmed.ifm_active | IFM_HDX) == ifmed.ifm_active ){
470                          network_iface_stat_ptr->dup = HALF_DUPLEX;
471                  }else{
472 <                        network_iface_stat_ptr->dup = NO_DUPLEX;
472 >                        network_iface_stat_ptr->dup = UNKNOWN_DUPEX;
473                  }
474                  ifaces++;
475          }      
# Line 532 | Line 532 | network_iface_stat_t *get_network_iface_stats(int *ent
532          if(eth_tool_cmd_buf == NULL) return NULL;
533  
534          /* Ignore first 2 lines.. Just headings */
535 <        fgets(line, sizeof(line), f);
536 <        fgets(line, sizeof(line), f);
535 >        if((fgets(line, sizeof(line), f)) == NULL) return NULL;
536 >        if((fgets(line, sizeof(line), f)) == NULL) return NULL;
537  
538          while((fgets(line, sizeof(line), f)) != NULL){
539                  char *name, *ptr;
# Line 555 | Line 555 | network_iface_stat_t *get_network_iface_stats(int *ent
555                  ifr.ifr_data = (caddr_t) eth_tool_cmd_buf;
556                  strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
557  
558 <                ethcmd = (struct ethtool_cmd *)(&ifr)->ifr_data;
558 >                ethcmd = (struct ethtool_cmd *) ifr.ifr_data;
559                  ethcmd->cmd = ETHTOOL_GSET;
560  
561                  err = ioctl(sock, SIOCETHTOOL, &ifr);
# Line 574 | Line 574 | network_iface_stat_t *get_network_iface_stats(int *ent
574                  network_iface_stat_ptr = network_iface_stats + ifaces;
575                  network_iface_stat_ptr->interface_name = strdup(name);
576                  network_iface_stat_ptr->speed = ethcmd->speed;
577 <                network_iface_stat_ptr->dup = NO_DUPLEX;
577 >                network_iface_stat_ptr->dup = UNKNOWN_DUPEX;
578                  if(ethcmd->duplex == 0x00){
579                          network_iface_stat_ptr->dup = FULL_DUPLEX;
580                  }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines