Index: devpcp/src/pmdas/linux/pmda.c =================================================================== --- devpcp.orig/src/pmdas/linux/pmda.c 2007-03-21 16:05:37.633833500 +1100 +++ devpcp/src/pmdas/linux/pmda.c 2007-03-21 16:05:50.338627500 +1100 @@ -3523,14 +3523,19 @@ linux_fetchCallBack(pmdaMetric *mdesc, u } switch (idp->item) { + __uint64_t ull, used; + case 1: /* filesys.capacity */ - atom->ull = ((__uint64_t)sbuf->f_blocks) * sbuf->f_bsize / 1024; + ull = (__uint64_t)sbuf->f_blocks; + atom->ull = ull * sbuf->f_bsize / 1024; break; case 2: /* filesys.used */ - atom->ull = ((__uint64_t)(sbuf->f_blocks - sbuf->f_bfree)) * sbuf->f_bsize / 1024; + used = (__uint64_t)(sbuf->f_blocks - sbuf->f_bfree); + atom->ull = used * sbuf->f_bsize / 1024; break; case 3: /* filesys.free */ - atom->ull = ((__uint64_t)(sbuf->f_bfree)) * sbuf->f_bsize / 1024; + ull = (__uint64_t)sbuf->f_bfree; + atom->ull = ull * sbuf->f_bsize / 1024; break; case 4: /* filesys.maxfiles */ atom->ul = sbuf->f_files; @@ -3545,14 +3550,17 @@ linux_fetchCallBack(pmdaMetric *mdesc, u atom->cp = filesys.mounts[i].path; break; case 8: /* filesys.full */ - atom->d = 100.0 - 100.0 * (double)sbuf->f_bfree / (double)sbuf->f_blocks; + used = (__uint64_t)(sbuf->f_blocks - sbuf->f_bfree); + ull = used + (__uint64_t)sbuf->f_bavail; + atom->d = (100.0 * (double)used) / (double)ull; + break; + case 9: /* filesys.blocksize -- added by Mike Mason */ + atom->ul = sbuf->f_bsize; + break; + case 10: /* filesys.avail -- added by Mike Mason */ + ull = (__uint64_t)sbuf->f_bavail; + atom->ull = ull * sbuf->f_bsize / 1024; break; - case 9: /* filesys.blocksize -- added by Mike Mason */ - atom->ul = sbuf->f_bsize; - break; - case 10: /* filesys.avail -- added by Mike Mason */ - atom->ull = ((__uint64_t)(sbuf->f_bavail)) * sbuf->f_bsize / 1024; - break; default: return PM_ERR_PMID; } Index: devpcp/src/pmdas/darwin/pmda.c =================================================================== --- devpcp.orig/src/pmdas/darwin/pmda.c 2007-03-21 16:09:25.524075750 +1100 +++ devpcp/src/pmdas/darwin/pmda.c 2007-03-21 16:13:47.764464750 +1100 @@ -830,6 +830,8 @@ fetch_uname(unsigned int item, pmAtomVal static inline int fetch_filesys(unsigned int item, unsigned int inst, pmAtomValue *atom) { + __uint64_t ull, used; + if (mach_fs_error) return mach_fs_error; if (item == 31) { /* hinv.nfilesys */ @@ -842,16 +844,16 @@ fetch_filesys(unsigned int item, unsigne return PM_ERR_INST; switch (item) { case 32: /* filesys.capacity */ - atom->ull = ((__uint64_t)mach_fs[inst].f_blocks) * - mach_fs[inst].f_bsize >> 10; + ull = (__uint64_t)mach_fs[inst].f_blocks; + atom->ull = ull * mach_fs[inst].f_bsize >> 10; return 1; case 33: /* filesys.used */ - atom->ull = ((__uint64_t)(mach_fs[inst].f_blocks - - mach_fs[inst].f_bfree)) * mach_fs[inst].f_bsize >> 10; + used = (__uint64_t)(mach_fs[inst].f_blocks - mach_fs[inst].f_bfree); + atom->ull = used * mach_fs[inst].f_bsize >> 10; return 1; case 34: /* filesys.free */ - atom->ull = ((__uint64_t)(mach_fs[inst].f_bfree)) * - mach_fs[inst].f_bsize >> 10; + ull = (__uint64_t)mach_fs[inst].f_bfree; + atom->ull = ull * mach_fs[inst].f_bsize >> 10; return 1; case 35: /* filesys.usedfiles */ atom->ul = mach_fs[inst].f_files; @@ -863,16 +865,16 @@ fetch_filesys(unsigned int item, unsigne atom->cp = mach_fs[inst].f_mntonname; return 1; case 38: /* filesys.full */ - atom->d = (!mach_fs[inst].f_blocks) ? 0 : - (100.0 - (100.0 * (double)mach_fs[inst].f_bfree / - (double)mach_fs[inst].f_blocks)); + used = (__uint64_t)(mach_fs[inst].f_blocks - mach_fs[inst].f_bfree); + ull = used + (__uint64_t)mach_fs[inst].f_bavail; + atom->d = (100.0 * (double)used) / (double)ull; return 1; case 39: /* filesys.blocksize */ atom->ul = mach_fs[inst].f_bsize; return 1; case 40: /* filesys.avail */ - atom->ull = ((__uint64_t)mach_fs[inst].f_bavail) * - mach_fs[inst].f_bsize >> 10; + ull = (__uint64_t)mach_fs[inst].f_bavail; + atom->ull = ull * mach_fs[inst].f_bsize >> 10; return 1; case 41: /* filesys.type */ atom->cp = mach_fs[inst].f_fstypename;