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.28 by pajs, Thu Oct 9 15:22:59 2003 UTC vs.
Revision 1.31 by ats, Sun Oct 19 02:03:02 2003 UTC

# Line 35 | Line 35
35   #endif
36  
37   #ifdef LINUX
38 + #include <time.h>
39   #include <sys/vfs.h>
40   #include <mntent.h>
41   #include "tools.h"
42   #define VALID_FS_TYPES {"ext2", "ext3", "xfs", "reiserfs", "vfat", "tmpfs"}
43   #endif
44  
45 < #ifdef FREEBSD
45 > #ifdef ALLBSD
46   #include <sys/param.h>
47   #include <sys/ucred.h>
48   #include <sys/mount.h>
49 + #define VALID_FS_TYPES {"ufs", "mfs", "ffs"}
50 + #endif
51 + #ifdef FREEBSD
52   #include <sys/dkstat.h>
53   #include <devstat.h>
50 #define VALID_FS_TYPES {"ufs", "mfs"}
54   #endif
55 +
56   #define START_VAL 1
57  
58   char *copy_string(char *orig_ptr, const char *newtext){
# Line 97 | Line 101 | disk_stat_t *get_disk_stats(int *entries){
101          struct mntent *mp;
102          struct statfs fs;
103   #endif
104 < #ifdef FREEBSD
104 > #ifdef ALLBSD
105          int nummnt;
106          struct statfs *mp;
107   #endif
# Line 110 | Line 114 | disk_stat_t *get_disk_stats(int *entries){
114                  watermark=START_VAL;
115                  init_disk_stat(0, watermark-1, disk_stats);
116          }
117 < #ifdef FREEBSD
117 > #ifdef ALLBSD
118          nummnt=getmntinfo(&mp , MNT_LOCAL);
119          if (nummnt<=0){
120                  return NULL;
# Line 174 | Line 178 | disk_stat_t *get_disk_stats(int *entries){
178                          }
179  
180                          disk_ptr=disk_stats+num_disks;
181 < #ifdef FREEBSD
181 > #ifdef ALLBSD
182                          if((disk_ptr->device_name=copy_string(disk_ptr->device_name, mp->f_mntfromname))==NULL){
183                                  return NULL;
184                          }
# Line 333 | Line 337 | diskio_stat_t *get_diskio_stats(int *entries){
337          long sel_gen;
338          struct devstat *dev_ptr;
339   #endif
340 + #ifdef NETBSD
341 +        /* FIXME get_diskio_stats NYI on NetBSD.
342 +         * See vmstat/dkstats.c in NetBSD source for examples.
343 +         */
344 + #endif
345          num_diskio=0;
346  
347   #ifdef FREEBSD
# Line 344 | Line 353 | diskio_stat_t *get_diskio_stats(int *entries){
353          }
354   #ifdef FREEBSD5
355          if ((devstat_getdevs(NULL, &stats)) < 0) return NULL;
356 <        /* Not aware of a get all devices, so i said 999. If we ever                                                                           * find a machine with more than 999 disks, then i'll change                                                                           * this number :)                                                                                                                      */
356 >        /* Not aware of a get all devices, so i said 999. If we ever
357 >         * find a machine with more than 999 disks, then i'll change
358 >         * this number :)
359 >         */
360          if (devstat_selectdevs(&dev_sel, &n_selected, &n_selections, &sel_gen, stats.dinfo->generation, stats.dinfo->devices, stats.dinfo->numdevs, NULL, 0, NULL, 0, DS_SELECT_ONLY, 999, 1) < 0) return NULL;
361   #else
362          if ((getdevs(&stats)) < 0) return NULL;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines