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.21 by ats, Tue Sep 9 08:43:33 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 >                if(stats.dinfo==NULL) return NULL;
342 >                stats_init = 1;
343 >        }
344          if ((getdevs(&stats)) < 0) return NULL;
345          /* Not aware of a get all devices, so i said 999. If we ever
346           * find a machine with more than 999 disks, then i'll change

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines