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

Comparing projects/libstatgrab/src/libstatgrab/disk_stats.c (file contents):
Revision 1.20 by ats, Thu Aug 28 23:05:56 2003 UTC vs.
Revision 1.26 by tdb, Wed Oct 8 09:20:56 2003 UTC

# Line 325 | Line 325 | diskio_stat_t *get_diskio_stats(int *entries){
325          time_t now;
326   #endif
327   #ifdef FREEBSD
328 <        struct statinfo stats;
328 >        static struct statinfo stats;
329 >        static int stats_init = 0;
330          int counter;
331          struct device_selection *dev_sel = NULL;
332          int n_selected, n_selections;
# Line 335 | Line 336 | diskio_stat_t *get_diskio_stats(int *entries){
336          num_diskio=0;
337  
338   #ifdef FREEBSD
339 <        stats.dinfo=malloc(sizeof(struct devinfo));
340 <        if(stats.dinfo==NULL) return NULL;
339 >        if (!stats_init) {
340 >                stats.dinfo=malloc(sizeof(struct devinfo));
341 >                bzero(stats.dinfo, sizeof(struct devinfo));
342 >                if(stats.dinfo==NULL) return NULL;
343 >                stats_init = 1;
344 >        }
345          if ((getdevs(&stats)) < 0) return NULL;
346          /* Not aware of a get all devices, so i said 999. If we ever
347           * find a machine with more than 999 disks, then i'll change
# Line 366 | Line 371 | diskio_stat_t *get_diskio_stats(int *entries){
371                  num_diskio++;
372          }
373          free(dev_sel);
369        free(stats.dinfo);
374  
375   #endif
376   #ifdef SOLARIS

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines