Added comments for ll_sp_value() function.
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
rm -f configure
dist: almost-distclean
- cd .. && (tar --exclude=Makefile --exclude=.git -cvf - sysstat-$(VERSION) | gzip -v9 > sysstat-$(VERSION).tar.gz)
+ cd .. && (tar --exclude=Makefile --exclude=.git --dereference -cvf - sysstat-$(VERSION) | gzip -v9 > sysstat-$(VERSION).tar.gz)
bdist: almost-distclean
- cd .. && (tar --exclude=Makefile --exclude=.git -cvf - sysstat-$(VERSION) | bzip2 > sysstat-$(VERSION).tar.bz2)
+ cd .. && (tar --exclude=Makefile --exclude=.git --dereference -cvf - sysstat-$(VERSION) | bzip2 > sysstat-$(VERSION).tar.bz2)
xdist: almost-distclean
- cd .. && (tar --exclude=Makefile --exclude=.git -cvf - sysstat-$(VERSION) | xz > sysstat-$(VERSION).tar.xz)
+ cd .. && (tar --exclude=Makefile --exclude=.git --dereference -cvf - sysstat-$(VERSION) | xz > sysstat-$(VERSION).tar.xz)
gitdist: almost-distclean
- cd .. && (tar --exclude=Makefile -cvf - sysstat-$(VERSION) | bzip2 > sysstat-$(VERSION)-git.tar.bz2)
+ cd .. && (tar --exclude=Makefile --dereference -cvf - sysstat-$(VERSION) | bzip2 > sysstat-$(VERSION)-git.tar.bz2)
tags:
etags ./*.[hc]
hz = (unsigned int) ticks;
}
+/*
+ ***************************************************************************
+ * Workaround for CPU counters read from /proc/stat: Dyn-tick kernels
+ * have a race issue that can make those counters go backward.
+ ***************************************************************************
+ */
double ll_sp_value(unsigned long long value1, unsigned long long value2,
unsigned long long itv)
{
- /* Workaround: dyn-tick kernel has a race issue and /proc/stat values
- could be backward. */
if (value2 < value1)
- return 0;
+ return (double) 0;
else
return SP_VALUE(value1, value2, itv);
}
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/vfs.h>
+#include <sys/statvfs.h>
#include <unistd.h>
#include "common.h"
FILE *fp;
char line[256], fs_name[MAX_FS_LEN], mountp[128];
int fs = 0;
- struct statfs buf;
+ struct statvfs buf;
if ((fp = fopen(MTAB, "r")) == NULL)
/* File non-existent */
oct2chr(mountp);
/* Check that total size is not null */
- if (statfs(mountp, &buf) < 0)
+ if (statvfs(mountp, &buf) < 0)
continue;
if (buf.f_blocks) {
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/vfs.h>
+#include <sys/statvfs.h>
#include <unistd.h>
#include "common.h"
char line[256], fs_name[MAX_FS_LEN], mountp[128];
int fs = 0;
struct stats_filesystem *st_filesystem_i;
- struct statfs buf;
+ struct statvfs buf;
if ((fp = fopen(MTAB, "r")) == NULL)
return;
/* Replace octal codes */
oct2chr(mountp);
- if ((statfs(mountp, &buf) < 0) || (!buf.f_blocks))
+ if ((statvfs(mountp, &buf) < 0) || (!buf.f_blocks))
continue;
st_filesystem_i = st_filesystem + fs++;
- st_filesystem_i->f_blocks = buf.f_blocks * buf.f_bsize;
- st_filesystem_i->f_bfree = buf.f_bfree * buf.f_bsize;
- st_filesystem_i->f_bavail = buf.f_bavail * buf.f_bsize;
+ st_filesystem_i->f_blocks = buf.f_blocks * buf.f_frsize;
+ st_filesystem_i->f_bfree = buf.f_bfree * buf.f_frsize;
+ st_filesystem_i->f_bavail = buf.f_bavail * buf.f_frsize;
st_filesystem_i->f_files = buf.f_files;
st_filesystem_i->f_ffree = buf.f_ffree;
strcpy(st_filesystem_i->fs_name, fs_name);